Re: [PATCH][RFC] Use return value from kvm_set_irq() to re-inject PIT interrupts.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 24, 2009 at 02:44:27PM -0300, Marcelo Tosatti wrote:
> On Mon, Aug 24, 2009 at 08:16:46PM +0300, Gleb Natapov wrote:
> > On Mon, Aug 24, 2009 at 01:32:56PM -0300, Marcelo Tosatti wrote:
> > > On Mon, Aug 24, 2009 at 03:06:23PM +0300, Gleb Natapov wrote:
> > > > Use return value from kvm_set_irq() to track coalesced PIT interrupts
> > > > instead of ack/mask notifiers.
> > > 
> > > Gleb,
> > > 
> > > What is the advantage of doing so?
> > > 
> > Current code very fragile and relies on hacks to work. Lets take calling
> > of ack notifiers on pic reset as an example. Why is it needed? 
> 
> To signal the ack notifiers users that, in case of reset with pending
> IRR, the given interrupt has been "acked" (its an artificial ack event).
> 
But IRR was not acked. The reason it is done is that otherwise the
current logic will prevent further interrupt injection. 

> Is there a need to differentiate between actual interrupt ack and reset
> with pending IRR? At the time this code was written, there was no
> indication that differentation would be necessary.
This is two different things. Ack notifiers should be called when guest
acks interrupt. Calling it on reset is wrong (see below). We can add reset
notifiers, but we just build yet another infrastructure to support
current reinjection scheme.

> 
> > It is obviously wrong thing to do from assigned devices POV.
> 
> Thats not entirely clear to me. So what happens if a guest with PIC
> assigned device resets with a pending IRR? The host interrupt line will
> be kept disabled, even though the guest is able to process further
> interrupts?
The host interrupt line will be enabled (assigned device ack notifier
does this) without clearing interrupt condition in assigned device
(guest hasn't acked irq so how can we be sure it ran device's irq
handler?). Host will hang.

> > Why ioapic calls mask notifiers but pic doesn't?
> 
> Because it is not implemented.
I see that. Why? Why it was important to implement for ioapic but not
for pic? Do we know what doesn't work now?

> 
> > Besides diffstat for the patch shows:
> > 2 files changed, 16 insertions(+), 59 deletions(-)
> > 
> > 43 lines less for the same functionality. Looks like clear win to me.
> > 
> > > Ack notifiers are asynchronous notifications. Using the return value
> > > from kvm_set_irq implies that timer emulation is based on a "tick
> > > generating device" on the host side.
> > No notification is needed in the first place. You know immediately
> > if injection fails or not. I don't see why "using return value from
> > kvm_set_irq implies that timer emulation is based on a "tick generating
> > device" on the host side"? What can you do with ack notifiers that can't
> > be done without?
> 
> If you don't have a host timer emulating the guest PIT, to periodically
> bang on kvm_set_irq, how do you know when to attempt reinjection?
> 
> You keep calling kvm_set_irq on every guest entry to figure out when 
> reinjection is possible?
If we have timer to inject then yes. It is relatively cheap. Most of the
time pending count will be zero.

--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux