[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2dd61d8b-223b-5a61-b739-392e79f1ce92@intel.com>
Date: Wed, 8 Jul 2020 14:58:24 +0800
From: Xiaoyao Li <xiaoyao.li@...el.com>
To: Abhishek Bhardwaj <abhishekbh@...gle.com>,
LKML <linux-kernel@...r.kernel.org>
Cc: Anthony Steinhauser <asteinhauser@...gle.com>,
Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Mark Gross <mgross@...ux.intel.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Tony Luck <tony.luck@...el.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Waiman Long <longman@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>, kvm@...r.kernel.org,
x86@...nel.org
Subject: Re: [PATCH v2] x86/speculation/l1tf: Add KConfig for setting the L1D
cache flush mode
On 7/3/2020 5:38 AM, Abhishek Bhardwaj wrote:
> This change adds a new kernel configuration that sets the l1d cache
> flush setting at compile time rather than at run time.
>
> Signed-off-by: Abhishek Bhardwaj <abhishekbh@...gle.com>
>
> ---
>
> Changes in v2:
> - Fix typo in the help of the new KConfig.
>
> arch/x86/kernel/cpu/bugs.c | 8 ++++++++
> arch/x86/kvm/Kconfig | 17 +++++++++++++++++
> 2 files changed, 25 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 0b71970d2d3d2..1dcc875cf5547 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -1406,7 +1406,15 @@ enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH;
> #if IS_ENABLED(CONFIG_KVM_INTEL)
> EXPORT_SYMBOL_GPL(l1tf_mitigation);
> #endif
> +#if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1)
> +enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_NEVER;
> +#elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2)
> +enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_COND;
> +#elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3)
> +enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_ALWAYS;
> +#else
> enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO;
> +#endif
how about
enum vmx_l1d_flush_state l1tf_vmx_mitigation =
#if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1)
VMENTER_L1D_FLUSH_NEVER;
#elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2)
VMENTER_L1D_FLUSH_COND;
#elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3)
VMENTER_L1D_FLUSH_ALWAYS;
#else
VMENTER_L1D_FLUSH_AUTO;
#endif
Powered by blists - more mailing lists