diff options
| author | Josh Poimboeuf <jpoimboe@redhat.com> | 2019-04-02 10:59:33 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2019-04-02 14:02:36 -0400 |
| commit | d71eb0ce109a124b0fa714832823b9452f2762cf (patch) | |
| tree | e5efa2ea879a545d3eb552a83343c91f873e7ffb | |
| parent | 5999bbe7a6ea3c62029532ec84dc06003a1fa258 (diff) | |
x86/speculation/mds: Add mds=full,nosmt cmdline option
Add the mds=full,nosmt cmdline option. This is like mds=full, but with
SMT disabled if the CPU is vulnerable.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
| -rw-r--r-- | Documentation/admin-guide/hw-vuln/mds.rst | 3 | ||||
| -rw-r--r-- | Documentation/admin-guide/kernel-parameters.txt | 6 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/bugs.c | 10 |
3 files changed, 17 insertions, 2 deletions
diff --git a/Documentation/admin-guide/hw-vuln/mds.rst b/Documentation/admin-guide/hw-vuln/mds.rst index 1de29d28903d..244ab47d1fb3 100644 --- a/Documentation/admin-guide/hw-vuln/mds.rst +++ b/Documentation/admin-guide/hw-vuln/mds.rst | |||
| @@ -260,6 +260,9 @@ time with the option "mds=". The valid arguments for this option are: | |||
| 260 | 260 | ||
| 261 | It does not automatically disable SMT. | 261 | It does not automatically disable SMT. |
| 262 | 262 | ||
| 263 | full,nosmt The same as mds=full, with SMT disabled on vulnerable | ||
| 264 | CPUs. This is the complete mitigation. | ||
| 265 | |||
| 263 | off Disables MDS mitigations completely. | 266 | off Disables MDS mitigations completely. |
| 264 | 267 | ||
| 265 | ============ ============================================================= | 268 | ============ ============================================================= |
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 7325319c2c23..8f04985d3122 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt | |||
| @@ -2372,8 +2372,10 @@ | |||
| 2372 | This parameter controls the MDS mitigation. The | 2372 | This parameter controls the MDS mitigation. The |
| 2373 | options are: | 2373 | options are: |
| 2374 | 2374 | ||
| 2375 | full - Enable MDS mitigation on vulnerable CPUs | 2375 | full - Enable MDS mitigation on vulnerable CPUs |
| 2376 | off - Unconditionally disable MDS mitigation | 2376 | full,nosmt - Enable MDS mitigation and disable |
| 2377 | SMT on vulnerable CPUs | ||
| 2378 | off - Unconditionally disable MDS mitigation | ||
| 2377 | 2379 | ||
| 2378 | Not specifying this option is equivalent to | 2380 | Not specifying this option is equivalent to |
| 2379 | mds=full. | 2381 | mds=full. |
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 373ae1dcd301..9f252082a83b 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c | |||
| @@ -221,6 +221,7 @@ static void x86_amd_ssb_disable(void) | |||
| 221 | 221 | ||
| 222 | /* Default mitigation for L1TF-affected CPUs */ | 222 | /* Default mitigation for L1TF-affected CPUs */ |
| 223 | static enum mds_mitigations mds_mitigation __ro_after_init = MDS_MITIGATION_FULL; | 223 | static enum mds_mitigations mds_mitigation __ro_after_init = MDS_MITIGATION_FULL; |
| 224 | static bool mds_nosmt __ro_after_init = false; | ||
| 224 | 225 | ||
| 225 | static const char * const mds_strings[] = { | 226 | static const char * const mds_strings[] = { |
| 226 | [MDS_MITIGATION_OFF] = "Vulnerable", | 227 | [MDS_MITIGATION_OFF] = "Vulnerable", |
| @@ -238,8 +239,13 @@ static void __init mds_select_mitigation(void) | |||
| 238 | if (mds_mitigation == MDS_MITIGATION_FULL) { | 239 | if (mds_mitigation == MDS_MITIGATION_FULL) { |
| 239 | if (!boot_cpu_has(X86_FEATURE_MD_CLEAR)) | 240 | if (!boot_cpu_has(X86_FEATURE_MD_CLEAR)) |
| 240 | mds_mitigation = MDS_MITIGATION_VMWERV; | 241 | mds_mitigation = MDS_MITIGATION_VMWERV; |
| 242 | |||
| 241 | static_branch_enable(&mds_user_clear); | 243 | static_branch_enable(&mds_user_clear); |
| 244 | |||
| 245 | if (mds_nosmt && !boot_cpu_has(X86_BUG_MSBDS_ONLY)) | ||
| 246 | cpu_smt_disable(false); | ||
| 242 | } | 247 | } |
| 248 | |||
| 243 | pr_info("%s\n", mds_strings[mds_mitigation]); | 249 | pr_info("%s\n", mds_strings[mds_mitigation]); |
| 244 | } | 250 | } |
| 245 | 251 | ||
| @@ -255,6 +261,10 @@ static int __init mds_cmdline(char *str) | |||
| 255 | mds_mitigation = MDS_MITIGATION_OFF; | 261 | mds_mitigation = MDS_MITIGATION_OFF; |
| 256 | else if (!strcmp(str, "full")) | 262 | else if (!strcmp(str, "full")) |
| 257 | mds_mitigation = MDS_MITIGATION_FULL; | 263 | mds_mitigation = MDS_MITIGATION_FULL; |
| 264 | else if (!strcmp(str, "full,nosmt")) { | ||
| 265 | mds_mitigation = MDS_MITIGATION_FULL; | ||
| 266 | mds_nosmt = true; | ||
| 267 | } | ||
| 258 | 268 | ||
| 259 | return 0; | 269 | return 0; |
| 260 | } | 270 | } |
