From: Benjamin Lamowski <benjamin.lamowski@kernkonzept.com>
To: xiaoyao.li@intel.com
Cc: bp@alien8.de, fenghua.yu@intel.com, hpa@zytor.com,
linux-kernel@vger.kernel.org, luto@kernel.org, mingo@redhat.com,
nivedita@alum.mit.edu, pbonzini@redhat.com, peterz@infradead.org,
philipp.eppelt@kernkonzept.com, sean.j.christopherson@intel.com,
tglx@linutronix.de, tony.luck@intel.com, x86@kernel.org,
Benjamin Lamowski <benjamin.lamowski@kernkonzept.com>
Subject: [PATCH v3 1/1] x86/split_lock: check split lock support on initialization
Date: Mon, 6 Apr 2020 18:17:37 +0200 [thread overview]
Message-ID: <20200406161737.258840-1-benjamin.lamowski@kernkonzept.com> (raw)
In-Reply-To: <20200406160247.208004-1-benjamin.lamowski@kernkonzept.com>
While the sld setup code is run only if the TEST_CTRL MSR is available,
the current sld initialization code unconditionally resets it even on
systems where this architectural MSR is not available.
This commit introduces a new default sld state sld_unsupported, which is
changed in split_lock_setup() only if sld is available; and checks for
split lock detect support 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>
Suggested-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
arch/x86/kernel/cpu/intel.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 9a26e972cdea..de45ba1089c1 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -34,17 +34,18 @@
#endif
enum split_lock_detect_state {
- sld_off = 0,
+ sld_unsupported = 0,
+ sld_off,
sld_warn,
sld_fatal,
};
/*
- * Default to sld_off because most systems do not support split lock detection
- * split_lock_setup() will switch this to sld_warn on systems that support
- * split lock detect, unless there is a command line override.
+ * Default to sld_unsupported because most systems do not support split lock
+ * detection. split_lock_setup() will switch this to sld_warn on systems that
+ * support split lock detect, unless there is a command line override.
*/
-static enum split_lock_detect_state sld_state __ro_after_init = sld_off;
+static enum split_lock_detect_state sld_state __ro_after_init = sld_unsupported;
static u64 msr_test_ctrl_cache __ro_after_init;
/*
@@ -1033,6 +1034,9 @@ static void __init split_lock_setup(void)
case sld_fatal:
pr_info("sending SIGBUS on user-space split_locks\n");
break;
+ case sld_unsupported:
+ /* Can't happen, just to keep the compiler happy */
+ break;
}
rdmsrl(MSR_TEST_CTRL, msr_test_ctrl_cache);
@@ -1063,7 +1067,8 @@ static void sld_update_msr(bool on)
static void split_lock_init(void)
{
- split_lock_verify_msr(sld_state != sld_off);
+ if (sld_state != sld_unsupported)
+ split_lock_verify_msr(sld_state != sld_off);
}
bool handle_user_split_lock(struct pt_regs *regs, long error_code)
--
2.25.1
next prev parent reply other threads:[~2020-04-06 16:18 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-25 3:09 [PATCH v7 0/2] Fix and optimization of split_lock_detection Xiaoyao Li
2020-03-25 3:09 ` [PATCH v7 1/2] x86/split_lock: Rework the initialization flow of split lock detection Xiaoyao Li
2020-03-28 16:32 ` Sean Christopherson
2020-03-30 13:26 ` Xiaoyao Li
2020-03-30 14:26 ` Sean Christopherson
2020-03-25 3:09 ` [PATCH v7 2/2] x86/split_lock: Avoid runtime reads of the TEST_CTRL MSR Xiaoyao Li
2020-03-28 16:34 ` Sean Christopherson
2020-03-29 9:13 ` Xiaoyao Li
2020-03-30 18:18 ` Sean Christopherson
2020-04-03 17:44 ` [PATCH 0/1] x86/split_lock: check split lock feature on initialization Benjamin Lamowski
2020-04-03 17:44 ` [PATCH 1/1] " Benjamin Lamowski
2020-04-03 18:01 ` Sean Christopherson
2020-04-06 8:23 ` Benjamin Lamowski
2020-04-06 11:48 ` Xiaoyao Li
2020-04-06 15:57 ` [PATCH v2 0/1] x86/split_lock: check split lock support " Benjamin Lamowski
2020-04-06 16:02 ` [PATCH v2 1/1] " Benjamin Lamowski
2020-04-06 16:17 ` Benjamin Lamowski [this message]
2020-04-06 21:24 ` [PATCH v3 " Thomas Gleixner
2020-04-06 21:21 ` [PATCH 0/1] x86/split_lock: check split lock feature " Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200406161737.258840-1-benjamin.lamowski@kernkonzept.com \
--to=benjamin.lamowski@kernkonzept.com \
--cc=bp@alien8.de \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=nivedita@alum.mit.edu \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=philipp.eppelt@kernkonzept.com \
--cc=sean.j.christopherson@intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
--cc=xiaoyao.li@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).