[lkml]   [2007]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC] Deferred interrupt handling.
On Wed, Jul 18, 2007 at 12:53:19PM +0300, Or Sagi wrote:
> Gentlepeople,
> We're currently working on PCI device pass-through support for KVM. In this
> model all physical hardware access to specific devices will be performed by
> the VM, and not by the host.
> In particular, this requires interrupt handling to be done by the guest --
> The host shouldn't load the corresponding device driver or otherwise access
> the device. Since the host kernel is not aware of the device semantics it
> cannot acknowledge the interrupt at the device level.
> As far as the host kernel is concerned the VM is a user level process. We
> require the ability to forward interrupt handling to such entities. The
> current kernel interrupt handling path doesn't allow deferring interrupt
> handling _and_ acknowledgement.
> We believe that this requires changing the current interrupt path in several
> fashions:
> 0. Adding an IRQ_DEFERRED mechanism to the interrupt handling path. ISRs
> returning IRQ_DEFERRED will keep the interrupt masked until future
> acknowledge.
> 1. Deferred acknowledge mechanism which would acknowledge the APIC and
> unmask
> the interrupt.
> An alternative idea was suggested at
> ---
> which is based on reversing the polarity of the received interrupt. Once
> the guest acknowledges the interrupt at the device level, the polarity is
> reversed again by the host.
> This may not be the best choice performance wise -- twice the interrupt
> count.
> Another issue we are aware of is the effect deferred handling will have on
> other devices sharing the interrupt. This seems to be a problem regardless
> of the solution.
> We wouldn't like to assume VT-d availability right now.
> Any ideas ? Thoughts ?

What if you have two PCI devices sharing an interrupt, unless the host
OS knows about all the devices that can generate that interrupt, how it
is supposed to deal with it? It can't know that it should pass in IRQ
to a guest OS, unless it can determine which device actually generated
the interrupt, which probably requires some knowledge of the devices
involved. Should the guest be able to register as a handler of that
interrupt, so that the host has to call the guest's interrupt handler
everytime an interrupt occours that the guest has registered as a
potential handler of? There might not be any other choice. Maybe a
driver that simply registers as using the interrupt and then passes the
call to the guest somehow so the guest can determine if the device
generated the interrupt and handle it, and then return back to the main
interrupt handler. Of course this would mean the guest has to be
scheduled and run during the host's interrupt handler which might just
not be an option.

Sounds tricky.

Len Sorensen
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-07-18 17:59    [W:0.126 / U:4.876 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site