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

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

 



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

gfn_to_hva_cache has hva(user space address), but no hpa, and test_and_clear() can not be used to user space address. So kvm_test_and_clear_bit_guest_cached seems not work

-Li

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