From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5533606A334 for ; Tue, 17 Nov 2026 20:14:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=OVLCujRz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z39BiIMB DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Subject:Cc:To:From: Message-ID:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=y09fDB9AJCxSfxqOAq77XQqqQIjCENtD/BJ2Laq070M=; b=OVLCujRzDqwR3DIF99vrSgvLjz 8caqufEL+YJxBi01sL3j04BPapva7TEkunDHG1PtVBK8TCzoT0Gl2n/ziAggRxqDDhoJfEpyaqY7a +FcMaifvKYJ0km9nBXIZp5yc5l0BZv/PXAcoC19AHmW4ncyJiPqRNkMKhjcoMXT67CcChjxQ868xC BInTBSUn0vWEiRIzvBgi+ACXoSTeeXNS60GFJGxTxnttM5I3HpLbXwOHw4/IMA4ogIRpcasRCmxkI Keb08z9bU0NSP6ffPKnaVH3B0kWzTh8dDr9dknluTp7LCY+KL8JQVXpGuX44KZv9MVxwyTCFKMb66 BnxrYDiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xTPZi-00000006zpC-3LCc; Tue, 17 Nov 2026 20:14:42 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xTPZh-00000006zp6-2Rb1 for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2026 20:14:41 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id E3FC560610; Tue, 17 Nov 2026 20:14:40 +0000 (UTC) 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-Archived-By: 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 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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.