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=1796381226; b=AxnQEdyRGXMpt40XVsPoeETPimbixGNDKgJrprY3lcaQEMNXwmKd9qnVt/VaGdvHBKTq nrhG/DlX+CyQ5btRqzlj2ozVZCEzaVSAaDpgc2onLaZt6GEf17bp5JzNlNLEkbo9qBqCu +z0yKMWBpTTPNOtYaUemYtaxl456qyqmC5meJbrc5GyLSsHidcbM2yyH97ZyMV3/3nMT7 tU82lkfiuaNCqx8KPXEkcSlWczyn8Eh69aLNh4t7cFXvJwSdblYeFEqy2g2v9+6e3gotg T6FeMfdOhXzq5GRJqZwafEpCriqvM7yp/6l3QMpnb8sqNVC/tdzJK+M5ezLYaXl19Xg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381226; 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=wIHX+LzC3118xpdt4mAkjbCu2kERHKSvWrgGR2au70A=; b=RXgqGSr3t6BbL2uotUruGwilzWfF3mlkhaCwXDAELIwkZ3Lz3vPtbu5Ro1tg9IS+jz77 T45SmXCwSQI2bhxtrYGBk18wYaauKcIA2NHttXO7is3cwuG8FVeilGIxgtHSJS9M4k3pY NiJACY3TeQoXBT/0tYYeci3XGjTa2M4xq3N3rW7ji/KKp0EOvQY7AlSm2C+r1VeH9cpGc XbF4WWKD9EM5hcTHAG7EARuoGdjAS48Hgy8FiT5MHySvpPe5u89NwHiDKs0RoziMmuajz 64XibU6jJcu1NxgGm9bgVEAIMY+NaOP4Je3Y3PeevA69CBkT7aFqXwPtqW28FCM5jMA== 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=t5fYXwKO; 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 165FF606A32C; Fri, 4 Dec 2026 10:47:06 +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=t5fYXwKO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82A201F000CE; Fri, 4 Dec 2026 10:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381225; bh=wIHX+LzC3118xpdt4mAkjbCu2kERHKSvWrgGR2au70A=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=t5fYXwKOpzMjHGSw9l97ICJmFsEtk0FBwCBYwbs9urqwpGvFEsciMw/z/t6XiXew5 rqO77Xg+ofX1MlPpKdqXFtmOlHKckb2ORN0WFXTH3zfuLYXVQsVHFaApwZvLpZFYaH yoI1VCBiFTzkMK808+uksd+klHZrr/xePVvtr1yM= 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 7.3 611/742] x86/apic/msi: Fix MSI interrupt affinity configuration Date: Fri, 4 Dec 2026 19:07:55 +0900 Message-ID: <20261204100651.343304471@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-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) ||