mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
To: Petr Tesarik <ptesarik@suse.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Nikolay Borisov <nik.borisov@suse.com>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>,
	"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] x86/tsx: Get the tsx= command line parameter with early_param()
Date: Wed, 22 Oct 2025 10:46:03 -0700	[thread overview]
Message-ID: <20251022174603.mx7sze3w5e24obps@desk> (raw)
In-Reply-To: <befa0b859777267a11c90aebde6a3bedce276b90.1761127696.git.ptesarik@suse.com>

On Wed, Oct 22, 2025 at 12:26:13PM +0200, Petr Tesarik wrote:
> Use early_param() to get the value of the tsx= command line parameter. It
> is an early parameter, because it must be parsed before tsx_init(), which
> is called long before kernel_init(), where normal parameters are parsed.
> 
> Although cmdline_find_option() from tsx_init() works fine, the option is
> later 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.
> 
> The behavior changes slightly if "tsx" is given without any argument (which
> is invalid syntax). Prior to this patch, the kernel logged an error message
> and disabled TSX. With this patch, the kernel still issues a warning
> (Malformed early option 'tsx'), but TSX state is unchanged. The new
> behavior is consistent with other parameters, e.g. "tsx_async_abort".
> 
> Suggested-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
> Signed-off-by: Petr Tesarik <ptesarik@suse.com>
> ---
>  arch/x86/kernel/cpu/tsx.c | 52 ++++++++++++++++++++-------------------
>  1 file changed, 27 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/tsx.c b/arch/x86/kernel/cpu/tsx.c
> index 8be08ece2214..74ba4abac7e9 100644
> --- a/arch/x86/kernel/cpu/tsx.c
> +++ b/arch/x86/kernel/cpu/tsx.c
> @@ -20,13 +20,17 @@
>  #define pr_fmt(fmt) "tsx: " fmt
>  
>  enum tsx_ctrl_states {
> +	TSX_CTRL_AUTO,
>  	TSX_CTRL_ENABLE,
>  	TSX_CTRL_DISABLE,
>  	TSX_CTRL_RTM_ALWAYS_ABORT,
>  	TSX_CTRL_NOT_SUPPORTED,
>  };
>  
> -static enum tsx_ctrl_states tsx_ctrl_state __ro_after_init = TSX_CTRL_NOT_SUPPORTED;
> +static enum tsx_ctrl_states tsx_ctrl_state __ro_after_init =
> +	IS_ENABLED(CONFIG_X86_INTEL_TSX_MODE_AUTO) ? TSX_CTRL_AUTO :
> +	IS_ENABLED(CONFIG_X86_INTEL_TSX_MODE_OFF) ? TSX_CTRL_DISABLE :
                                                 ^
						 The extra space I had in
						 the version I sent was
						 intentional.

> +	TSX_CTRL_ENABLE;

Also this can stay on the same line.

	IS_ENABLED(CONFIG_X86_INTEL_TSX_MODE_AUTO) ? TSX_CTRL_AUTO    :
	IS_ENABLED(CONFIG_X86_INTEL_TSX_MODE_OFF)  ? TSX_CTRL_DISABLE : TSX_CTRL_ENABLE;

IMO, this is so much more easier to read.

  reply	other threads:[~2025-10-22 17:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 10:26 [PATCH v3 0/2] x86/tsx: Improve handling of the tsx= kernel parameter Petr Tesarik
2025-10-22 10:26 ` [PATCH v3 1/2] x86/tsx: Make tsx_ctrl_state static Petr Tesarik
2025-10-22 10:26 ` [PATCH v3 2/2] x86/tsx: Get the tsx= command line parameter with early_param() Petr Tesarik
2025-10-22 17:46   ` Pawan Gupta [this message]
2025-10-23  6:45     ` Petr Tesarik
2025-10-23 16:05       ` Pawan Gupta

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=20251022174603.mx7sze3w5e24obps@desk \
    --to=pawan.kumar.gupta@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nik.borisov@suse.com \
    --cc=ptesarik@suse.com \
    --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®