From: "Huang, Kai" <kai.huang@intel.com>
To: "binbin.wu@linux.intel.com" <binbin.wu@linux.intel.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"robert.hu@linux.intel.com" <robert.hu@linux.intel.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Christopherson,, Sean" <seanjc@google.com>,
"Gao, Chao" <chao.gao@intel.com>,
"David.Laight@ACULAB.COM" <David.Laight@ACULAB.COM>
Subject: Re: [PATCH v9 2/6] KVM: x86: Virtualize CR4.LAM_SUP
Date: Wed, 7 Jun 2023 09:20:59 +0000 [thread overview]
Message-ID: <b92e080b85c21edcea5d47caf2e8502b8be46bb1.camel@intel.com> (raw)
In-Reply-To: <4c8c0d6e-8bb4-495f-3f41-6dee8c358124@linux.intel.com>
On Wed, 2023-06-07 at 12:55 +0800, Binbin Wu wrote:
>
> On 6/7/2023 11:40 AM, Huang, Kai wrote:
> > On Tue, 2023-06-06 at 17:18 +0800, Binbin Wu wrote:
> > > Move CR4.LAM_SUP out of CR4_RESERVED_BITS and its reservation depends on vcpu
> > > supporting LAM feature or not. Leave the bit intercepted to avoid vmread every
> > > time when KVM fetches its value, with the expectation that guest won't toggle
> > > the bit frequently.
> > KVM only needs to do vmread once to cache guest's CR4, and presumable vmread is
> > a lot cheaper than a VMEXIT. So I don't see the value of intercepting it if
> > there's no need to do.
> Here is the discussion about the general rule of interception of CR4 bit.
> Sean mentioned: "As a base
> rule, KVM intercepts CR4 bits unless there's a reason not to, e.g. if
> the CR4 bit
> in question is written frequently by real guests and/or never consumed
> by KVM."
> https://lore.kernel.org/all/Y7xA53sLxCwzfvgD@google.com/
>
> And CR4.LAM_SUP value will be used to determin the LAM mode when apply
> LAM masking in instruction emulations / VMExit handlers,
> and if the bit is passed-through, it will be a vmread in these pathes.
Yeah agreed.
>
> >
> > But presumably I think we cannot allow guest to own this bit because KVM wants
> > to return a valid CR4 if LAM isn't exposed to guest? Otherwise guest can still
> > set this bit even LAM isn't exposed to guest.
> >
> > Am I missing something?
> Right, this is also a reason why the CR4.LAM_SUP bit should be intercepted.
> Will update the justification.
> I suppose this reason is enough for justification, will remove the
> performance part in changelog.
Anyway,
Reviewed-by: Kai Huang <kai.huang@intel.com>
next prev parent reply other threads:[~2023-06-07 9:21 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 9:18 [PATCH v9 0/6] Linear Address Masking (LAM) KVM Enabling Binbin Wu
2023-06-06 9:18 ` [PATCH v9 1/6] KVM: x86: Consolidate flags for __linearize() Binbin Wu
2023-06-06 9:18 ` [PATCH v9 2/6] KVM: x86: Virtualize CR4.LAM_SUP Binbin Wu
2023-06-07 3:40 ` Huang, Kai
2023-06-07 4:55 ` Binbin Wu
2023-06-07 9:20 ` Huang, Kai [this message]
2023-06-06 9:18 ` [PATCH v9 3/6] KVM: x86: Virtualize CR3.LAM_{U48,U57} Binbin Wu
2023-06-27 23:40 ` Sean Christopherson
2023-06-28 3:05 ` Binbin Wu
2023-06-28 17:40 ` Sean Christopherson
2023-07-03 7:56 ` Binbin Wu
2023-07-22 1:28 ` Sean Christopherson
2023-06-06 9:18 ` [PATCH v9 4/6] KVM: x86: Introduce untag_addr() in kvm_x86_ops Binbin Wu
2023-06-28 0:15 ` Sean Christopherson
2023-06-29 6:12 ` Binbin Wu
2023-06-29 6:57 ` Chao Gao
2023-06-29 7:22 ` Binbin Wu
2023-06-29 15:33 ` Sean Christopherson
2023-06-29 8:30 ` David Laight
2023-06-29 15:16 ` Sean Christopherson
2023-06-29 17:26 ` Binbin Wu
2023-06-06 9:18 ` [PATCH v9 5/6] KVM: x86: Untag address when LAM applicable Binbin Wu
2023-06-28 0:19 ` Sean Christopherson
2023-06-06 9:18 ` [PATCH v9 6/6] KVM: x86: Expose LAM feature to userspace VMM Binbin Wu
2023-06-07 3:52 ` Huang, Kai
2023-06-16 1:45 ` Binbin Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b92e080b85c21edcea5d47caf2e8502b8be46bb1.camel@intel.com \
--to=kai.huang@intel.com \
--cc=David.Laight@ACULAB.COM \
--cc=binbin.wu@linux.intel.com \
--cc=chao.gao@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=robert.hu@linux.intel.com \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome