From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
To: Breno Leitao <leitao@debian.org>
Cc: jpoimboe@kernel.org, peterz@infradead.org, tglx@linutronix.de,
bp@alien8.de, Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
leit@fb.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] x86/bugs: Create an option to disable MDS
Date: Thu, 15 Jun 2023 15:13:47 -0700 [thread overview]
Message-ID: <20230615221347.6ghb4d33tituxht4@desk> (raw)
In-Reply-To: <20230615164417.3588162-2-leitao@debian.org>
On Thu, Jun 15, 2023 at 09:44:12AM -0700, Breno Leitao wrote:
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 182af64387d0..50f12829dce9 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -269,6 +269,7 @@ static void x86_amd_ssb_disable(void)
> /* Default mitigation for MDS-affected CPUs */
> static enum mds_mitigations mds_mitigation __ro_after_init = MDS_MITIGATION_FULL;
> static bool mds_nosmt __ro_after_init = false;
> +#define MDS_WARN_MSG "WARNING: Microarchitectural Data Sampling (MDS) speculative mitigation disabled!\n"
>
> static const char * const mds_strings[] = {
> [MDS_MITIGATION_OFF] = "Vulnerable",
> @@ -278,11 +279,17 @@ static const char * const mds_strings[] = {
>
> static void __init mds_select_mitigation(void)
> {
> - if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off()) {
> + if (!boot_cpu_has_bug(X86_BUG_MDS)) {
> mds_mitigation = MDS_MITIGATION_OFF;
> return;
> }
>
> + if (cpu_mitigations_off() || !IS_ENABLED(CONFIG_MITIGATE_MDS)) {
> + mds_mitigation = MDS_MITIGATION_OFF;
> + pr_err(MDS_WARN_MSG);
> + return;
Why does compile time config needs to be so restrictive that it does not
allow runtime override with mds= cmdline?
I believe Kconfig should only be setting the mitigation default,
allowing users to select mitigation at runtime:
---
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 182af64387d0..50e1ca4ea68b 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -267,7 +267,11 @@ static void x86_amd_ssb_disable(void)
#define pr_fmt(fmt) "MDS: " fmt
/* Default mitigation for MDS-affected CPUs */
+#if IS_ENABLED(CONFIG_MITIGATE_MDS)
static enum mds_mitigations mds_mitigation __ro_after_init = MDS_MITIGATION_FULL;
+#else
+static enum mds_mitigations mds_mitigation __ro_after_init = MDS_MITIGATION_OFF;
+#endif
static bool mds_nosmt __ro_after_init = false;
static const char * const mds_strings[] = {
next prev parent reply other threads:[~2023-06-15 22:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-15 16:44 [PATCH 0/2] x86/bugs: Break down mitigations configurations Breno Leitao
2023-06-15 16:44 ` [PATCH 1/3] x86/bugs: Create an option to disable MDS Breno Leitao
2023-06-15 22:13 ` Pawan Gupta [this message]
2023-06-16 11:47 ` Breno Leitao
2023-06-15 16:44 ` [PATCH 2/3] x86/bugs: Create an option to disable TAA Breno Leitao
2023-06-15 16:44 ` [PATCH 3/3] x86/bugs: Create an option to disable MMIO vulnerability Breno Leitao
2023-06-15 16:44 ` [PATCH 0/2] x86/bugs: Break down mitigations configurations Breno Leitao
2023-06-15 16:44 ` [PATCH 1/2] x86/speculation: Disable mitigations if CONFIG says so Breno Leitao
2023-06-15 16:44 ` [PATCH 2/2] x86/speculation: Print error when mitigations are disabled Breno Leitao
2023-06-15 17:21 ` [PATCH 0/2] x86/bugs: Break down mitigations configurations Andi Kleen
2023-06-16 8:39 ` Breno Leitao
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=20230615221347.6ghb4d33tituxht4@desk \
--to=pawan.kumar.gupta@linux.intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@kernel.org \
--cc=leit@fb.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®