All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Borislav Petkov <bp@alien8.de>
Cc: Rik van Riel <riel@surriel.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH] add tlbi=off to disable INVLPGB
Date: Thu, 30 Jul 2026 12:32:27 +0200	[thread overview]
Message-ID: <20260730103227.GC751831@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260730014412.GEamqsbL46iteL25as@fat_crate.local>

On Wed, Jul 29, 2026 at 06:44:12PM -0700, Borislav Petkov wrote:
> On Wed, Jul 29, 2026 at 08:43:41PM -0400, Rik van Riel wrote:
> > With the recently found INVLPGB / TLBSYNC issue, there has been some
> > interest in disabling invlpgb TLB flushing, in order to rule out
> > that CPU issue as a cause of userspace crashes.
> > 
> > The top search result shows "clearcpuid=invlpgb"
> > 
> > However, invlpgb is not actually in x86_cap_flags, so booting with
> > clearcpuid=invlpgb results in an error message:
> > 
> >   clearcpuid: unknown CPU flag: invlpgb
> > 
> > Add a kernel commandline option to turn off AMD TLBI, to make it
> > easier to rule out INVLPGB as a cause of userspace crashes.
> > 
> > Verified by booting a Bergamo system with tlbi=off and checking
> > that the INVLPGB bit is clear in boot_cpu_data.x86_capability
> > 
> > Signed-off-by: Rik van Riel <riel@surriel.com>
> > Suggested-by: Borislav Petkov <bp@alien8.de>
> > ---
> >  arch/x86/mm/init_64.c | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> 
> I'll take that and raise you with v2:
> 
> The rationale for moving it to amd.c is that it won't be there on builds which
> don't enable AMD code. And we could still raise it up somewhere
> vendor-agnostic later if the other vendor wants to be able to disable their
> version if TLB invalidation glue implementation.
> 
> From: Rik van Riel <riel@surriel.com>
> Date: Wed, 29 Jul 2026 20:43:41 -0400
> Subject: [PATCH] x86/CPU/AMD: Add a tlbi= cmdline switch
> 
> With the recently found INVLPGB / TLBSYNC issue, there has been some
> interest in disabling INVLPGB-based TLB flushing, in order to rule out
> that CPU issue as a cause of userspace crashes.
> 
> Add a kernel command line option to control AMD TLBI.
> 
>   [ bp: Rewrite commit message, move to amd.c, add documentation. ]
> 
> Suggested-by: Borislav Petkov <bp@alien8.de>
> Signed-off-by: Rik van Riel <riel@surriel.com>
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> Link: https://patch.msgid.link/20260729204341.3eb0b5ea@fangorn
> ---
>  Documentation/admin-guide/kernel-parameters.txt |  5 +++++
>  arch/x86/kernel/cpu/amd.c                       | 10 ++++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 87bb1fb31696..4e3c5fa411d2 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -7568,6 +7568,11 @@ Kernel parameters
>  			See Documentation/admin-guide/mm/transhuge.rst for more
>  			details.
>  
> +	tlbi=		[X86-64]
> +			Format: {off}
> +			Control the AMD TLBI feature support (INVLPGB-based
> +			TLB flushing).
> +
>  	topology=	[S390,EARLY]
>  			Format: {off | on}
>  			Specify if the kernel should make use of the cpu
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index 54e14ed276b5..a3cde941a81d 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -1440,3 +1440,13 @@ static __init int print_dmi_agesa(void)
>  	return 0;
>  }
>  late_initcall(print_dmi_agesa);
> +
> +/* Control TLBI feature (INVLPGB-based TLB flushing) */
> +static int __init tlbi_setup(char *str)
> +{
> +	if (!strcmp(str, "off"))
> +		setup_clear_cpu_cap(X86_FEATURE_INVLPGB);
> +
> +	return 1;
> +}
> +__setup("tlbi=", tlbi_setup);

TLBI stands for Translation Lookaside Buffer Invalidation. So a command
line that says: 'tlbi=off' means no move invalidation *at*all*. This
seems like a very bad option.

Please rename.

      reply	other threads:[~2026-07-30 10:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  0:43 [PATCH] add tlbi=off to disable INVLPGB Rik van Riel
2026-07-30  1:44 ` Borislav Petkov
2026-07-30 10:32   ` Peter Zijlstra [this message]

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=20260730103227.GC751831@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=riel@surriel.com \
    --cc=tglx@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.