lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu,  1 Feb 2024 20:56:59 -0800
From: Reinette Chatre <reinette.chatre@...el.com>
To: jgg@...dia.com,
	yishaih@...dia.com,
	shameerali.kolothum.thodi@...wei.com,
	kevin.tian@...el.com,
	alex.williamson@...hat.com
Cc: kvm@...r.kernel.org,
	dave.jiang@...el.com,
	ashok.raj@...el.com,
	reinette.chatre@...el.com,
	linux-kernel@...r.kernel.org,
	patches@...ts.linux.dev
Subject: [PATCH 05/17] vfio/pci: Limit eventfd signaling to interrupt management code

VFIO PCI interrupt management has full support for configuring,
signaling, and clearing the eventfds associated with device request
notification and error interrupts.

Core VFIO PCI duplicates eventfd signaling while also accessing
data that should be contained within the interrupt management code.

Remove the duplicate eventfd signaling from core VFIO PCI
and rely on VFIO PCI interrupt management for eventfd signaling.

Signed-off-by: Reinette Chatre <reinette.chatre@...el.com>
---
 drivers/vfio/pci/vfio_pci_core.c | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index de097174e455..a8235b9c1a81 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -1868,21 +1868,20 @@ void vfio_pci_core_request(struct vfio_device *core_vdev, unsigned int count)
 	struct vfio_pci_core_device *vdev =
 		container_of(core_vdev, struct vfio_pci_core_device, vdev);
 	struct pci_dev *pdev = vdev->pdev;
+	int ret;
 
-	mutex_lock(&vdev->igate);
+	ret = vfio_pci_set_irqs_ioctl(vdev, VFIO_IRQ_SET_DATA_NONE |
+				      VFIO_IRQ_SET_ACTION_TRIGGER,
+				      VFIO_PCI_REQ_IRQ_INDEX, 0, 1, NULL);
 
-	if (vdev->req_trigger) {
-		if (!(count % 10))
-			pci_notice_ratelimited(pdev,
-				"Relaying device request to user (#%u)\n",
-				count);
-		eventfd_signal(vdev->req_trigger);
-	} else if (count == 0) {
+	if (!ret && !(count % 10)) {
+		pci_notice_ratelimited(pdev,
+				       "Relaying device request to user (#%u)\n",
+				       count);
+	} else if (ret && count == 0) {
 		pci_warn(pdev,
-			"No device request channel registered, blocked until released by user\n");
+			 "No device request channel registered, blocked until released by user\n");
 	}
-
-	mutex_unlock(&vdev->igate);
 }
 EXPORT_SYMBOL_GPL(vfio_pci_core_request);
 
@@ -2292,12 +2291,9 @@ pci_ers_result_t vfio_pci_core_aer_err_detected(struct pci_dev *pdev,
 {
 	struct vfio_pci_core_device *vdev = dev_get_drvdata(&pdev->dev);
 
-	mutex_lock(&vdev->igate);
-
-	if (vdev->err_trigger)
-		eventfd_signal(vdev->err_trigger);
-
-	mutex_unlock(&vdev->igate);
+	vfio_pci_set_irqs_ioctl(vdev, VFIO_IRQ_SET_DATA_NONE |
+				VFIO_IRQ_SET_ACTION_TRIGGER,
+				VFIO_PCI_ERR_IRQ_INDEX, 0, 1, NULL);
 
 	return PCI_ERS_RESULT_CAN_RECOVER;
 }
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ