Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Ashok Raj <ashok.raj@oss.qualcomm.com>
Cc: Vladimir Murzin <vladimir.murzin@arm.com>,
	Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Jinjie Ruan <ruanjinjie@huawei.com>,
	Liaochang <liaochang1@huawei.com>, Radu Rendec <radu@rendec.net>,
	Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>,
	Sathvika Vasireddy <sathvika.vasireddy@oss.qualcomm.com>,
	Ashok Raj <ashoraj@qti.qualcomm.com>
Subject: Re: [RFC PATCH v1 0/2] genirq: add migratable NMI registration and show NMI counts
Date: Tue, 17 Nov 2026 20:18:04 +0000	[thread overview]
Message-ID: <87h5hf8b5v.wl-maz@kernel.org> (raw)
In-Reply-To: <avyfjl6ZLbpilWkK@hu-ashoraj-lv.qualcomm.com>

On Tue, 17 Nov 2026 18:40:14 +0000,
Ashok Raj <ashok.raj@oss.qualcomm.com> wrote:
> 
> On Mon, Nov 16, 2026 at 10:31:31AM -0800, Ashok Raj wrote:
> > Hi Vladimir
> > 
> > 
> > > IIUC, one of the main problems with a shared NMI (as opposed to a
> > > per-CPU) is handling shared state. [...] the same NMI handler could
> > > execute concurrently on two CPUs.
> > > 
> > > IIUC, one of the main problems with a shared NMI (as opposed to a
> > > per-CPU) is handling shared state. Consider:
> > > 
> > > CPU0                       CPU1                       CPU2
> > > 
> > > ---------------------------------------------------------------------------
> > > 
> > > <NMI>
> > > handling started
> > >                            set NMI affinity to CPU2
> > >                                                       <NMI>
> > >                                                       handling started
> > > mutate shared state
> > >                                                       mutate shared state
> > > handling finished
> > >                                                       handling finished
> > > 
> > > IOW, the same NMI handler could execute concurrently on two CPUs,
> > > potentially corrupting shared state. Once again more than happy to
> > > be corrected if I missed something :)
> > 
> > There is no risk of the same normal, non-per-CPU IRQ action handler
> > executing concurrently on both the previous and newly selected CPUs during
> > an affinity change. Genirq sets IRQD_IRQ_INPROGRESS before dropping the
> > descriptor lock to invoke the driver's hard-IRQ handler. If another instance
> > arrives on the new target while the handler remains active on the previous
> > target, the new CPU observes that in-progress state and does not enter the
> > action handler.
> > 
> > The affinity update is not a synchronous “wait for the old CPU” operation:
> > the interrupt controller can route a subsequent interrupt to the new CPU
> > before the old handler returns. However, handler execution remains
> > serialized:
> > 
> > Previous CPU                         New target CPU
> > ------------                         --------------
> > set IRQD_IRQ_INPROGRESS
> > drop desc->lock
> > run driver's hard-IRQ handler
> > 
> >                                      affinity target is reprogrammed
> >                                      a subsequent IRQ arrives
> >                                      observes IRQD_IRQ_INPROGRESS
> >                                      does not run the action handler
> > 
> > handler returns
> > reacquire desc->lock
> > clear IRQD_IRQ_INPROGRESS
> > 
> >                                      a later or replayed IRQ may run the
> >                                      action handler on the new CPU
> > 
> > Any required pending/replay behavior for an event arriving during this
> > interval is handled by the applicable IRQ flow handler and irqchip semantics;
> > it does not cause simultaneous invocations of the driver's hard-IRQ handler.
> > 
> > Does this make sense? 
> 
> I think what i quoted is true for regular interrupts, but NMI's there is no
> IRQD_IRQ_INPROGRESS serialization. So that overlap as  you quote might
> be possible. 
> 
> I'll need more time to stare at the code  and rebase my RFC and post a
> coherent series that uses it to get the full picture. 

When you do that, please don't mix functionalities and tests as you
did in the first patch. Slap the tests at the end of the series
instead, as separate patches.

	M.

-- 
Jazz isn't dead. It just smells funny.


      reply	other threads:[~2026-11-17 20:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 23:49 [RFC PATCH v1 0/2] genirq: add migratable NMI registration and show NMI counts Ashok Raj
2026-11-14 23:49 ` [RFC PATCH v1 1/2] genirq: Add migratable NMI registration mode Ashok Raj
2026-11-14 23:49 ` [RFC PATCH v1 2/2] genirq/proc: Show NMI interrupt counts in /proc/interrupts Ashok Raj
2026-11-16 10:38 ` [RFC PATCH v1 0/2] genirq: add migratable NMI registration and show NMI counts Vladimir Murzin
2026-11-16 18:31   ` Ashok Raj
2026-11-17 18:40     ` Ashok Raj
2026-11-17 20:18       ` Marc Zyngier [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=87h5hf8b5v.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=ashok.raj@oss.qualcomm.com \
    --cc=ashoraj@qti.qualcomm.com \
    --cc=catalin.marinas@arm.com \
    --cc=jonathan.cameron@oss.qualcomm.com \
    --cc=liaochang1@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=radu@rendec.net \
    --cc=ruanjinjie@huawei.com \
    --cc=sathvika.vasireddy@oss.qualcomm.com \
    --cc=vladimir.murzin@arm.com \
    --cc=will@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