On Wed, Aug 26, 2009 at 10:38:42AM -0300, Marcelo Tosatti wrote:
> > > > > 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.
> > >
> > > Won't work with non-tick-based emulation on the host.
> > Why? This is the most important point, can you elaborate?
>
> >From http://www.mail-archive.com/[email protected]/msg18644.html.
>
> An injectable timer interrupt is defined by:
>
> - time(now) >= time(next_expiration)
> - Previous timer interrupt has been acked (thus we can inject).
>
> The thing is, sure you can drop ack notifiers and check IRR
> on every guest entry, but why bother if you can receive an
> asynchronous notification?
>
> Would you prefer to replace
>
> + if (!ktimer->can_inject)
>
> With
> kvm_set_irq()
>
> ?
>
> Not relatively cheap.
Most of the times time(now) will be less then time(next_expiration) so
on most entries kvm_set_irq() will not be called at all. When interrupt
has to be injected I prefer to try to inject it ASAP. PIC and APIC
effectively have 2 element interrupt queue (irr/isr) so injection may
succeed even though ack was not yet received.
--
Gleb.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html