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=1796389442; b=1pzl5ylNJkUCsfzwaRRhZPZbzK4SguhRQpbgZIxjtoe+Mxi5TXhJ5oOkGbjaj/9/zdMD AzojMczFMYjkAbBs1ZD/fnJcP9BAoIA8h9367NHQQbEvwVDVu045x5/jl+ivYHVvgsmy5 qAuLinAsNSJr3awFjRklXKtGZpNWpLWDeT+dH0SzTxOZhlJGn8PvxokxvB+tvM2JMwgyh nd5jCr50ZgsggGNkquvWkq6+LorBdlaDnkLzsdkS0BCikvPvh+h+l6jrh3LyNryGEyrzn ZCsA6pY69iXKyY8ud+6cKNTm7DmSZa6kdk3VqjkSaMgHJzW0+aXRv7u+nwbUpe71HIw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389442; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=fNDE196VWZQiIV7Hr3iv+LKRroKCn1NWrG8UQxHzkVc=; b=UMgb99u67Emzsfn08FhVXH8OCiFjGsdk1tG7pYwDDtZgyvFnbb1Vx57FZ8skR0E3ObyH dvAWFpeK/Hc9J+y44IasxWpx2zURo/BHRwT8tnp1rg4qzF2tIRtC1Y6Q2n80qnAPpFrFL /t7oMREUpRQvMBUi0KLIPYJqAl8rGkJXHU1tNtDAxELywPzUXfqyRy+yxFls/HCN2y2yu Bg6/txOyPblG1LNqw4aQgmjNYLEu9P22b1MHHD7ciMF+Ox+Lo/0jBGrVdASKAFVgwCLmC lt4h+r80uKTTUDr/jyuMogFYOLIhLpN100gbSeFVIslTyNnRQiNqDlz2QSP5n1h4JHg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=SoSsqiSu; 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 7D959606A322; Fri, 4 Dec 2026 13:04:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=SoSsqiSu Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DD751F00931; Fri, 4 Dec 2026 13:04:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796389441; bh=fNDE196VWZQiIV7Hr3iv+LKRroKCn1NWrG8UQxHzkVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SoSsqiSuf2J1+dwEX2h/Kts/QeXplOqWBbw0gw/7jjqDU+amDgMlnLYyVeavkZx4H QjOF/ubB3GpW+wCZhjzFbjxm4NGEOGr4XD65yxSG3kaIK/0rRQeGYdUHVB7aurfVV3 dii+So0ylJn/Vn6l4CpOM4lRa4ytUEpPmypwy314= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Weitao Wang , "Borislav Petkov (AMD)" , Koichiro Den , Thomas Gleixner Subject: [PATCH 6.1 0993/1059] x86/apic/msi: Fix MSI interrupt affinity configuration Date: Fri, 4 Dec 2026 19:08:44 +0900 Message-ID: <20261204100709.717146659@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: WeitaoWang-oc commit 068d82afd070beb8ea32c8ee64d685af7d3f36e2 upstream. The two step update sequence in msi_set_affinity() is required for MSI interrupts which cannot be migrated atomically, i.e. devices which do not provide MSI masking. The MSI message update writes address and data registers separately, so such a device can raise an interrupt in between, which results in a message built from half updated state: a stray interrupt on a stale vector and a possibly lost device interrupt. The update sequence is selected by a per interrupt quirk flag, which is set for interrupts which cannot use reservation mode. Reservation mode is only enabled for maskable interrupts, i.e. devices which provide MSI-X or mask support, so the quirk flag is the inverse of the reservation mode bit. The removal of the quirk flag replaced the flag check with a reservation mode check, but dropped the negation of the removed condition: - if (!irqd_msi_nomask_quirk(irqd) || ...) + if (!irqd_can_reserve(irqd) || ...) As the quirk flag is the inverse of the reservation mode bit, the replacement inverted the condition and selects the wrong update path for every interrupt: non-maskable interrupts take the direct update path again, which reopens the race, while maskable interrupts needlessly go through the two step update. Restore the original condition so that the direct update path is selected when reservation mode is enabled, which also matches the comment above the check: direct update is possible when the MSI is maskable, which is the case when the reservation mode bit is set. [ bp: Massage commit message. ] Fixes: b56ebe7c896d ("x86/apic/msi: Fix misconfigured non-maskable MSI quirk") Signed-off-by: Weitao Wang Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Koichiro Den Acked-by: Thomas Gleixner Cc: stable@vger.kernel.org # v6.1+ Link: https://patch.msgid.link/20261016181016.3850-1-WeitaoWang-oc@zhaoxin.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/apic/msi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kernel/apic/msi.c +++ b/arch/x86/kernel/apic/msi.c @@ -62,7 +62,7 @@ msi_set_affinity(struct irq_data *irqd, * - The interrupt is not yet started up * - The new destination CPU is the same as the old destination CPU */ - if (!irqd_can_reserve(irqd) || + if (irqd_can_reserve(irqd) || cfg->vector == old_cfg.vector || old_cfg.vector == MANAGED_IRQ_SHUTDOWN_VECTOR || !irqd_is_started(irqd) ||