From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Karl Mehltretter <kmehltretter@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@kernel.org>,
Frederic Weisbecker <frederic@kernel.org>,
Clark Williams <clrkwllms@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Boqun Feng <boqun@kernel.org>, Lyude Paul <lyude@redhat.com>,
Joel Fernandes <joelagnelf@nvidia.com>,
Alexander Potapenko <glider@google.com>,
Marco Elver <elver@google.com>, Jonathan Corbet <corbet@lwn.net>,
Bradley Morgan <brads@mainlining.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH v4] softirq: Preserve interrupt context during IRQ exit
Date: Mon, 28 Sep 2026 10:24:02 +0200 [thread overview]
Message-ID: <20260928082402.1iCSzDzY@linutronix.de> (raw)
In-Reply-To: <20260926143505.66024-1-kmehltretter@gmail.com>
On 2026-09-26 16:35:05 [+0200], Karl Mehltretter wrote:
> On the return from interrupt path, __irq_exit_rcu() removes
> HARDIRQ_OFFSET from the preemption counter at the very top of the
…
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Link: https://lore.kernel.org/r/20260813130826.GW687043@noisy.programming.kicks-ass.net
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
> Reviewed-by: Bradley Morgan <brads@mainlining.org>
> ---
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
but…
> --- a/kernel/softirq.c
> +++ b/kernel/softirq.c
> @@ -758,10 +788,21 @@ static inline void __irq_exit_rcu(void)
> invoke_softirq();
> }
>
> + /*
> + * Wake the timer thread even if the interrupt hit a softirq or a
> + * section with BHs disabled. Only nested interrupts and NMIs are
> + * excluded.
> + */
> if (IS_ENABLED(CONFIG_IRQ_FORCED_THREADING) && force_irqthreads() &&
> - local_timers_pending_force_th() && !(in_nmi() | in_hardirq()))
> + local_timers_pending_force_th() &&
> + !in_nmi() && hardirq_count() == HARDIRQ_OFFSET)
could you please do
(in_nmi() | hardirq_count()) == HARDIRQ_OFFSET)
instead? This will merge NMI check into the hardirq check, dropping one
conditional jump away.
> wake_timersd();
>
> + /*
> + * tick_irq_exit() relies on in_hardirq() being false for the
> + * outermost interrupt.
> + */
> + preempt_count_sub(HARDIRQ_OFFSET);
> tick_irq_exit();
> }
Sebastian
next prev parent reply other threads:[~2026-09-28 8:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 14:35 [PATCH v4] softirq: Preserve interrupt context during IRQ exit Karl Mehltretter
2026-09-28 8:24 ` Sebastian Andrzej Siewior [this message]
2026-09-29 21:25 ` Karl Mehltretter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260928082402.1iCSzDzY@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=boqun@kernel.org \
--cc=brads@mainlining.org \
--cc=clrkwllms@kernel.org \
--cc=corbet@lwn.net \
--cc=elver@google.com \
--cc=frederic@kernel.org \
--cc=glider@google.com \
--cc=joelagnelf@nvidia.com \
--cc=kmehltretter@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=lyude@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.