[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <077fbb11f0a74850fb46abe4fda31414db66539a.camel@intel.com>
Date: Thu, 11 May 2023 02:42:13 +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
> >
>
> 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();
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