Messages in this thread | | | From | "Wang, Wei W" <> | Subject | RE: [PATCH v3 5/5] KVM/x86/lbr: lazy save the guest lbr stack | Date | Thu, 27 Sep 2018 14:11:08 +0000 |
| |
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
| |