答复: [PATCH] KVM: Clear pv eoi pending bit only when it is set

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

 




> -----邮件原件-----
> 发件人: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> 发送时间: 2021年10月19日 15:29
> 收件人: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>; Li,Rongqing
> <lirongqing@xxxxxxxxx>
> 抄送: seanjc@xxxxxxxxxx; wanpengli@xxxxxxxxxxx; jmattson@xxxxxxxxxx;
> joro@xxxxxxxxxx; tglx@xxxxxxxxxxxxx; mingo@xxxxxxxxxx; bp@xxxxxxxxx;
> x86@xxxxxxxxxx; hpa@xxxxxxxxx; kvm@xxxxxxxxxxxxxxx
> 主题: Re: [PATCH] KVM: Clear pv eoi pending bit only when it is set
> 
> On 19/10/21 09:23, Vitaly Kuznetsov wrote:
> >>
> >> -static void pv_eoi_clr_pending(struct kvm_vcpu *vcpu)
> >> +static void pv_eoi_clr_pending(struct kvm_vcpu *vcpu, bool pending)
> > Nitpick (and probably a matter of personal taste):
> > pv_eoi_clr_pending() has only one user and the change doesn't make its
> > interface much nicer, I'd suggest we just inline in instead. (we can
> > probably do the same to
> > pv_eoi_get_pending()/pv_eoi_set_pending() too).
> 
> Alternatively, merge pv_eoi_get_pending and pv_eoi_clr_pending into a single
> function pv_eoi_test_and_clear_pending, which returns the value of the
> pending bit.
> 
> So the caller can do essentially:
> 
> -	pending = pv_eoi_get_pending(vcpu);
> -	pv_eoi_clr_pending(vcpu);
> -	if (pending)
> +	if (pv_eoi_test_and_clear_pending(vcpu))
>                  return;
> 
> 

It is better to implement pv_eoi_test_and_clear_pending(), and it can fix the race that Vitaly suggested

And I will write a new function kvm_test_and_clear_bit_guest_cached, to be called in pv_eoi_test_and_clear_pending

Bool kvm_test_and_clear_bit_guest_cached(struct kvm_vcpu *vcpu,  struct gfn_to_hva_cache * ghc, long nr)

-Li 

> Paolo





[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