From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794946480; b=1LX5aiB8saOv1ctFpxF3ltRAWOCo/sqx5+bydh73JjXm/O1uOHnmn+uLV5OTVuG+o0C3 npT+lTAxjgIosn7OX9rUA68mWSn/48U/mOnXaNE/ILqkQLCuYmv+aRPzsWf2/gWPux4c0 ctnURXUvOsBQwsGqz/aaq8RlI3MporUPChzLiErI6EwfYOYZS8QoVGieTb4S3nK82rgsA fGgkXC/Wg7AqrDSihoQbsDpRaQ0R7wfUPuYoYFUc8IVuL9diUFCczKLDgKEIlQ5cwIvov jQRg3Pnz8DlEhmPOL1TLubE3FfRyFws1x27yCLVTpoy/E+jQ8/1toS3kKxulsd1U8fQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794946480; h=Received:DKIM-Signature:Received:Date:Message-ID:From:To:Cc:Subject: In-Reply-To:References:User-Agent:MIME-Version:Content-Type: Content-Transfer-Encoding:X-SA-Exim-Connect-IP:X-SA-Exim-Rcpt-To: X-SA-Exim-Mail-From:X-SA-Exim-Scanned; bh=y09fDB9AJCxSfxqOAq77XQqqQIjCENtD/BJ2Laq070M=; b=WJ4a1A973AwqCBsKAbYW8maccbl8tOMwybp76u+lBgHLFdRF7Cn4lS+uk+Mwq1LtiAr/ hDLyRUtEZKPW9qZcCrMbOIU3K/jZOkGaafTE9dPUATUGtBKsfxhmF6eMV0xmkNNA28yTr Szmdwpr+ui1V5MJC9XK8YW7Hsy+rN3tqNV43rpLkUXBoCB19IYg5K0WX0rjPhx7Pn67jH XqqViISDqnio12Rp7dxhIhG/YoW4hZDHyf4dprXuo/Myr7f2fXRCXbY8kF/aPJeauDv5v r39P9nxLWKgKtDZIBEEe0iesZ0HgPOdLodCg7n7e8T/buWLAcrlwG+3Y3k7rI9TqfoA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z39BiIMB; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE59C606A31C for ; Tue, 17 Nov 2026 20:14:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z39BiIMB Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9877D1F000C5; Tue, 17 Nov 2026 20:14:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794946480; bh=y09fDB9AJCxSfxqOAq77XQqqQIjCENtD/BJ2Laq070M=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=Z39BiIMBBw4m+FMKjNtlrLXjaPnOHIHwqe6x8XZv/5SJuNgg+qH9WHQWvKxTyNSyk 5dQF87ekEBF6bfU6Et/zitKQ+QMwa5396FKAGEcH5x1bSJLtjbt8uY1rve9tf+j9y6 vtE45jDdYWZZaQF8IBXTJkNb5TJxbCtJIArjUNx+RcGTDc0V8ClZoTjs8DyS74EDX+ F42xIMZNscSK+KIusX/jjA600Grn7LDWiqayi+F/EELuYe7Vfd0aqAB24feDDMP9Qa ETZb5yDDtgMfC6FmRzKFn/IUy4fjF1TBXkNnIkHSF9n/yf9lG6LpLXpDcIsABHwUq1 /ekV1uuHAFC0w== Received: from sofa.misterjones.org ([185.219.108.64] helo=lobster-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xTPZe-0000000HDOT-2A3D; Tue, 17 Nov 2026 20:14:38 +0000 Date: Tue, 17 Nov 2026 20:18:04 +0000 Message-ID: <87h5hf8b5v.wl-maz@kernel.org> From: Marc Zyngier To: Ashok Raj Cc: Vladimir Murzin , Linux ARM Kernel , Linux Kernel Mailing List , Catalin Marinas , Will Deacon , Mark Rutland , Lorenzo Pieralisi , Jinjie Ruan , Liaochang , Radu Rendec , Jonathan Cameron , Sathvika Vasireddy , Ashok Raj Subject: Re: [RFC PATCH v1 0/2] genirq: add migratable NMI registration and show NMI counts In-Reply-To: References: <20261114234946.818072-1-ashok.raj@oss.qualcomm.com> <452bf82e-52ea-47c1-9074-eeb614a33747@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: ashok.raj@oss.qualcomm.com, vladimir.murzin@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, lpieralisi@kernel.org, ruanjinjie@huawei.com, liaochang1@huawei.com, radu@rendec.net, jonathan.cameron@oss.qualcomm.com, sathvika.vasireddy@oss.qualcomm.com, ashoraj@qti.qualcomm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Tue, 17 Nov 2026 18:40:14 +0000, Ashok Raj wrote: >=20 > On Mon, Nov 16, 2026 at 10:31:31AM -0800, Ashok Raj wrote: > > Hi Vladimir > >=20 > >=20 > > > 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. > > >=20 > > > IIUC, one of the main problems with a shared NMI (as opposed to a > > > per-CPU) is handling shared state. Consider: > > >=20 > > > CPU0 CPU1 CPU2 > > >=20 > > > ---------------------------------------------------------------------= ------ > > >=20 > > > > > > handling started > > > set NMI affinity to CPU2 > > > > > > handling started > > > mutate shared state > > > mutate shared s= tate > > > handling finished > > > handling finish= ed > > >=20 > > > 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 :) > >=20 > > There is no risk of the same normal, non-per-CPU IRQ action handler > > executing concurrently on both the previous and newly selected CPUs dur= ing > > an affinity change. Genirq sets IRQD_IRQ_INPROGRESS before dropping the > > descriptor lock to invoke the driver's hard-IRQ handler. If another ins= tance > > arrives on the new target while the handler remains active on the previ= ous > > target, the new CPU observes that in-progress state and does not enter = the > > action handler. > >=20 > > The affinity update is not a synchronous =E2=80=9Cwait for the old CPU= =E2=80=9D operation: > > the interrupt controller can route a subsequent interrupt to the new CPU > > before the old handler returns. However, handler execution remains > > serialized: > >=20 > > Previous CPU New target CPU > > ------------ -------------- > > set IRQD_IRQ_INPROGRESS > > drop desc->lock > > run driver's hard-IRQ handler > >=20 > > affinity target is reprogrammed > > a subsequent IRQ arrives > > observes IRQD_IRQ_INPROGRESS > > does not run the action handler > >=20 > > handler returns > > reacquire desc->lock > > clear IRQD_IRQ_INPROGRESS > >=20 > > a later or replayed IRQ may run the > > action handler on the new CPU > >=20 > > Any required pending/replay behavior for an event arriving during this > > interval is handled by the applicable IRQ flow handler and irqchip sema= ntics; > > it does not cause simultaneous invocations of the driver's hard-IRQ han= dler. > >=20 > > Does this make sense?=20 >=20 > 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.=20 >=20 > 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.=20 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. --=20 Jazz isn't dead. It just smells funny.