[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <286AC319A985734F985F78AFA26841F7397FD491@shsmsx102.ccr.corp.intel.com>
Date: Thu, 27 Sep 2018 14:11:08 +0000
From: "Wang, Wei W" <wei.w.wang@...el.com>
To: "Gonglei (Arei)" <arei.gonglei@...wei.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"ak@...ux.intel.com" <ak@...ux.intel.com>
CC: "Liang, Kan" <kan.liang@...el.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"rkrcmar@...hat.com" <rkrcmar@...hat.com>,
"Xu, Like" <like.xu@...el.com>,
"jannh@...gle.com" <jannh@...gle.com>
Subject: RE: [PATCH v3 5/5] KVM/x86/lbr: lazy save the guest lbr stack
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
Powered by blists - more mailing lists