Linux real-time development
 help / color / mirror / Atom feed
From: Karl Mehltretter <kmehltretter@gmail.com>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	 Thomas Gleixner <tglx@kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	 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 v5] softirq: Preserve interrupt context during IRQ exit
Date: Fri, 9 Oct 2026 19:04:38 +0200	[thread overview]
Message-ID: <askelKsbreC8HLpa@gmail.com> (raw)
In-Reply-To: <asTG09Me93-zP3aG@localhost.localdomain>

Hi Frederic,

Thanks for the review!

On Tue, Oct 06, 2026 at 12:00:51PM +0200, Frederic Weisbecker wrote:
> > +static inline bool softirq_handle_begin(void)
> >  {
> > -   __local_bh_disable_ip(_RET_IP_, SOFTIRQ_OFFSET);
> > +   bool from_irq_exit = in_hardirq();
> > +
> > +   if (!from_irq_exit) {
>
> Is this variable necessary?

No. I'll drop it.

> > +   /*
> > +    * 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)
>
> NMIs shouldn't ever take this path, right?

Good catch. I'll drop the in_nmi() test.

> > +   /*
> > +    * tick_irq_exit() relies on in_hardirq() being false for the
> > +    * outermost interrupt.
> > +    */
> > +   preempt_count_sub(HARDIRQ_OFFSET);
> >     tick_irq_exit();
>
> Can we also extend the HARDIRQ_OFFSET context coverage to tick_irq_exit() ?
> From a quick look I haven't found anything that would prevent from that. You just need
> to turn the "if (!in_hardirq())" test to "if hardirq_count()) == HARDIRQ_OFFSET"

Yes. I checked the rest of the tick-exit path and found no other
dependency on HARDIRQ_OFFSET being clear. I'll make that change.

Karl

      reply	other threads:[~2026-10-09 17:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 19:14 [PATCH v5] softirq: Preserve interrupt context during IRQ exit Karl Mehltretter
2026-10-01  7:39 ` Sebastian Andrzej Siewior
2026-10-03  0:50 ` Joel Fernandes
2026-10-06 10:00 ` Frederic Weisbecker
2026-10-09 17:04   ` Karl Mehltretter [this message]

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=askelKsbreC8HLpa@gmail.com \
    --to=kmehltretter@gmail.com \
    --cc=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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox