linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/tsx: Get the tsx= command line parameter with core_param()
@ 2025-07-31  8:34 Petr Tesarik
  2025-07-31 19:16 ` Pawan Gupta
  2025-09-15 14:39 ` Borislav Petkov
  0 siblings, 2 replies; 4+ messages in thread
From: Petr Tesarik @ 2025-07-31  8:34 UTC (permalink / raw)
  To: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen
  Cc: Pawan Gupta, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	open list:X86 ARCHITECTURE (32-BIT AND 64-BIT), 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.

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 arch/x86/kernel/cpu/tsx.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/cpu/tsx.c b/arch/x86/kernel/cpu/tsx.c
index 49782724a943..03e1f28cf9ec 100644
--- a/arch/x86/kernel/cpu/tsx.c
+++ b/arch/x86/kernel/cpu/tsx.c
@@ -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;
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/tsx: Get the tsx= command line parameter with core_param()
  2025-07-31  8:34 [PATCH] x86/tsx: Get the tsx= command line parameter with core_param() Petr Tesarik
@ 2025-07-31 19:16 ` Pawan Gupta
  2025-08-28 11:51   ` Petr Tesarik
  2025-09-15 14:39 ` Borislav Petkov
  1 sibling, 1 reply; 4+ messages in thread
From: Pawan Gupta @ 2025-07-31 19:16 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)

On Thu, Jul 31, 2025 at 10:34:33AM +0200, Petr Tesarik wrote:
> 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.
> 
> Signed-off-by: Petr Tesarik <ptesarik@suse.com>

Reviewed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/tsx: Get the tsx= command line parameter with core_param()
  2025-07-31 19:16 ` Pawan Gupta
@ 2025-08-28 11:51   ` Petr Tesarik
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Tesarik @ 2025-08-28 11:51 UTC (permalink / raw)
  To: Pawan Gupta
  Cc: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)

On Thu, 31 Jul 2025 12:16:36 -0700
Pawan Gupta <pawan.kumar.gupta@linux.intel.com> wrote:

> On Thu, Jul 31, 2025 at 10:34:33AM +0200, Petr Tesarik wrote:
> > 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.
> > 
> > Signed-off-by: Petr Tesarik <ptesarik@suse.com>  
> 
> Reviewed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>

Thank you, Pawan.

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

Petr T

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86/tsx: Get the tsx= command line parameter with core_param()
  2025-07-31  8:34 [PATCH] x86/tsx: Get the tsx= command line parameter with core_param() Petr Tesarik
  2025-07-31 19:16 ` Pawan Gupta
@ 2025-09-15 14:39 ` Borislav Petkov
  1 sibling, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2025-09-15 14:39 UTC (permalink / raw)
  To: Petr Tesarik
  Cc: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, Dave Hansen,
	Pawan Gupta, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
	open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)

On Thu, Jul 31, 2025 at 10:34:33AM +0200, Petr Tesarik wrote:
> Use core_param() to get the value of the tsx= command line parameter.

Use early_param() pls.

Thx.

-- 
Regards/Gruss,
    Boris.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-15 14:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-31  8:34 [PATCH] x86/tsx: Get the tsx= command line parameter with core_param() Petr Tesarik
2025-07-31 19:16 ` Pawan Gupta
2025-08-28 11:51   ` Petr Tesarik
2025-09-15 14:39 ` Borislav Petkov

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).