lkml.org 
[lkml]   [2020]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] x86/split_lock: check split lock feature on initialization
Date
While the setup code probes for the availability of the TEST_CTRL MSR,
the current initialization code unconditionally probes it even on
systems where this architectural MSR is not available.

This commit changes the code to check for the availability of the split
lock detect feature before initializing it.

Fixes: dbaba47085b0c ("x86/split_lock: Rework the initialization flow of split lock detection")
Signed-off-by: Benjamin Lamowski <benjamin.lamowski@kernkonzept.com>
---
arch/x86/kernel/cpu/intel.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 9a26e972cdea..70d338ff4807 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -586,7 +586,7 @@ static void init_intel_misc_features(struct cpuinfo_x86 *c)
wrmsrl(MSR_MISC_FEATURES_ENABLES, msr);
}

-static void split_lock_init(void);
+static void split_lock_init(struct cpuinfo_x86 *c);

static void init_intel(struct cpuinfo_x86 *c)
{
@@ -703,7 +703,7 @@ static void init_intel(struct cpuinfo_x86 *c)
if (tsx_ctrl_state == TSX_CTRL_DISABLE)
tsx_disable();

- split_lock_init();
+ split_lock_init(c);
}

#ifdef CONFIG_X86_32
@@ -1061,9 +1061,10 @@ static void sld_update_msr(bool on)
wrmsrl(MSR_TEST_CTRL, test_ctrl_val);
}

-static void split_lock_init(void)
+static void split_lock_init(struct cpuinfo_x86 *c)
{
- split_lock_verify_msr(sld_state != sld_off);
+ if (cpu_has(c, X86_FEATURE_SPLIT_LOCK_DETECT))
+ split_lock_verify_msr(sld_state != sld_off);
}

bool handle_user_split_lock(struct pt_regs *regs, long error_code)
--
2.25.1
\
 
 \ /
  Last update: 2020-04-03 20:26    [W:0.138 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site