On 16/11/2014 22:49, Nadav Amit wrote:
> @@ -374,13 +378,15 @@ static inline void apic_clear_irr(int vec, struct 
> kvm_lapic *apic)
>  
>       vcpu = apic->vcpu;
>  
> -     apic_clear_vector(vec, apic->regs + APIC_IRR);
> -     if (unlikely(kvm_apic_vid_enabled(vcpu->kvm)))
> +     if (unlikely(kvm_apic_vid_enabled(vcpu->kvm))) {
>               /* try to update RVI */
> +             apic_clear_vector(vec, apic->regs + APIC_IRR);
>               kvm_make_request(KVM_REQ_EVENT, vcpu);
> -     else {
> -             vec = apic_search_irr(apic);
> -             apic->irr_pending = (vec != -1);
> +     } else {
> +             apic->irr_pending = false;
> +             apic_clear_vector(vec, apic->regs + APIC_IRR);
> +             if (apic_search_irr(apic) != -1)
> +                     apic->irr_pending = true;
>       }
>  }

This is even more tricky than it looks like. :)

No one can concurrently look at apic->irr_pending while it is false, in
particular apic_sync_pv_eoi_to_guest cannot enable PV EOI by mistake
just because it sees a false irr_pending.  So it's okay if it is first
set to false and then to true.

I'll apply the patch tomorrow.

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

Reply via email to