On Fri, Dec 07, 2012 at 01:00:18AM +0000, Zhang, Yang Z wrote:
> Marcelo Tosatti wrote on 2012-12-07:
> >>> How about to recaculate irr_pending according the VIRR on each vmexit?
> >>>
> >> No need really. Since HW can only clear VIRR the only situation that may
> >> happen is that irr_pending will be true but VIRR is empty and
> >> apic_find_highest_irr() will return correct result in this case.
> >>
> >> If we will see a lot of unneeded irr scans because of stale irr_pending
> >> value we can do irr_pending = rvi != 0 on vmexit.
> >>
> >> --
> >> Gleb.
> >
> > Yes, it is harmless ATM. But its clearer if irr_pending is not used when
> > virtual interrupt delivery is in effect (that is, just skip irr_pending
> > if virtual interrupt delivery is enabled).
> irr_pending still is useful in virtual interrupt delivery case. Or else, as
> gleb said ,there may be lots of unneeded irr scan.
>
Actually, looking at it close, irr_pending will always be true (and
thus effectively disabled without any additional checks) since it is
cleared only in kvm_get_apic_interrupt() which will not be called with
vid enabled. It is racy to do irr_pending = rvi != 0 on vmexit either.
The code should be something like that:
irr_pending = (rvi != 0) ? : apic_search_irr(apic) != -1;
But we do not want to do that on each exit since rvi will be mostly
zero and irr is, more often than not, empty.
--
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