From: Thomas Gleixner <tglx@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: arnd@arndb.de, anna-maria@linutronix.de, frederic@kernel.org,
luto@kernel.org, mingo@redhat.com, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
vschneid@redhat.com, linux-kernel@vger.kernel.org,
oliver.sang@intel.com
Subject: Re: [PATCH v2 5/6] entry,hrtimer: Push reprogramming timers into the interrupt return path
Date: Tue, 03 Feb 2026 09:14:40 +0100 [thread overview]
Message-ID: <87pl6m451r.ffs@tglx> (raw)
In-Reply-To: <87v7ge4tf6.ffs@tglx>
On Tue, Feb 03 2026 at 00:28, Thomas Gleixner wrote:
> On Mon, Feb 02 2026 at 17:33, Peter Zijlstra wrote:
>> So a nested IRQ at this point will have !user_mode(), but I think it can
>> still end up in softirqs due to that hardirq_stack_inuse. Should we
>> perhaps make sure only user_mode() ends up in softirqs?
>
> All interrupts independent of the mode they hit are ending up in
> irq_exit_rcu() and therefore in __irq_exit_rcu()
>
> run_irq_on_irqstack_cond()
> if (user_mode() || hardirq_stack_inuse)
> // Stay on user or hardirq stack
> irq_enter_rcu();
> func_c();
> irq_exit_rcu()
> else
> // MAGIC ASM to switch to hardirq stack
> call irq_enter_rcu
> call func_c
> call irq_exit_rcu
>
> The only reason why invoke_softirq() won't be called is when the
> interrupt hits into the softirq processing region of the previous
> interrupt, which means it's already on the hardirq stack.
In the case I pointed out where the second interrupt hits right after
exit to user enabled interupts, there is no nesting and it will happily
take the second path which switches to the hardirq stack and then on
return processes soft interrupts.
> But looking at this there is already a problem without interrupt
> nesting:
>
> irq_enter_rcu();
> timer_interrupt()
> hrtimer_interrupt()
> delay_rearm();
> irq_exit_rcu()
> __irq_exit_rcu()
> invoke_softirq() <- Here
>
> Soft interrupts can run for quite some time, which means this already
> can cause timers being delayed for way too long. I think in
> __irq_exit_rcu() you want to do:
>
> if (!in_interrupt() && local_softirq_pending()) {
> hrtimer_rearm();
> invoke_softirq();
> }
Actually it's worse. Assume the CPU on which this happens has the
jiffies duty. As the timer does not fire, jiffies become stale. So
anything which relies on jiffies going forward will get stuck until some
other condition breaks the tie. That's going to be fun to debug :)
Thanks,
tglx
next prev parent reply other threads:[~2026-02-03 8:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 16:20 [PATCH v2 0/6] hrtimer/sched: Improve hrtick Peter Zijlstra
2026-01-21 16:20 ` [PATCH v2 1/6] sched/eevdf: Fix HRTICK duration Peter Zijlstra
2026-01-22 10:53 ` Juri Lelli
2026-02-05 8:38 ` Peter Zijlstra
2026-01-21 16:20 ` [PATCH v2 2/6] hrtimer: Optimize __hrtimer_start_range_ns() Peter Zijlstra
2026-01-22 11:00 ` Juri Lelli
2026-02-02 12:28 ` Thomas Gleixner
2026-01-21 16:20 ` [PATCH v2 3/6] hrtimer,sched: Add fuzzy hrtimer mode for HRTICK Peter Zijlstra
2026-01-22 13:12 ` Juri Lelli
2026-01-23 20:04 ` Steven Rostedt
2026-02-02 14:02 ` Thomas Gleixner
2026-01-21 16:20 ` [PATCH v2 4/6] hrtimer: Re-arrange hrtimer_interrupt() Peter Zijlstra
2026-02-02 14:05 ` Thomas Gleixner
2026-01-21 16:20 ` [PATCH v2 5/6] entry,hrtimer: Push reprogramming timers into the interrupt return path Peter Zijlstra
2026-01-23 20:08 ` Steven Rostedt
2026-01-23 21:04 ` Peter Zijlstra
2026-02-02 14:37 ` Thomas Gleixner
2026-02-02 16:33 ` Peter Zijlstra
2026-02-02 23:28 ` Thomas Gleixner
2026-02-03 8:14 ` Thomas Gleixner [this message]
2026-02-04 13:58 ` Peter Zijlstra
2026-01-21 16:20 ` [PATCH v2 6/6] sched: Default enable HRTICK Peter Zijlstra
2026-01-21 22:24 ` Phil Auld
2026-01-22 11:40 ` Peter Zijlstra
2026-01-22 12:31 ` Phil Auld
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=87pl6m451r.ffs@tglx \
--to=tglx@kernel.org \
--cc=anna-maria@linutronix.de \
--cc=arnd@arndb.de \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=frederic@kernel.org \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=oliver.sang@intel.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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