lkml.org 
[lkml]   [2023]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 13/25] kvx: Add signal handling support
On Tue, Jan 03, 2023 at 05:43:47PM +0100, Yann Sionneau wrote:
> Add sigcontext definition and signal handling support for
> kvx.

[...]

> +asmlinkage void do_work_pending(struct pt_regs *regs,
> + unsigned long thread_flags)
> +{
> + /* We are called with IRQs disabled */
> + trace_hardirqs_off();
> +
> + do {
> + if (thread_flags & _TIF_NEED_RESCHED) {
> + schedule();
> + } else {
> + local_irq_enable();
> + if (thread_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))
> + do_signal(regs);
> +
> + if (thread_flags & _TIF_NOTIFY_RESUME) {
> + clear_thread_flag(TIF_NOTIFY_RESUME);
> + resume_user_mode_work(regs);
> + }
> + }
> + /* Guarantee task flag atomic read */
> + local_irq_disable();
> + thread_flags = READ_ONCE(current_thread_info()->flags);

The comment here is a bit misleading; disabling IRQs doesn't affect the
atomicity of the read (and flags can be set by remote threads), so I'd
recommend removing it.

Please use read_thread_flags() to read the flags.

> + } while (thread_flags & _TIF_WORK_MASK);
> +}

Thanks,
Mark.

\
 
 \ /
  Last update: 2023-03-26 23:27    [W:2.025 / U:1.904 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site