Skip to content

fix cputime, sys_rt_sigtimedwait and sys_rt_sigreturn#1394

Merged
fslongjin merged 6 commits intoDragonOS-Community:masterfrom
oeasy1412:fix-gvisortest
Nov 21, 2025
Merged

fix cputime, sys_rt_sigtimedwait and sys_rt_sigreturn#1394
fslongjin merged 6 commits intoDragonOS-Community:masterfrom
oeasy1412:fix-gvisortest

Conversation

@oeasy1412
Copy link
Member

  1. 修复: 进程 CPU 时间统UserUContext 计精度,将统计基准调整为扣除 IRQ 和 Steal 时间后的净时间(accounted_cputime),避免将硬件中断处理时间错误计入进程的 utime/stime
  2. 修复: sys_rt_sigtimedwait:
  • 修复了信号等待逻辑,确保即使 等待信号集 为空也能正确进入 do_kernel_rt_sigtimedwait,符合 Linux 行为。
  • 修复潜在的无限睡眠问题:当线程被非目标信号或非超时事件唤醒时,将正确返回 EINTR,避免进程一直挂起。
  1. 修复: sys_rt_sigreturn::
  • 当从信号处理函数返回用户态时,内核错误地使用 sysretq 来处理 sys_rt_sigreturn 的返回,%rcx 和 %r11 这两个寄存器被意外破坏。
  • 修复:如果待恢复的 %rcx / %r11 与 sysretq 的行为冲突,则强制跳转到 .L_syscall_must_use_iret 分支,使用 iretq 指令精确恢复完整的上下文。

Signed-off-by: aLinChe <1129332011@qq.com>
Signed-off-by: aLinChe <1129332011@qq.com>
@github-actions github-actions bot added the ambiguous The title of PR/issue doesn't match the format label Nov 20, 2025
Signed-off-by: aLinChe <1129332011@qq.com>
Signed-off-by: aLinChe <1129332011@qq.com>
let effective_pending = total_pending.difference(blocked);

!effective_pending.is_empty()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

貌似内核里面已经有个这样的函数了,has_pending_signal函数。

Signed-off-by: aLinChe <1129332011@qq.com>
@oeasy1412 oeasy1412 requested a review from fslongjin November 20, 2025 16:09
if pcb.has_pending_signal_fast() {
drop(preempt_guard);
restore_saved_sigmask();
return Err(SystemError::EINTR);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两行感觉顺序要交换下?这里被调度走的话会不会有其他影响?(包括下面那里也是)

Signed-off-by: aLinChe <1129332011@qq.com>
@fslongjin fslongjin merged commit 3be439e into DragonOS-Community:master Nov 21, 2025
11 checks passed
fslongjin added a commit that referenced this pull request Nov 21, 2025
fslongjin added a commit that referenced this pull request Nov 21, 2025
…" (#1400)

This reverts commit 3be439e.

由于 #1394 这个pr的测例 SigtimedwaitTest.SIGKILLUncaught 会卡死,因此撤回。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ambiguous The title of PR/issue doesn't match the format

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants