Re: [PATCH 5/5] KVM: arm/arm64: kvm_arch_vcpu_runnable: don't miss injected irqs

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

 



On Fri, Sep 29, 2017 at 01:30:41PM +0200, Andrew Jones wrote:
> When the vPMU is in use if a VCPU's perf event overflow handler
> were to fire after the VCPU started waiting, then the wake up
> done by the kvm_vcpu_kick() call in the handler would do nothing,
> as no "pmu overflow" state is checked in kvm_arch_vcpu_runnable().
> Fix this by checking the IRQ_PENDING VCPU request in runnable().
> Checking the request also sufficiently covers all the cases that
> kvm_vgic_vcpu_pending_irq() cover, so we can just replace that.
> 
> Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
> ---
>  virt/kvm/arm/arm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c
> index 5bc9b0d2fd0f..725527f491e4 100644
> --- a/virt/kvm/arm/arm.c
> +++ b/virt/kvm/arm/arm.c
> @@ -423,7 +423,7 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
>  	return !vcpu_should_sleep(vcpu) &&
>  	       (vcpu->arch.mp_state != KVM_MP_STATE_HALTED ||
>  		(!!vcpu->arch.irq_lines ||
> -		 kvm_vgic_vcpu_pending_irq(vcpu)));
> +		 kvm_test_request(KVM_REQ_IRQ_PENDING, vcpu)));

So what if a VCPU blocks, a device raises an IRQ, the VCPU loops around,
clears the KVM_REQ_IRQ_PENDING flag, enters the VM again, which does
another WFI (for fun), and you end up here again with a pending IRQ but
no KVM_REQ_IRQ_PENDING flag anymore.  Doesn't this end up incorrectly
stalling the VCPU?

I don't think that a transient flag will work for a persistent binary
state here.


>  }
>  
>  bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu)
> -- 
> 2.13.5
> 


Thanks,
-Christoffer
_______________________________________________
kvmarm mailing list
kvmarm@xxxxxxxxxxxxxxxxxxxxx
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm



[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux