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-next>] [day] [month] [year] [list]
Message-Id: <1445908801-14732-1-git-send-email-yunhong.jiang@linux.intel.com>
Date:	Mon, 26 Oct 2015 18:20:01 -0700
From:	Yunhong Jiang <yunhong.jiang@...ux.intel.com>
To:	alex.williamson@...hat.com
Cc:	kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
	Yunhong Jiang <yunhong.jiang@...ux.intel.com>
Subject: [RFC PATCH] VFIO: Add a parameter to force nonthread IRQ

An option to force VFIO PCI MSI/MSI-X handler as non-threaded IRQ,
even when CONFIG_IRQ_FORCED_THREADING=y. This is uselful when
assigning a device to a guest with low latency requirement since it
reduce the context switch to/from the IRQ thread.

An experiment was conducted on a HSW platform for 1 minutes, with the
guest vCPU bound to isolated pCPU. The assigned device triggered the
interrupt every 1ms. The average EXTERNAL_INTERRUPT exit handling time
is dropped from 5.3us to 2.2us.

Another choice is to change VFIO_DEVICE_SET_IRQS ioctl, to apply this
option only to specific devices when in kernel irq_chip is enabled. It
provides more flexibility but is more complex, not sure if we need go
through that way.

Signed-off-by: Yunhong Jiang <yunhong.jiang@...ux.intel.com>
---
 drivers/vfio/pci/vfio_pci_intrs.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
index 1f577b4..ca1f95a 100644
--- a/drivers/vfio/pci/vfio_pci_intrs.c
+++ b/drivers/vfio/pci/vfio_pci_intrs.c
@@ -22,9 +22,13 @@
 #include <linux/vfio.h>
 #include <linux/wait.h>
 #include <linux/slab.h>
+#include <linux/module.h>
 
 #include "vfio_pci_private.h"
 
+static bool nonthread_msi = 1;
+module_param(nonthread_msi, bool, 0444);
+
 /*
  * INTx
  */
@@ -313,6 +317,7 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_device *vdev,
 	char *name = msix ? "vfio-msix" : "vfio-msi";
 	struct eventfd_ctx *trigger;
 	int ret;
+	unsigned long irqflags = 0;
 
 	if (vector >= vdev->num_ctx)
 		return -EINVAL;
@@ -352,7 +357,10 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_device *vdev,
 		pci_write_msi_msg(irq, &msg);
 	}
 
-	ret = request_irq(irq, vfio_msihandler, 0,
+	if (nonthread_msi)
+		irqflags = IRQF_NO_THREAD;
+
+	ret = request_irq(irq, vfio_msihandler, irqflags,
 			  vdev->ctx[vector].name, trigger);
 	if (ret) {
 		kfree(vdev->ctx[vector].name);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ