From nobody Mon Feb 9 17:56:21 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 297AD16F858; Wed, 27 Mar 2024 12:21:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711542077; cv=none; b=hH0bufTjDS47tz6WQ4YuvRzQdCQHYqb4nvMRV3P697Vu2XnwEGzHatY+Hpvc5LxpT31RdcjMbuyQZBc1HuTs6wlHHr+PIC7W9w9N9ZEJarzWMqR5msIQu6g3AoBGlvF6gzHz6U1V19gnjWnOF99UW4qJDOJr/TUL38LhQ5scWnM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711542077; c=relaxed/simple; bh=+YQacy/d3wampGlk65/cvJjilzjQjYyjTUAJN1N3gnc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Py7uvGzFhyaOscuQFd0GgxrF+MvnBSgLmcq72icZ1CpTVpm3rtw2wo5L19ZiyuMJgmFKJ9GOEaRlxy48/K5x8iELL/kWlMO6uv/M6ZTouNK5crlSpcT04ctC8edcZbAMzVNlwR0Hji8pqBIY6acTOqFZqCDi7tNp81Plh3gtdKo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N+o3t2UM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N+o3t2UM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E60E6C43601; Wed, 27 Mar 2024 12:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711542076; bh=+YQacy/d3wampGlk65/cvJjilzjQjYyjTUAJN1N3gnc=; h=From:To:Cc:Subject:Date:From; b=N+o3t2UMflOAnjTkMUU6HQ9igFOA/m4DsqcxcghpNRMxnU5FiQ627t9rko50RZyFa HGXd4T5c7/YE8QVGWiEKyacdm+3CLAUkbNhpSEvqSui4Z1e+KruWq65GFesh+2TEtn 0Tu4u+zDWDLD4zig4rUgtOkJ53R46uz5Oe1f6xKM8Xi2xZlvda8TkDzNeO8rmwNV6p +mQXnoY1ReM80wIOs0fnasmADSuT2BX3yk5yF1Zv7G7R2UhK92bl4cBE9Wp4uiSW+O cWz+Q3fc28U3nPJ4agfw4hwbPT457xUlYSpz74xnFh1pwPuc0nnX8rf3DDYWSoaAiw RMJxF4u7P2hpw== From: Sasha Levin To: stable@vger.kernel.org, alex.williamson@redhat.com Cc: Kevin Tian , Eric Auger , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: FAILED: Patch "vfio/pci: Disable auto-enable of exclusive INTx IRQ" failed to apply to 5.4-stable tree Date: Wed, 27 Mar 2024 08:21:14 -0400 Message-ID: <20240327122115.2836676-1-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Hint: ignore X-stable: review Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Thanks, Sasha Reviewed-by: Eric Auger Reviewed-by: Kevin Tian ------------------ original commit in Linus's tree ------------------ From fe9a7082684eb059b925c535682e68c34d487d43 Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Fri, 8 Mar 2024 16:05:22 -0700 Subject: [PATCH] vfio/pci: Disable auto-enable of exclusive INTx IRQ Currently for devices requiring masking at the irqchip for INTx, ie. devices without DisINTx support, the IRQ is enabled in request_irq() and subsequently disabled as necessary to align with the masked status flag. This presents a window where the interrupt could fire between these events, resulting in the IRQ incrementing the disable depth twice. This would be unrecoverable for a user since the masked flag prevents nested enables through vfio. Instead, invert the logic using IRQF_NO_AUTOEN such that exclusive INTx is never auto-enabled, then unmask as required. Cc: Fixes: 89e1f7d4c66d ("vfio: Add PCI device driver") Reviewed-by: Kevin Tian Reviewed-by: Eric Auger Link: https://lore.kernel.org/r/20240308230557.805580-2-alex.williamson@red= hat.com Signed-off-by: Alex Williamson --- drivers/vfio/pci/vfio_pci_intrs.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_= intrs.c index 237beac838097..136101179fcbd 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c @@ -296,8 +296,15 @@ static int vfio_intx_set_signal(struct vfio_pci_core_d= evice *vdev, int fd) =20 ctx->trigger =3D trigger; =20 + /* + * Devices without DisINTx support require an exclusive interrupt, + * IRQ masking is performed at the IRQ chip. The masked status is + * protected by vdev->irqlock. Setup the IRQ without auto-enable and + * unmask as necessary below under lock. DisINTx is unmodified by + * the IRQ configuration and may therefore use auto-enable. + */ if (!vdev->pci_2_3) - irqflags =3D 0; + irqflags =3D IRQF_NO_AUTOEN; =20 ret =3D request_irq(pdev->irq, vfio_intx_handler, irqflags, ctx->name, vdev); @@ -308,13 +315,9 @@ static int vfio_intx_set_signal(struct vfio_pci_core_d= evice *vdev, int fd) return ret; } =20 - /* - * INTx disable will stick across the new irq setup, - * disable_irq won't. - */ spin_lock_irqsave(&vdev->irqlock, flags); - if (!vdev->pci_2_3 && ctx->masked) - disable_irq_nosync(pdev->irq); + if (!vdev->pci_2_3 && !ctx->masked) + enable_irq(pdev->irq); spin_unlock_irqrestore(&vdev->irqlock, flags); =20 return 0; --=20 2.43.0