[PATCH v4 22/30] context_tracking: Exit CT_STATE_IDLE upon irq/nmi entry
Valentin Schneider
vschneid at redhat.com
Mon Feb 10 09:36:20 PST 2025
On 07/02/25 19:37, Frederic Weisbecker wrote:
> Le Fri, Feb 07, 2025 at 06:06:45PM +0100, Valentin Schneider a écrit :
>>
>> Soooo I've been thinking...
>>
>> Isn't
>>
>> (context_tracking.state & CT_RCU_WATCHING)
>>
>> pretty much a proxy for knowing whether a CPU is executing in kernelspace,
>> including NMIs?
>
> You got it!
>
Yay!
>>
>> NMI interrupts userspace/VM/idle -> ct_nmi_enter() -> it becomes true
>> IRQ interrupts idle -> ct_irq_enter() -> it becomes true
>> IRQ interrupts userspace -> __ct_user_exit() -> it becomes true
>> IRQ interrupts VM -> __ct_user_exit() -> it becomes true
>>
>> IOW, if I gate setting deferred work by checking for this instead of
>> explicitely CT_STATE_KERNEL, "it should work" and prevent the
>> aforementioned issue? Or should I be out drinking instead? :-)
>
> Exactly it should work! Now that doesn't mean you can't go out
> for a drink :-)
>
Well, drinks were had very shortly after sending this email :D
> Thanks.
More information about the linux-riscv
mailing list