Re: [PATCH] KVM: x86: Fix lost interrupt on irr_pending race

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

 




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 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