diff mbox series

[RFC,v5,032/104] KVM: x86/mmu: introduce config for PRIVATE KVM MMU

Message ID 770235e7fed04229b81c334e2477374374cea901.1646422845.git.isaku.yamahata@intel.com (mailing list archive)
State New, archived
Headers show
Series KVM TDX basic feature support | expand

Commit Message

Isaku Yamahata March 4, 2022, 7:48 p.m. UTC
From: Isaku Yamahata <isaku.yamahata@intel.com>

To Keep the case of non TDX intact, introduce a new config option for
private KVM MMU support.  At the moment, this is synonym for
CONFIG_INTEL_TDX_HOST && CONFIG_KVM_INTEL.  The new flag make it clear
that the config is only for x86 KVM MMU.

Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
---
 arch/x86/kvm/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Huang, Kai March 31, 2022, 11:23 a.m. UTC | #1
On Fri, 2022-03-04 at 11:48 -0800, isaku.yamahata@intel.com wrote:
> From: Isaku Yamahata <isaku.yamahata@intel.com>
> 
> To Keep the case of non TDX intact, introduce a new config option for
> private KVM MMU support.  At the moment, this is synonym for
> CONFIG_INTEL_TDX_HOST && CONFIG_KVM_INTEL.  The new flag make it clear
> that the config is only for x86 KVM MMU.
> 
> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> ---
>  arch/x86/kvm/Kconfig | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
> index 2b1548da00eb..2db590845927 100644
> --- a/arch/x86/kvm/Kconfig
> +++ b/arch/x86/kvm/Kconfig
> @@ -136,4 +136,8 @@ config KVM_MMU_AUDIT
>  config KVM_EXTERNAL_WRITE_TRACKING
>  	bool
>  
> +config KVM_MMU_PRIVATE
> +	def_bool y
> +	depends on INTEL_TDX_HOST && KVM_INTEL
> +
>  endif # VIRTUALIZATION

I am really not sure why need this.  Roughly looking at MMU related patches this
new config option is hardly used.  You have many code changes related to
handling private/shared but they are not under this config option.
Isaku Yamahata April 1, 2022, 1:51 a.m. UTC | #2
On Fri, Apr 01, 2022 at 12:23:28AM +1300,
Kai Huang <kai.huang@intel.com> wrote:

> On Fri, 2022-03-04 at 11:48 -0800, isaku.yamahata@intel.com wrote:
> > From: Isaku Yamahata <isaku.yamahata@intel.com>
> > 
> > To Keep the case of non TDX intact, introduce a new config option for
> > private KVM MMU support.  At the moment, this is synonym for
> > CONFIG_INTEL_TDX_HOST && CONFIG_KVM_INTEL.  The new flag make it clear
> > that the config is only for x86 KVM MMU.
> > 
> > Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> > ---
> >  arch/x86/kvm/Kconfig | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
> > index 2b1548da00eb..2db590845927 100644
> > --- a/arch/x86/kvm/Kconfig
> > +++ b/arch/x86/kvm/Kconfig
> > @@ -136,4 +136,8 @@ config KVM_MMU_AUDIT
> >  config KVM_EXTERNAL_WRITE_TRACKING
> >  	bool
> >  
> > +config KVM_MMU_PRIVATE
> > +	def_bool y
> > +	depends on INTEL_TDX_HOST && KVM_INTEL
> > +
> >  endif # VIRTUALIZATION
> 
> I am really not sure why need this.  Roughly looking at MMU related patches this
> new config option is hardly used.  You have many code changes related to
> handling private/shared but they are not under this config option.

I don't want to use CONFIG_INTEL_TDX_HOST in KVM MMU code.  I think the change
to KVM MMU should be a sort of independent from TDX.  But it seems failed based
on your feedback.
Huang, Kai April 1, 2022, 2:13 a.m. UTC | #3
On Thu, 2022-03-31 at 18:51 -0700, Isaku Yamahata wrote:
> On Fri, Apr 01, 2022 at 12:23:28AM +1300,
> Kai Huang <kai.huang@intel.com> wrote:
> 
> > On Fri, 2022-03-04 at 11:48 -0800, isaku.yamahata@intel.com wrote:
> > > From: Isaku Yamahata <isaku.yamahata@intel.com>
> > > 
> > > To Keep the case of non TDX intact, introduce a new config option for
> > > private KVM MMU support.  At the moment, this is synonym for
> > > CONFIG_INTEL_TDX_HOST && CONFIG_KVM_INTEL.  The new flag make it clear
> > > that the config is only for x86 KVM MMU.
> > > 
> > > Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
> > > ---
> > >  arch/x86/kvm/Kconfig | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > > 
> > > diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
> > > index 2b1548da00eb..2db590845927 100644
> > > --- a/arch/x86/kvm/Kconfig
> > > +++ b/arch/x86/kvm/Kconfig
> > > @@ -136,4 +136,8 @@ config KVM_MMU_AUDIT
> > >  config KVM_EXTERNAL_WRITE_TRACKING
> > >  	bool
> > >  
> > > +config KVM_MMU_PRIVATE
> > > +	def_bool y
> > > +	depends on INTEL_TDX_HOST && KVM_INTEL
> > > +
> > >  endif # VIRTUALIZATION
> > 
> > I am really not sure why need this.  Roughly looking at MMU related patches this
> > new config option is hardly used.  You have many code changes related to
> > handling private/shared but they are not under this config option.
> 
> I don't want to use CONFIG_INTEL_TDX_HOST in KVM MMU code.  I think the change
> to KVM MMU should be a sort of independent from TDX.  But it seems failed based
> on your feedback.

Why do you need to use any config?  As I said majority of your changes to MMU
are not under any config.  But I'll leave this to maintainer/reviewers.
Paolo Bonzini April 5, 2022, 1:48 p.m. UTC | #4
On 4/1/22 04:13, Kai Huang wrote:
>> I don't want to use CONFIG_INTEL_TDX_HOST in KVM MMU code.  I think the change
>> to KVM MMU should be a sort of independent from TDX.  But it seems failed based
>> on your feedback.
> 
> Why do you need to use any config?  As I said majority of your changes to MMU
> are not under any config.  But I'll leave this to maintainer/reviewers.

There are few uses, but the effect should be pretty large, because the 
config symbol replaces variable accesses with constants:

+static inline gfn_t kvm_gfn_stolen_mask(struct kvm *kvm)
+{
+#ifdef CONFIG_KVM_MMU_PRIVATE
+	return kvm->arch.gfn_shared_mask;
+#else
+	return 0;
+#endif
+}

Please keep it.

Paolo
diff mbox series

Patch

diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 2b1548da00eb..2db590845927 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -136,4 +136,8 @@  config KVM_MMU_AUDIT
 config KVM_EXTERNAL_WRITE_TRACKING
 	bool
 
+config KVM_MMU_PRIVATE
+	def_bool y
+	depends on INTEL_TDX_HOST && KVM_INTEL
+
 endif # VIRTUALIZATION