Skip to content

Commit 570c679

Browse files
fix: revert impl_facade!/WriteSyscallFacade reorder to match master — redundant with WriteSyscallFacade stdout/stderr bypass + sigurg_handler Syscall check
Agent-Logs-Url: https://github.com/acl-dev/open-coroutine/sessions/f18791b5-26dd-4ea8-9b97-7f0413fa3459 Co-authored-by: loongs-zhang <38336731+loongs-zhang@users.noreply.github.com>
1 parent 3b2f5d2 commit 570c679

File tree

3 files changed

+3
-21
lines changed

3 files changed

+3
-21
lines changed

core/src/syscall/unix/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,7 @@ macro_rules! impl_facade {
9898
$($arg: $arg_type),*
9999
) -> $result {
100100
let syscall = $crate::common::constants::SyscallName::$syscall;
101-
//先转换状态再记录日志:co.syscall(Executing)会通过on_state_changed
102-
//移除MonitorListener的NOTIFY_NODE,使monitor不再发送SIGURG。
103-
//如果先调用info!()再转换状态,在QEMU等慢平台上info!()可能耗时>10ms,
104-
//导致SIGURG在协程还处于Running状态时被发送,造成抢占活锁。
105-
// Transition state BEFORE logging: co.syscall(Executing) triggers
106-
// on_state_changed which removes MonitorListener's NOTIFY_NODE,
107-
// preventing the monitor from sending SIGURG. If info!() is called
108-
// first while still in Running state, it can take >10ms on slow
109-
// platforms (QEMU), causing SIGURG to fire and preemption live-lock.
101+
$crate::info!("enter syscall {}", syscall);
110102
if let Some(co) = $crate::scheduler::SchedulableCoroutine::current() {
111103
let new_state = $crate::common::constants::SyscallState::Executing;
112104
if co.syscall((), syscall, new_state).is_err() {
@@ -115,7 +107,6 @@ macro_rules! impl_facade {
115107
);
116108
}
117109
}
118-
$crate::info!("enter syscall {}", syscall);
119110
let r = self.inner.$syscall(fn_ptr, $($arg, )*);
120111
if let Some(co) = $crate::scheduler::SchedulableCoroutine::current() {
121112
if co.running().is_err() {

core/src/syscall/unix/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ impl<I: WriteSyscall> WriteSyscall for WriteSyscallFacade<I> {
4242
return RawWriteSyscall::default().write(fn_ptr, fd, buf, len);
4343
}
4444
let syscall = crate::common::constants::SyscallName::write;
45+
crate::info!("enter syscall {}", syscall);
4546
if let Some(co) = crate::scheduler::SchedulableCoroutine::current() {
4647
let new_state = crate::common::constants::SyscallState::Executing;
4748
if co.syscall((), syscall, new_state).is_err() {
@@ -50,7 +51,6 @@ impl<I: WriteSyscall> WriteSyscall for WriteSyscallFacade<I> {
5051
);
5152
}
5253
}
53-
crate::info!("enter syscall {}", syscall);
5454
let r = self.inner.write(fn_ptr, fd, buf, len);
5555
if let Some(co) = crate::scheduler::SchedulableCoroutine::current() {
5656
if co.running().is_err() {

core/src/syscall/windows/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,7 @@ macro_rules! impl_facade {
7676
$($arg: $arg_type),*
7777
) -> $result {
7878
let syscall = $crate::common::constants::SyscallName::$syscall;
79-
//先转换状态再记录日志:co.syscall(Executing)会通过on_state_changed
80-
//移除MonitorListener的NOTIFY_NODE,使monitor不再发送SIGURG。
81-
//如果先调用info!()再转换状态,在QEMU等慢平台上info!()可能耗时>10ms,
82-
//导致SIGURG在协程还处于Running状态时被发送,造成抢占活锁。
83-
// Transition state BEFORE logging: co.syscall(Executing) triggers
84-
// on_state_changed which removes MonitorListener's NOTIFY_NODE,
85-
// preventing the monitor from sending SIGURG. If info!() is called
86-
// first while still in Running state, it can take >10ms on slow
87-
// platforms (QEMU), causing SIGURG to fire and preemption live-lock.
79+
$crate::info!("enter syscall {}", syscall);
8880
if let Some(co) = $crate::scheduler::SchedulableCoroutine::current() {
8981
let new_state = $crate::common::constants::SyscallState::Executing;
9082
if co.syscall((), syscall, new_state).is_err() {
@@ -93,7 +85,6 @@ macro_rules! impl_facade {
9385
);
9486
}
9587
}
96-
$crate::info!("enter syscall {}", syscall);
9788
let r = self.inner.$syscall(fn_ptr, $($arg, )*);
9889
// Save errno immediately—logging and coroutine bookkeeping
9990
// call Win32 APIs (e.g. CreateFileW) that clobber GetLastError().

0 commit comments

Comments
 (0)