All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode
@ 2020-07-02 16:19 Abhishek Bhardwaj
  2020-07-02 21:33   ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Abhishek Bhardwaj @ 2020-07-02 16:19 UTC (permalink / raw)
  To: LKML
  Cc: Abhishek Bhardwaj, Anthony Steinhauser, Borislav Petkov,
	H. Peter Anvin, Ingo Molnar, Jim Mattson, Joerg Roedel,
	Josh Poimboeuf, Mark Gross, Paolo Bonzini, Pawan Gupta,
	Peter Zijlstra, Sean Christopherson, Thomas Gleixner, Tony Luck,
	Vitaly Kuznetsov, Waiman Long, Wanpeng Li, kvm, x86

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@google.com>
---

 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
 EXPORT_SYMBOL_GPL(l1tf_vmx_mitigation);
 
 /*
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index b277a2db62676..f82a0c564e931 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -107,4 +107,21 @@ config KVM_MMU_AUDIT
 	 This option adds a R/W kVM module parameter 'mmu_audit', which allows
 	 auditing of KVM MMU events at runtime.
 
+config KVM_VMENTRY_L1D_FLUSH
+	int "L1D cache flush settings (1-3)"
+	range 1 3
+	default "2"
+	depends on KVM && X86 && X86_64
+	help
+	 This setting determines the L1D cache flush behavior before a VMENTER.
+	 This is similar to setting the option / parameter to
+	 kvm-intel.vmentry_l1d_flush.
+	 1 - Never flush.
+	 2 - Conditinally flush.
+	 3 - Always flush.
+
+# OK, it's a little counter-intuitive to do this, but it puts it neatly under
+# the virtualization menu.
+source "drivers/vhost/Kconfig"
+
 endif # VIRTUALIZATION
-- 
2.27.0.212.ge8ba1cc988-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode
  2020-07-02 16:19 [PATCH] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode Abhishek Bhardwaj
@ 2020-07-02 21:33   ` kernel test robot
  2020-07-03  6:25   ` kernel test robot
  2020-07-06 15:01 ` mark gross
  2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-07-02 21:33 UTC (permalink / raw)
  To: Abhishek Bhardwaj, LKML
  Cc: kbuild-all, clang-built-linux, Abhishek Bhardwaj,
	Anthony Steinhauser, Borislav Petkov, H. Peter Anvin,
	Ingo Molnar, Jim Mattson, Joerg Roedel, Josh Poimboeuf,
	Mark Gross

[-- Attachment #1: Type: text/plain, Size: 2916 bytes --]

Hi Abhishek,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/auto-latest]
[also build test WARNING on linux/master tip/x86/core kvm/linux-next linus/master v5.8-rc3 next-20200702]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Abhishek-Bhardwaj/x86-speculation-l1tf-Add-KConfig-for-setting-the-L1D-cache-flush-mode/20200703-002135
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 7e44a91e0445a854af5d34ca0f5baceccd518e73
config: x86_64-defconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 003a086ffc0d1affbb8300b36225fb8150a2d40a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/cpu/bugs.c:1402:6: warning: 'CONFIG_KVM_VMENTRY_L1D_FLUSH' is not defined, evaluates to 0 [-Wundef]
   #if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1)
        ^
   arch/x86/kernel/cpu/bugs.c:1404:8: warning: 'CONFIG_KVM_VMENTRY_L1D_FLUSH' is not defined, evaluates to 0 [-Wundef]
   #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2)
          ^
   arch/x86/kernel/cpu/bugs.c:1406:8: warning: 'CONFIG_KVM_VMENTRY_L1D_FLUSH' is not defined, evaluates to 0 [-Wundef]
   #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3)
          ^
   3 warnings generated.

vim +/CONFIG_KVM_VMENTRY_L1D_FLUSH +1402 arch/x86/kernel/cpu/bugs.c

  1396	
  1397	/* Default mitigation for L1TF-affected CPUs */
  1398	enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH;
  1399	#if IS_ENABLED(CONFIG_KVM_INTEL)
  1400	EXPORT_SYMBOL_GPL(l1tf_mitigation);
  1401	#endif
> 1402	#if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1)
  1403	enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_NEVER;
  1404	#elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2)
  1405	enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_COND;
  1406	#elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3)
  1407	enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_ALWAYS;
  1408	#else
  1409	enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO;
  1410	#endif
  1411	EXPORT_SYMBOL_GPL(l1tf_vmx_mitigation);
  1412	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29462 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode
@ 2020-07-02 21:33   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-07-02 21:33 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2979 bytes --]

Hi Abhishek,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/auto-latest]
[also build test WARNING on linux/master tip/x86/core kvm/linux-next linus/master v5.8-rc3 next-20200702]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Abhishek-Bhardwaj/x86-speculation-l1tf-Add-KConfig-for-setting-the-L1D-cache-flush-mode/20200703-002135
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 7e44a91e0445a854af5d34ca0f5baceccd518e73
config: x86_64-defconfig (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 003a086ffc0d1affbb8300b36225fb8150a2d40a)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/cpu/bugs.c:1402:6: warning: 'CONFIG_KVM_VMENTRY_L1D_FLUSH' is not defined, evaluates to 0 [-Wundef]
   #if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1)
        ^
   arch/x86/kernel/cpu/bugs.c:1404:8: warning: 'CONFIG_KVM_VMENTRY_L1D_FLUSH' is not defined, evaluates to 0 [-Wundef]
   #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2)
          ^
   arch/x86/kernel/cpu/bugs.c:1406:8: warning: 'CONFIG_KVM_VMENTRY_L1D_FLUSH' is not defined, evaluates to 0 [-Wundef]
   #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3)
          ^
   3 warnings generated.

vim +/CONFIG_KVM_VMENTRY_L1D_FLUSH +1402 arch/x86/kernel/cpu/bugs.c

  1396	
  1397	/* Default mitigation for L1TF-affected CPUs */
  1398	enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH;
  1399	#if IS_ENABLED(CONFIG_KVM_INTEL)
  1400	EXPORT_SYMBOL_GPL(l1tf_mitigation);
  1401	#endif
> 1402	#if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1)
  1403	enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_NEVER;
  1404	#elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2)
  1405	enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_COND;
  1406	#elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3)
  1407	enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_ALWAYS;
  1408	#else
  1409	enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO;
  1410	#endif
  1411	EXPORT_SYMBOL_GPL(l1tf_vmx_mitigation);
  1412	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29462 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode
  2020-07-02 16:19 [PATCH] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode Abhishek Bhardwaj
@ 2020-07-03  6:25   ` kernel test robot
  2020-07-03  6:25   ` kernel test robot
  2020-07-06 15:01 ` mark gross
  2 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-07-03  6:25 UTC (permalink / raw)
  To: Abhishek Bhardwaj, LKML
  Cc: kbuild-all, Abhishek Bhardwaj, Anthony Steinhauser,
	Borislav Petkov, H. Peter Anvin, Ingo Molnar, Jim Mattson,
	Joerg Roedel, Josh Poimboeuf, Mark Gross

[-- Attachment #1: Type: text/plain, Size: 3468 bytes --]

Hi Abhishek,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/auto-latest]
[also build test WARNING on linux/master tip/x86/core kvm/linux-next linus/master v5.8-rc3 next-20200702]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Abhishek-Bhardwaj/x86-speculation-l1tf-Add-KConfig-for-setting-the-L1D-cache-flush-mode/20200703-002135
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 7e44a91e0445a854af5d34ca0f5baceccd518e73
config: i386-randconfig-s002-20200702 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-3-gfa153962-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> arch/x86/kernel/cpu/bugs.c:1402:6: sparse: sparse: undefined preprocessor identifier 'CONFIG_KVM_VMENTRY_L1D_FLUSH'
   arch/x86/kernel/cpu/bugs.c:1404:8: sparse: sparse: undefined preprocessor identifier 'CONFIG_KVM_VMENTRY_L1D_FLUSH'
   arch/x86/kernel/cpu/bugs.c:1406:8: sparse: sparse: undefined preprocessor identifier 'CONFIG_KVM_VMENTRY_L1D_FLUSH'

# https://github.com/0day-ci/linux/commit/893761b6e087104d84679082e5dfb90d41fd2878
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 893761b6e087104d84679082e5dfb90d41fd2878
vim +/CONFIG_KVM_VMENTRY_L1D_FLUSH +1402 arch/x86/kernel/cpu/bugs.c

72c6d2db64fa18c Thomas Gleixner   2018-07-13  1396  
d90a7a0ec83fb86 Jiri Kosina       2018-07-13  1397  /* Default mitigation for L1TF-affected CPUs */
d90a7a0ec83fb86 Jiri Kosina       2018-07-13  1398  enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH;
72c6d2db64fa18c Thomas Gleixner   2018-07-13  1399  #if IS_ENABLED(CONFIG_KVM_INTEL)
d90a7a0ec83fb86 Jiri Kosina       2018-07-13  1400  EXPORT_SYMBOL_GPL(l1tf_mitigation);
1eb46908b35dfba Guenter Roeck     2018-08-15  1401  #endif
893761b6e087104 Abhishek Bhardwaj 2020-07-02 @1402  #if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1)
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1403  enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_NEVER;
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1404  #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2)
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1405  enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_COND;
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1406  #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3)
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1407  enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_ALWAYS;
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1408  #else
895ae47f9918833 Thomas Gleixner   2018-07-13  1409  enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO;
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1410  #endif
72c6d2db64fa18c Thomas Gleixner   2018-07-13  1411  EXPORT_SYMBOL_GPL(l1tf_vmx_mitigation);
72c6d2db64fa18c Thomas Gleixner   2018-07-13  1412  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34699 bytes --]

[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode
@ 2020-07-03  6:25   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-07-03  6:25 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3685 bytes --]

Hi Abhishek,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/auto-latest]
[also build test WARNING on linux/master tip/x86/core kvm/linux-next linus/master v5.8-rc3 next-20200702]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Abhishek-Bhardwaj/x86-speculation-l1tf-Add-KConfig-for-setting-the-L1D-cache-flush-mode/20200703-002135
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 7e44a91e0445a854af5d34ca0f5baceccd518e73
config: i386-randconfig-s002-20200702 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-3-gfa153962-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> arch/x86/kernel/cpu/bugs.c:1402:6: sparse: sparse: undefined preprocessor identifier 'CONFIG_KVM_VMENTRY_L1D_FLUSH'
   arch/x86/kernel/cpu/bugs.c:1404:8: sparse: sparse: undefined preprocessor identifier 'CONFIG_KVM_VMENTRY_L1D_FLUSH'
   arch/x86/kernel/cpu/bugs.c:1406:8: sparse: sparse: undefined preprocessor identifier 'CONFIG_KVM_VMENTRY_L1D_FLUSH'

# https://github.com/0day-ci/linux/commit/893761b6e087104d84679082e5dfb90d41fd2878
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 893761b6e087104d84679082e5dfb90d41fd2878
vim +/CONFIG_KVM_VMENTRY_L1D_FLUSH +1402 arch/x86/kernel/cpu/bugs.c

72c6d2db64fa18c Thomas Gleixner   2018-07-13  1396  
d90a7a0ec83fb86 Jiri Kosina       2018-07-13  1397  /* Default mitigation for L1TF-affected CPUs */
d90a7a0ec83fb86 Jiri Kosina       2018-07-13  1398  enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH;
72c6d2db64fa18c Thomas Gleixner   2018-07-13  1399  #if IS_ENABLED(CONFIG_KVM_INTEL)
d90a7a0ec83fb86 Jiri Kosina       2018-07-13  1400  EXPORT_SYMBOL_GPL(l1tf_mitigation);
1eb46908b35dfba Guenter Roeck     2018-08-15  1401  #endif
893761b6e087104 Abhishek Bhardwaj 2020-07-02 @1402  #if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1)
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1403  enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_NEVER;
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1404  #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2)
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1405  enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_COND;
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1406  #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3)
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1407  enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_ALWAYS;
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1408  #else
895ae47f9918833 Thomas Gleixner   2018-07-13  1409  enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO;
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1410  #endif
72c6d2db64fa18c Thomas Gleixner   2018-07-13  1411  EXPORT_SYMBOL_GPL(l1tf_vmx_mitigation);
72c6d2db64fa18c Thomas Gleixner   2018-07-13  1412  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34699 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode
  2020-07-02 16:19 [PATCH] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode Abhishek Bhardwaj
  2020-07-02 21:33   ` kernel test robot
  2020-07-03  6:25   ` kernel test robot
@ 2020-07-06 15:01 ` mark gross
  2 siblings, 0 replies; 7+ messages in thread
From: mark gross @ 2020-07-06 15:01 UTC (permalink / raw)
  To: Abhishek Bhardwaj
  Cc: LKML, Anthony Steinhauser, Borislav Petkov, H. Peter Anvin,
	Ingo Molnar, Jim Mattson, Joerg Roedel, Josh Poimboeuf,
	Paolo Bonzini, Pawan Gupta, Peter Zijlstra, Sean Christopherson,
	Thomas Gleixner, Tony Luck, Vitaly Kuznetsov, Waiman Long,
	Wanpeng Li, kvm, x86

On Thu, Jul 02, 2020 at 09:19:16AM -0700, 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.

Why is this desired?

--mark

> 
> Signed-off-by: Abhishek Bhardwaj <abhishekbh@google.com>
> ---
> 
>  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
>  EXPORT_SYMBOL_GPL(l1tf_vmx_mitigation);
>  
>  /*
> diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
> index b277a2db62676..f82a0c564e931 100644
> --- a/arch/x86/kvm/Kconfig
> +++ b/arch/x86/kvm/Kconfig
> @@ -107,4 +107,21 @@ config KVM_MMU_AUDIT
>  	 This option adds a R/W kVM module parameter 'mmu_audit', which allows
>  	 auditing of KVM MMU events at runtime.
>  
> +config KVM_VMENTRY_L1D_FLUSH
> +	int "L1D cache flush settings (1-3)"
> +	range 1 3
> +	default "2"
> +	depends on KVM && X86 && X86_64
> +	help
> +	 This setting determines the L1D cache flush behavior before a VMENTER.
> +	 This is similar to setting the option / parameter to
> +	 kvm-intel.vmentry_l1d_flush.
> +	 1 - Never flush.
> +	 2 - Conditinally flush.
> +	 3 - Always flush.
> +
> +# OK, it's a little counter-intuitive to do this, but it puts it neatly under
> +# the virtualization menu.
> +source "drivers/vhost/Kconfig"
> +
>  endif # VIRTUALIZATION
> -- 
> 2.27.0.212.ge8ba1cc988-goog
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode
@ 2020-07-02 19:34 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-07-02 19:34 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4205 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200702161916.2456342-1-abhishekbh@google.com>
References: <20200702161916.2456342-1-abhishekbh@google.com>
TO: Abhishek Bhardwaj <abhishekbh@google.com>
TO: LKML <linux-kernel@vger.kernel.org>
CC: Abhishek Bhardwaj <abhishekbh@google.com>
CC: Anthony Steinhauser <asteinhauser@google.com>
CC: Borislav Petkov <bp@alien8.de>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Ingo Molnar <mingo@redhat.com>
CC: Jim Mattson <jmattson@google.com>
CC: Joerg Roedel <joro@8bytes.org>
CC: Josh Poimboeuf <jpoimboe@redhat.com>
CC: Mark Gross <mgross@linux.intel.com>

Hi Abhishek,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/auto-latest]
[also build test WARNING on linux/master tip/x86/core kvm/linux-next linus/master v5.8-rc3 next-20200702]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Abhishek-Bhardwaj/x86-speculation-l1tf-Add-KConfig-for-setting-the-L1D-cache-flush-mode/20200703-002135
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 7e44a91e0445a854af5d34ca0f5baceccd518e73
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago
config: i386-randconfig-s002-20200702 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-3-gfa153962-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> arch/x86/kernel/cpu/bugs.c:1402:6: sparse: sparse: undefined preprocessor identifier 'CONFIG_KVM_VMENTRY_L1D_FLUSH'
   arch/x86/kernel/cpu/bugs.c:1404:8: sparse: sparse: undefined preprocessor identifier 'CONFIG_KVM_VMENTRY_L1D_FLUSH'
   arch/x86/kernel/cpu/bugs.c:1406:8: sparse: sparse: undefined preprocessor identifier 'CONFIG_KVM_VMENTRY_L1D_FLUSH'

# https://github.com/0day-ci/linux/commit/893761b6e087104d84679082e5dfb90d41fd2878
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 893761b6e087104d84679082e5dfb90d41fd2878
vim +/CONFIG_KVM_VMENTRY_L1D_FLUSH +1402 arch/x86/kernel/cpu/bugs.c

72c6d2db64fa18c Thomas Gleixner   2018-07-13  1396  
d90a7a0ec83fb86 Jiri Kosina       2018-07-13  1397  /* Default mitigation for L1TF-affected CPUs */
d90a7a0ec83fb86 Jiri Kosina       2018-07-13  1398  enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH;
72c6d2db64fa18c Thomas Gleixner   2018-07-13  1399  #if IS_ENABLED(CONFIG_KVM_INTEL)
d90a7a0ec83fb86 Jiri Kosina       2018-07-13  1400  EXPORT_SYMBOL_GPL(l1tf_mitigation);
1eb46908b35dfba Guenter Roeck     2018-08-15  1401  #endif
893761b6e087104 Abhishek Bhardwaj 2020-07-02 @1402  #if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1)
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1403  enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_NEVER;
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1404  #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2)
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1405  enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_COND;
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1406  #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3)
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1407  enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_ALWAYS;
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1408  #else
895ae47f9918833 Thomas Gleixner   2018-07-13  1409  enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO;
893761b6e087104 Abhishek Bhardwaj 2020-07-02  1410  #endif
72c6d2db64fa18c Thomas Gleixner   2018-07-13  1411  EXPORT_SYMBOL_GPL(l1tf_vmx_mitigation);
72c6d2db64fa18c Thomas Gleixner   2018-07-13  1412  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34699 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-07-06 15:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02 16:19 [PATCH] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode Abhishek Bhardwaj
2020-07-02 21:33 ` kernel test robot
2020-07-02 21:33   ` kernel test robot
2020-07-03  6:25 ` kernel test robot
2020-07-03  6:25   ` kernel test robot
2020-07-06 15:01 ` mark gross
2020-07-02 19:34 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.