[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <174108398196.14745.189474796391905137.tip-bot2@tip-bot2>
Date: Tue, 04 Mar 2025 10:26:21 -0000
From: "tip-bot2 for Brendan Jackman" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Peter Zijlstra <peterz@...radead.org>,
Brendan Jackman <jackmanb@...gle.com>, Ingo Molnar <mingo@...nel.org>,
"Borislav Petkov (AMD)" <bp@...en8.de>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: x86/cpu] x86/cpu: Log CPU flag cmdline hacks more verbosely
The following commit has been merged into the x86/cpu branch of tip:
Commit-ID: d0ba9bcf001c7907e4755b0e498f5ff9d1a228ef
Gitweb: https://git.kernel.org/tip/d0ba9bcf001c7907e4755b0e498f5ff9d1a228ef
Author: Brendan Jackman <jackmanb@...gle.com>
AuthorDate: Mon, 03 Mar 2025 15:45:39
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Tue, 04 Mar 2025 11:15:12 +01:00
x86/cpu: Log CPU flag cmdline hacks more verbosely
Since using these options is very dangerous, make details as visible as
possible:
- Instead of a single message for each of the cmdline options, print a
separate pr_warn() for each individual flag.
- Say explicitly whether the flag is a "feature" or a "bug".
Suggested-by: Peter Zijlstra <peterz@...radead.org>
Signed-off-by: Brendan Jackman <jackmanb@...gle.com>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Acked-by: Borislav Petkov (AMD) <bp@...en8.de>
Link: https://lore.kernel.org/r/20250303-setcpuid-taint-louder-v1-3-8d255032cb4c@google.com
---
arch/x86/kernel/cpu/common.c | 39 ++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index c1ced31..8eba9ca 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1484,8 +1484,6 @@ static inline bool parse_set_clear_cpuid(char *arg, bool set)
char *opt;
int taint = 0;
- pr_warn("%s CPUID bits:", set ? "Force-enabling" : "Clearing");
-
while (arg) {
bool found __maybe_unused = false;
unsigned int bit;
@@ -1500,16 +1498,19 @@ static inline bool parse_set_clear_cpuid(char *arg, bool set)
if (!kstrtouint(opt, 10, &bit)) {
if (bit < NCAPINTS * 32) {
+ if (set) {
+ pr_warn("setcpuid: force-enabling CPU feature flag:");
+ setup_force_cpu_cap(bit);
+ } else {
+ pr_warn("clearcpuid: force-disabling CPU feature flag:");
+ setup_clear_cpu_cap(bit);
+ }
/* empty-string, i.e., ""-defined feature flags */
if (!x86_cap_flags[bit])
- pr_cont(" %d:%d", bit >> 5, bit & 31);
+ pr_cont(" %d:%d\n", bit >> 5, bit & 31);
else
- pr_cont(" %s", x86_cap_flags[bit]);
+ pr_cont(" %s\n", x86_cap_flags[bit]);
- if (set)
- setup_force_cpu_cap(bit);
- else
- setup_clear_cpu_cap(bit);
taint++;
}
/*
@@ -1521,11 +1522,15 @@ static inline bool parse_set_clear_cpuid(char *arg, bool set)
for (bit = 0; bit < 32 * (NCAPINTS + NBUGINTS); bit++) {
const char *flag;
+ const char *kind;
- if (bit < 32 * NCAPINTS)
+ if (bit < 32 * NCAPINTS) {
flag = x86_cap_flags[bit];
- else
+ kind = "feature";
+ } else {
+ kind = "bug";
flag = x86_bug_flags[bit - (32 * NCAPINTS)];
+ }
if (!flag)
continue;
@@ -1533,22 +1538,24 @@ static inline bool parse_set_clear_cpuid(char *arg, bool set)
if (strcmp(flag, opt))
continue;
- pr_cont(" %s", opt);
- if (set)
+ if (set) {
+ pr_warn("setcpuid: force-enabling CPU %s flag: %s\n",
+ kind, flag);
setup_force_cpu_cap(bit);
- else
+ } else {
+ pr_warn("clearcpuid: force-disabling CPU %s flag: %s\n",
+ kind, flag);
setup_clear_cpu_cap(bit);
+ }
taint++;
found = true;
break;
}
if (!found)
- pr_cont(" (unknown: %s)", opt);
+ pr_warn("%s: unknown CPU flag: %s", set ? "setcpuid" : "clearcpuid", opt);
}
- pr_cont("\n");
-
return taint;
}
Powered by blists - more mailing lists