Re: [PATCH v6] softirq: Preserve interrupt context during IRQ exit
From: Manuel Ebner
Date: Sun Oct 11 2026 - 05:16:30 EST
Hi Karl,
there's no issue with your patch but I have a question. There is
'irqentry_enter()' instead of 'irq_entry_enter()' which would fit
better into the naming scheme. I guess the root cause is in
kernel/entry/common.c .
Is there a reason for the dropped '_' ? Else I would make a patch to unify
the naming scheme.
Thanks
Manuel Ebner
On Sun, 2026-10-11 at 08:07 +0200, Karl Mehltretter wrote:
> __irq_exit_rcu() removes HARDIRQ_OFFSET from preempt_count() before
> the IRQ exit work. On the outermost IRQ exit, with no NMI or softirq
> state remaining, this makes context checks report task context. The
> softirq-dispatch, timer-wakeup and tick-exit checks account for the early
> decrement, but other code reached in this window sees the wrong context:
>
> [...]
>
> diff --git a/Documentation/core-api/entry.rst b/Documentation/core-api/entry.rst
> index 79fdaed954d9..09942135aad1 100644
> --- a/Documentation/core-api/entry.rst
> +++ b/Documentation/core-api/entry.rst
> @@ -197,8 +197,9 @@ return true, handles NOHZ tick state and interrupt time accounting. This
> means that up to the point where irq_enter_rcu() is invoked in_hardirq()
> returns false.
>
> -irq_exit_rcu() handles interrupt time accounting, undoes the preemption
> -count update and eventually handles soft interrupts and NOHZ tick state.
> +irq_exit_rcu() handles interrupt time accounting, handles soft interrupts if
> +possible, handles the NOHZ tick state and finally undoes the preemption count
> +update.
>
> In theory, the preemption count could be updated in irqentry_enter(). In
Here in entry.rst
> practice, deferring this update to irq_enter_rcu() allows the preemption-count
>
> [...]