[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4a237ec0-05ae-439b-a1cb-6b7f451c0d7e@nvidia.com>
Date: Tue, 14 Oct 2025 13:55:47 -0400
From: Joel Fernandes <joelagnelf@...dia.com>
To: Peter Zijlstra <peterz@...radead.org>, 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>,
Danilo Krummrich <dakr@...nel.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, "Liam R. Howlett"
<Liam.Howlett@...cle.com>, Uladzislau Rezki <urezki@...il.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>, "Rafael J. Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Ingo Molnar <mingo@...nel.org>, Ryo Takakura <ryotkkr98@...il.com>,
K Prateek Nayak <kprateek.nayak@....com>,
"open list:CPU FREQUENCY SCALING FRAMEWORK" <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v13 01/17] preempt: Track NMI nesting to separate per-CPU
counter
On 10/14/2025 6:48 AM, Peter Zijlstra wrote:
> On Mon, Oct 13, 2025 at 11:48:03AM -0400, Lyude Paul wrote:
>
>> #define __nmi_enter() \
>> do { \
>> lockdep_off(); \
>> arch_nmi_enter(); \
>> - BUG_ON(in_nmi() == NMI_MASK); \
>> - __preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
>> + BUG_ON(__this_cpu_read(nmi_nesting) == UINT_MAX); \
>> + __this_cpu_inc(nmi_nesting); \
>
> An NMI that nests from here..
>
>> + __preempt_count_add(HARDIRQ_OFFSET); \
>> + if (__this_cpu_read(nmi_nesting) == 1) \
>
> .. until here, will see nmi_nesting > 1 and not set NMI_OFFSET.
This is true, I can cure it by setting NMI_OFFSET unconditionally when
nmi_nesting >= 1. Then the outer most NMI will then reset it. I think that will
work. Do you see any other issue with doing so?
Thanks!
- Joel
Powered by blists - more mailing lists