[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250617101120.7c946656@gandalf.local.home>
Date: Tue, 17 Jun 2025 10:11:20 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Lyude Paul <lyude@...hat.com>
Cc: rust-for-linux@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Boqun Feng <boqun.feng@...il.com>, linux-kernel@...r.kernel.org, Daniel
Almeida <daniel.almeida@...labora.com>, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>, Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>, Dietmar Eggemann
<dietmar.eggemann@....com>, Ben Segall <bsegall@...gle.com>, Mel Gorman
<mgorman@...e.de>, Valentin Schneider <vschneid@...hat.com>, Will Deacon
<will@...nel.org>, Waiman Long <longman@...hat.com>, Miguel Ojeda
<ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Gary Guo
<gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>, Andreas
Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>, Trevor
Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>, David
Woodhouse <dwmw@...zon.co.uk>, Jens Axboe <axboe@...nel.dk>, Sebastian
Andrzej Siewior <bigeasy@...utronix.de>, NeilBrown <neilb@...e.de>, Caleb
Sander Mateos <csander@...estorage.com>, Ryo Takakura
<ryotkkr98@...il.com>, K Prateek Nayak <kprateek.nayak@....com>
Subject: Re: [RFC RESEND v10 03/14] irq & spin_lock: Add counted interrupt
disabling/enabling
On Tue, 27 May 2025 18:21:44 -0400
Lyude Paul <lyude@...hat.com> wrote:
> +static inline void local_interrupt_enable(void)
> +{
> + int new_count;
> +
> + new_count = hardirq_disable_exit();
> +
> + if ((new_count & HARDIRQ_DISABLE_MASK) == 0) {
> + unsigned long flags;
> +
> + flags = raw_cpu_read(local_interrupt_disable_state.flags);
> + local_irq_restore(flags);
> + /*
> + * TODO: re-read preempt count can be avoided, but it needs
> + * should_resched() taking another parameter as the current
> + * preempt count
> + */
> +#ifdef PREEMPTION
> + if (should_resched(0))
> + __preempt_schedule();
> +#endif
> + }
> +}
I'm confused to why the should_resched() is needed? We are handling
interrupts right? The hardirq_disable_exit() will set preempt_count to zero
before we enable interrupts. When the local_irq_restore() enables interrupts
again, if there's an interrupt pending it will trigger then. If the
interrupt sets NEED_RESCHED, when it returns from the interrupt handler, it
will see preempt_count as zero, right?
If it does, then it will call schedule before it gets back to this code.
-- Steve
Powered by blists - more mailing lists