RE: [PATCH v3 5/5] KVM/x86/lbr: lazy save the guest lbr stack

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

 



On Thursday, September 20, 2018 8:08 PM, Gonglei (Arei) wrote:
> > +static bool guest_access_lbr_msr(struct kvm_vcpu *vcpu,
> > +				 struct msr_data *msr_info,
> > +				 bool set)
> > +{
> > +	bool ret = false;
> > +
> > +	if (!vcpu->kvm->arch.guest_lbr_enabled)
> > +		return false;
> > +
> > +	if (set)
> > +		ret = guest_set_lbr_msr(vcpu, msr_info);
> > +	else
> > +		ret = guest_get_lbr_msr(vcpu, msr_info);
> > +
> > +	if (ret) {
> > +		vcpu->arch.lbr_used = true;
> > +		vmx_set_intercept_for_lbr_msrs(vcpu, false);
> 
> You can use if (!vcpu->arch.lbr_used) as the condition of assign values.
> They are need only once.

Thanks, I think it would be better to use

If (ret && !vcpu->arch.lbr_used)
(we need to make sure that the guest is accessing one of the LBR related MSRs via ret=true)

Best,
Wei



[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