Skip to contentSkip to conversation

x86/tsx: Get the tsx= command line parameter with core_param()

PATCH In review Petr Tesarik 3 participants 4 messages Jul 31, 2025 – Sep 15, 2025 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/tsx: Get the tsx= command line parameter with core_param()

Use core_param() to get the value of the tsx= command line parameter. Although cmdline_find_option() works fine, the option is reported as unknown and passed to user space. The latter is not a real issue, but the former is confusing and makes people wonder if the tsx= parameter had any effect and double-check for typos unnecessarily.

---
 arch/x86/kernel/cpu/tsx.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
arch/x86/kernel/cpu/tsx.c +7 -8
index 49782724a943..03e1f28cf9ec 100644
@@ -156,11 +156,11 @@ static void tsx_dev_mode_disable(void)
 	}
 }
 
+static char *tsx_cmdline_param __initdata;
+core_param(tsx, tsx_cmdline_param, charp, 0);
+
 void __init tsx_init(void)
 {
-	char arg[5] = {};
-	int ret;
-
 	tsx_dev_mode_disable();
 
 	/*
@@ -194,13 +194,12 @@ void __init tsx_init(void)
 		return;
 	}
 
-	ret = cmdline_find_option(boot_command_line, "tsx", arg, sizeof(arg));
-	if (ret >= 0) {
-		if (!strcmp(arg, "on")) {
+	if (tsx_cmdline_param) {
+		if (!strcmp(tsx_cmdline_param, "on")) {
 			tsx_ctrl_state = TSX_CTRL_ENABLE;
-		} else if (!strcmp(arg, "off")) {
+		} else if (!strcmp(tsx_cmdline_param, "off")) {
 			tsx_ctrl_state = TSX_CTRL_DISABLE;
-		} else if (!strcmp(arg, "auto")) {
+		} else if (!strcmp(tsx_cmdline_param, "auto")) {
 			tsx_ctrl_state = x86_get_tsx_auto_mode();
 		} else {
 			tsx_ctrl_state = TSX_CTRL_DISABLE;
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Petr Tesarik

Use core_param() to get the value of the tsx= command line parameter. Although cmdline_find_option() works fine, the option is reported as unknown and passed to user space. The latter is not a real issue, but the former is confusing and makes people wonder if the tsx= parameter had any effect and double-check for typos unnecessarily.

#2 lore raw
Quoted 10 lines · On Thu, 31 Jul 2025 12:16:36 -0700 Pawan Gupta…
Quoted 7 lines · Petr Tesarik

Use core_param() to get the value of the tsx= command line parameter. Although cmdline_find_option() works fine, the option is reported as unknown and passed to user space. The latter is not a real issue, but the former is confusing and makes people wonder if the tsx= parameter had any effect and double-check for typos unnecessarily.

Thank you, Pawan.

May I ask what is the status of this patch now?

Petr T

maintainer
#3 lore raw
In reply to Petr Tesarik
Quoted 1 line · Petr Tesarik

Use core_param() to get the value of the tsx= command line parameter.

Use early_param() pls.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette