lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1527435965-202085-10-git-send-email-fenghua.yu@intel.com>
Date:   Sun, 27 May 2018 08:45:58 -0700
From:   Fenghua Yu <fenghua.yu@...el.com>
To:     "Thomas Gleixner" <tglx@...utronix.de>,
        "Ingo Molnar" <mingo@...e.hu>,
        "H. Peter Anvin" <hpa@...ux.intel.com>
Cc:     "Ashok Raj" <ashok.raj@...el.com>,
        "Dave Hansen" <dave.hansen@...el.com>,
        "Rafael Wysocki" <rafael.j.wysocki@...el.com>,
        "Tony Luck" <tony.luck@...el.com>,
        "Alan Cox" <alan@...ux.intel.com>,
        "Ravi V Shankar" <ravi.v.shankar@...el.com>,
        "Arjan van de Ven" <arjan@...radead.org>,
        "linux-kernel" <linux-kernel@...r.kernel.org>,
        "x86" <x86@...nel.org>, Fenghua Yu <fenghua.yu@...el.com>
Subject: [RFC PATCH 09/16] x86/split_lock: Add CONFIG to control #AC for split lock at boot time

User wants to specify how to set up #AC for split lock at boot time.

CONFIG_SPLIT_LOCK_AC_ENABLE_DEFAULT is added to control split
lock setting at boot time.

Default value is 2: Don't explicitly enable or disable #AC for split lock.
Inherit setting of #AC for split lock from firmware.

Value 0 to explicitly disable split lock at boot time.

Value 1 to explicitly enable split lock at boot time.

Signed-off-by: Fenghua Yu <fenghua.yu@...el.com>
---
 arch/x86/Kconfig               | 14 ++++++++++++++
 arch/x86/kernel/cpu/test_ctl.c | 12 ++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 043cde9a9b08..1d0dcd6fa69a 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -461,6 +461,20 @@ config SPLIT_LOCK_AC
 
 	  Say N if unsure.
 
+config SPLIT_LOCK_AC_ENABLE_DEFAULT
+	int "#AC for split lock enable value (0-2) at boot time"
+	range 0 2
+	default "2"
+	depends on SPLIT_LOCK_AC
+	help
+	  Set #AC for split lock enable default value at boot time
+		0: Explicitly disable #AC for split lock at boot time.
+		1: Explicitly enable #AC for split lock at boot time.
+		2: Don't explicitly enable or disable #AC for split lock.
+		   Inherit setting of #AC for split lock from firmware.
+
+	  Leave this to the default value of 2 if you are unsure.
+
 if X86_32
 config X86_BIGSMP
 	bool "Support for big SMP systems with more than 8 CPUs"
diff --git a/arch/x86/kernel/cpu/test_ctl.c b/arch/x86/kernel/cpu/test_ctl.c
index 82440740b2b9..a2f84fcd4da1 100644
--- a/arch/x86/kernel/cpu/test_ctl.c
+++ b/arch/x86/kernel/cpu/test_ctl.c
@@ -21,6 +21,7 @@
 
 #define DISABLE_SPLIT_LOCK_AC		0
 #define ENABLE_SPLIT_LOCK_AC		1
+#define INHERIT_SPLIT_LOCK_AC_FIRMWARE	2
 
 /* After disabling #AC for split lock in handler, re-enable it 1 msec later. */
 #define reenable_split_lock_delay	msecs_to_jiffies(1)
@@ -71,6 +72,17 @@ void detect_split_lock_ac(void)
 		split_lock_ac_firmware = ENABLE_SPLIT_LOCK_AC;
 	else
 		split_lock_ac_firmware = DISABLE_SPLIT_LOCK_AC;
+
+	/*
+	 * By default configuration, kernel inherits firmware split lock
+	 * setting. Kernel can be configured to explicitly enable or disable
+	 * #AC for split lock to override firmware setting.
+	 */
+	if (CONFIG_SPLIT_LOCK_AC_ENABLE_DEFAULT ==
+	    INHERIT_SPLIT_LOCK_AC_FIRMWARE)
+		split_lock_ac_kernel = split_lock_ac_firmware;
+	else
+		split_lock_ac_kernel = CONFIG_SPLIT_LOCK_AC_ENABLE_DEFAULT;
 }
 
 static void _setup_split_lock(int split_lock_ac_val)
-- 
2.5.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ