public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] KVM & genirq: Enable adaptive IRQ sharing for passed-through devices
@ 2010-12-12 11:22 Jan Kiszka
  2010-12-12 11:22 ` [PATCH v2 1/4] genirq: Introduce driver-readable IRQ status word Jan Kiszka
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Jan Kiszka @ 2010-12-12 11:22 UTC (permalink / raw)
  To: Thomas Gleixner, Avi Kivity, Marcelo Tosatti
  Cc: linux-kernel, kvm, Tom Lyon, Alex Williamson, Michael S. Tsirkin

Second try to allow adaptive interrupt handlers according to the line's
current sharing situation. This one converts the explicit notifier
interface into several extension of existing genirq APIs:

 - introduce a interrupt status word that can be read by interrupt
   handlers to obtain the current line sharing state
 - introduce IRQF_ADAPTIVE: handlers registered with this flag will be
   informed about an upcoming line sharing by calling the interrupt
   handler itself (instead of a notifier callback)
 - introduce IRQF_COND_ONESHOT: IRQF_ONESHOT semantics if the line is
   not shared, standard semantics otherwise (removes the need to
   re-register handlers to switch between IRQF_SHARED and IRQF_ONESHOT)

The result may look simpler on first glance than v1, but it comes with
more subtle race scenarios IMO. I thought them through, hopefully
catching all, but I would appreciate any skeptical review.

I also tried to replace line-level disabling from the interrupt handler
with signaling genirq to keep the line masked on handler return.
However, I finally dropped this idea as it turns out to be very hard (if
not impossible) to properly synchronize the generic tail (in genirq)
with the driver that may want to re-enable the line at the same time
(depending on the driver's internal state). But if anyone sees a
magically simple way to achieve this, I'm still all ears.

Finally, the last patch in this series makes use of the new interface
for KVM's PCI pass-through subsystem. KVM has to keep the interrupt
source disabled while calling into the guest to handle the event. This
can be done at device or line level. The former is required to share the
interrupt line, the latter is an order of magnitude faster.

Beside pass-through support of KVM, further users of this new interface
could become VFIO (not yet mainline) and uio_pci_generic which have to
resolve the same conflict.

Note: The KVM patch depends on
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/64515

Jan Kiszka (4):
  genirq: Introduce driver-readable IRQ status word
  genirq: Inform handler about line sharing state
  genirq: Add support for IRQF_COND_ONESHOT
  KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices

 Documentation/kvm/api.txt |   27 ++++
 arch/x86/kvm/x86.c        |    1 +
 include/linux/interrupt.h |   15 ++
 include/linux/irq.h       |    2 +
 include/linux/irqdesc.h   |    2 +
 include/linux/kvm.h       |    6 +
 include/linux/kvm_host.h  |   10 ++-
 kernel/irq/irqdesc.c      |    2 +
 kernel/irq/manage.c       |   74 ++++++++++-
 virt/kvm/assigned-dev.c   |  336 ++++++++++++++++++++++++++++++++++++++++-----
 10 files changed, 437 insertions(+), 38 deletions(-)


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-12-13 22:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-12 11:22 [PATCH v2 0/4] KVM & genirq: Enable adaptive IRQ sharing for passed-through devices Jan Kiszka
2010-12-12 11:22 ` [PATCH v2 1/4] genirq: Introduce driver-readable IRQ status word Jan Kiszka
2010-12-12 17:29   ` Thomas Gleixner
2010-12-12 21:51     ` Jan Kiszka
2010-12-13  8:17       ` Thomas Gleixner
2010-12-12 11:22 ` [PATCH v2 2/4] genirq: Inform handler about line sharing state Jan Kiszka
2010-12-12 16:53   ` Thomas Gleixner
2010-12-12 21:49     ` Jan Kiszka
2010-12-12 11:22 ` [PATCH v2 3/4] genirq: Add support for IRQF_COND_ONESHOT Jan Kiszka
2010-12-12 11:22 ` [PATCH v2 4/4] KVM: Allow host IRQ sharing for passed-through PCI 2.3 devices Jan Kiszka
2010-12-13 10:19   ` Avi Kivity
2010-12-13 10:10 ` [PATCH v2 0/4] KVM & genirq: Enable adaptive IRQ sharing for passed-through devices Michael S. Tsirkin
2010-12-13 22:59   ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox