Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1293329

Re: [PATCH 3/5] VFIO: Support threaded interrupt handling on VFIO

From Alex Williamson <alex.williamson@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/5] VFIO: Support threaded interrupt handling on VFIO
Date 2015-12-16 20:50 +0100
Message-ID <qGqfg-61p-15@gated-at.bofh.it> (permalink)
References <qBGXo-j5-17@gated-at.bofh.it> <qBGXp-j5-39@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 2015-12-03 at 10:22 -0800, Yunhong Jiang wrote:
> For VFIO device with MSI interrupt type, it's possible to handle the
> interrupt on hard interrupt context without invoking the interrupt
> thread. Handling the interrupt on hard interrupt context reduce the
> interrupt latency.
> 
> Signed-off-by: Yunhong Jiang <yunhong.jiang@linux.intel.com>
> ---
>  drivers/vfio/pci/vfio_pci_intrs.c | 39 ++++++++++++++++++++++++++++++++++-----
>  1 file changed, 34 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
> index 3b3ba15558b7..108d335c5656 100644
> --- a/drivers/vfio/pci/vfio_pci_intrs.c
> +++ b/drivers/vfio/pci/vfio_pci_intrs.c
> @@ -236,12 +236,35 @@ static void vfio_intx_disable(struct vfio_pci_device *vdev)
>  	kfree(vdev->ctx);
>  }
>  
> +static irqreturn_t vfio_msihandler(int irq, void *arg)
> +{
> +	struct vfio_pci_irq_ctx *ctx = arg;
> +	struct irq_bypass_producer *producer = &ctx->producer;
> +	struct irq_bypass_consumer *consumer;
> +	int ret = IRQ_HANDLED, idx;
> +
> +	idx = srcu_read_lock(&producer->srcu);
> +
> +	list_for_each_entry_rcu(consumer, &producer->consumers, sibling) {
> +		/*
> +		 * Invoke the thread handler if any consumer would block, but
> +		 * finish all consumes.
> +		 */
> +		if (consumer->handle_irq(consumer->irq_context) == -EWOULDBLOCK)
> +			ret = IRQ_WAKE_THREAD;
> +		continue;
> +	}
> +
> +	srcu_read_unlock(&producer->srcu, idx);


There should be an irq bypass manager interface to abstract this.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 3/5] VFIO: Support threaded interrupt handling on VFIO Alex Williamson <alex.williamson@redhat.com> - 2015-12-16 20:50 +0100

csiph-web