[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d2b96bff30facf7f62e387a1e0f2acffe3e9b9c2.camel@intel.com>
Date: Thu, 11 May 2023 03:05:29 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "Zhao, Yan Y" <yan.y.zhao@...el.com>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Gao, Chao" <chao.gao@...el.com>,
"Christopherson,, Sean" <seanjc@...gle.com>
Subject: Re: [PATCH v2 3/6] KVM: x86/mmu: only zap EPT when guest MTRR changes
On Thu, 2023-05-11 at 10:31 +0800, Zhao, Yan Y wrote:
> On Thu, May 11, 2023 at 10:42:13AM +0800, Huang, Kai wrote:
> > > >
> > >
> > > I agree shadow_memtype_mask is the right value to check but it's indeed
> > > internal to kvm mmu.
> > > Including "mmu/spte.h" will further include "mmu/mmu_internal.h"
> > >
> > > What about introduce kvm_mmu_memtye_effective() instead as below?
> > >
> >
> > [...]
> >
> > >
> > > +bool kvm_mmu_memtye_effective(struct kvm *kvm)
> > > +{
> > > + return shadow_memtype_mask;
> > > +}
> >
> > I don't think it's a good name. shadow_memtype_mask doesn't mean any actual
> > effective memtype, but just represent those bits that KVM can manipulate to get
> > an effective memtype for the guest access.
> >
> > Instead, it should represent the hardware capability to be able to emulate
> > guest's MTRR independent from host's MTRR. So, perhaps something like:
> >
> > bool kvm_mmu_guest_mtrr_emulatable();
>
> What about kvm_mmu_cap_effective_guest_mtrr()?
> Guest MTRR is always emulated with vMTRR.
Fine to me, but again it's better if Sean can provide input.
>
> >
> > It's better if Sean can provide input here.
> >
> > (Btw, off this topic, I think it's even more reasonable to make
> > shadow_memtype_mask only be meaningful when tdp_enabled is true, because the
> > capability to override host MTRR and emulate guest MTRR should be only available
> > when secondary MMU is turned on).
> >
Powered by blists - more mailing lists