lkml.org 
[lkml]   [2018]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v3 5/5] KVM/x86/lbr: lazy save the guest lbr stack
Date
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

\
 
 \ /
  Last update: 2018-09-27 16:11    [W:0.318 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site