From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752094AbdLABFv (ORCPT ); Thu, 30 Nov 2017 20:05:51 -0500 Received: from mga05.intel.com ([192.55.52.43]:11595 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751125AbdLABFu (ORCPT ); Thu, 30 Nov 2017 20:05:50 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,343,1508828400"; d="scan'208";a="182631732" From: David Su To: linux-kernel@vger.kernel.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, David Su Subject: [PATCH RT] vfio-pci: Set MSI/MSI-X ISR to non-threaded Date: Thu, 30 Nov 2017 17:05:35 -0800 Message-Id: <1512090335-6888-1-git-send-email-david.w.su@intel.com> X-Mailer: git-send-email 1.7.0.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Setting MSI/MSI-X ISR to be non-threaded will result in shorter and more deterministic IRQ delivery latencies to VFIO applications, because context switches to the ISR thread are eliminated. This is important for applications with low latency requirement running in virtual machines on RT Linux host with assigned devices through vfio-pci. A FPGA based interrupt testing device was used to compare latencies with threaded and non-threaded vfio-pci ISR. The device has a free running time stamp counter and a register recording the time an interrupt was sent to the host. With these registers the device driver and test application for the device are able to calculate and record the latency between the time an interrupt was sent and the time the ISR in the device's driver was invoked. The result is with non-threaded vfio-pci ISR the average latency is reduced by about 54% and the maximum-minimum latency range is reduced by about 65%. Non-threaded vfio-pci ISR: Minimum 4.18us, Average 4.47us, Maximum 10.26us Threaded vfio-pci ISR: Minimum 8.97us, Average 9.65us, Maximum 26.11us Signed-off-by: David Su --- drivers/vfio/pci/vfio_pci_intrs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c index 1c46045..4c54e56 100644 --- a/drivers/vfio/pci/vfio_pci_intrs.c +++ b/drivers/vfio/pci/vfio_pci_intrs.c @@ -333,7 +333,7 @@ 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, + ret = request_irq(irq, vfio_msihandler, IRQF_NO_THREAD, vdev->ctx[vector].name, trigger); if (ret) { kfree(vdev->ctx[vector].name); -- 1.7.0.4