[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250219115626.GMZ7XG6s-5ftg1XLoZ@fat_crate.local>
Date: Wed, 19 Feb 2025 12:56:26 +0100
From: Borislav Petkov <bp@...en8.de>
To: Rik van Riel <riel@...riel.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, peterz@...radead.org,
dave.hansen@...ux.intel.com, zhengqi.arch@...edance.com,
nadav.amit@...il.com, thomas.lendacky@....com, kernel-team@...a.com,
linux-mm@...ck.org, akpm@...ux-foundation.org, jackmanb@...gle.com,
jannh@...gle.com, mhklinux@...look.com, andrew.cooper3@...rix.com,
Manali Shukla <Manali.Shukla@....com>
Subject: Re: [PATCH v11 04/12] x86/mm: get INVLPGB count max from CPUID
On Thu, Feb 13, 2025 at 11:13:55AM -0500, Rik van Riel wrote:
> The CPU advertises the maximum number of pages that can be shot down
> with one INVLPGB instruction in the CPUID data.
>
> Save that information for later use.
>
> Signed-off-by: Rik van Riel <riel@...riel.com>
> Tested-by: Manali Shukla <Manali.Shukla@....com>
> Tested-by: Brendan Jackman <jackmanb@...gle.com>
> Tested-by: Michael Kelley <mhklinux@...look.com>
> ---
> arch/x86/Kconfig.cpu | 5 +++++
> arch/x86/include/asm/cpufeatures.h | 1 +
> arch/x86/include/asm/tlbflush.h | 7 +++++++
> arch/x86/kernel/cpu/amd.c | 8 ++++++++
> 4 files changed, 21 insertions(+)
>
> diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
> index 2a7279d80460..abe013a1b076 100644
> --- a/arch/x86/Kconfig.cpu
> +++ b/arch/x86/Kconfig.cpu
> @@ -395,6 +395,10 @@ config X86_VMX_FEATURE_NAMES
> def_bool y
> depends on IA32_FEAT_CTL
>
> +config X86_BROADCAST_TLB_FLUSH
> + def_bool y
> + depends on CPU_SUP_AMD && 64BIT
> +
> menuconfig PROCESSOR_SELECT
> bool "Supported processor vendors" if EXPERT
> help
> @@ -431,6 +435,7 @@ config CPU_SUP_CYRIX_32
> config CPU_SUP_AMD
> default y
> bool "Support AMD processors" if PROCESSOR_SELECT
> + select X86_BROADCAST_TLB_FLUSH
CPU_SUP_AMD selects X86_BROADCAST_TLB_FLUSH which depends on CPU_SUP_AMD which
selects X86_BROADCAST_TLB_FLUSH which depends on CPU_SUP_AMD...
Why do you really need yet another Kconfig symbol? Just whack
X86_BROADCAST_TLB_FLUSH - it'll be enabled by default on everything anyway.
> @@ -1139,6 +1141,12 @@ static void cpu_detect_tlb_amd(struct cpuinfo_x86 *c)
> tlb_lli_2m[ENTRIES] = eax & mask;
>
> tlb_lli_4m[ENTRIES] = tlb_lli_2m[ENTRIES] >> 1;
> +
> + /* Max number of pages INVLPGB can invalidate in one shot */
> + if (boot_cpu_has(X86_FEATURE_INVLPGB)) {
> + cpuid(0x80000008, &eax, &ebx, &ecx, &edx);
> + invlpgb_count_max = (edx & 0xffff) + 1;
> + }
get_cpu_cap() already reads that leaf. You don't need to do it here again.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists