Skip to contentSkip to conversation

x86,cpu: add X86_FEATURE_INVLPGB flag

PATCH In review Rik van Riel 3 participants 6 messages Sep 24, 2024 – Sep 26, 2024 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86,cpu: add X86_FEATURE_INVLPGB flag

Add the definition for the X86_FEATURE_INVLPGB CPUID flag.

Tested by booting a kernel with this change on an AMD Milan system, and making sure the "invlpgb" flag shows up in /proc/cpuinfo

---
 arch/x86/include/asm/cpufeatures.h | 1 +
 1 file changed, 1 insertion(+)
arch/x86/include/asm/cpufeatures.h +1 -0
index dd4682857c12..9a98cc7ded39 100644
@@ -335,6 +335,7 @@
 #define X86_FEATURE_CLZERO		(13*32+ 0) /* "clzero" CLZERO instruction */
 #define X86_FEATURE_IRPERF		(13*32+ 1) /* "irperf" Instructions Retired Count */
 #define X86_FEATURE_XSAVEERPTR		(13*32+ 2) /* "xsaveerptr" Always save/restore FP error pointers */
+#define X86_FEATURE_INVLPGB		(13*32+ 3) /* "invlpgb" INVLPGB instruction */
 #define X86_FEATURE_RDPRU		(13*32+ 4) /* "rdpru" Read processor register at user level */
 #define X86_FEATURE_WBNOINVD		(13*32+ 9) /* "wbnoinvd" WBNOINVD instruction */
 #define X86_FEATURE_AMD_IBPB		(13*32+12) /* Indirect Branch Prediction Barrier */
Signature · 1 line
2.45.2
#1 lore raw
Quoted 6 lines · Rik van Riel

Add the definition for the X86_FEATURE_INVLPGB CPUID flag.

Tested by booting a kernel with this change on an AMD Milan system, and making sure the "invlpgb" flag shows up in /proc/cpuinfo

Now there is a need to also update the CPUID database:

https://lore.kernel.org/lkml/87o7642u7w.ffs@tglx/

Thanks!
Xin

Quoted 16 lines
---
  arch/x86/include/asm/cpufeatures.h | 1 +
  1 file changed, 1 insertion(+)
arch/x86/include/asm/cpufeatures.h +1 -0
index dd4682857c12..9a98cc7ded39 100644
@@ -335,6 +335,7 @@
  #define X86_FEATURE_CLZERO		(13*32+ 0) /* "clzero" CLZERO instruction */
  #define X86_FEATURE_IRPERF		(13*32+ 1) /* "irperf" Instructions Retired Count */
  #define X86_FEATURE_XSAVEERPTR		(13*32+ 2) /* "xsaveerptr" Always save/restore FP error pointers */
+#define X86_FEATURE_INVLPGB		(13*32+ 3) /* "invlpgb" INVLPGB instruction */
  #define X86_FEATURE_RDPRU		(13*32+ 4) /* "rdpru" Read processor register at user level */
  #define X86_FEATURE_WBNOINVD		(13*32+ 9) /* "wbnoinvd" WBNOINVD instruction */
  #define X86_FEATURE_AMD_IBPB		(13*32+12) /* Indirect Branch Prediction Barrier */
#2 lore raw
Quoted 11 lines · Xin Li
Quoted 6 lines · Rik van Riel

Add the definition for the X86_FEATURE_INVLPGB CPUID flag.

Tested by booting a kernel with this change on an AMD Milan system, and making sure the "invlpgb" flag shows up in /proc/cpuinfo

Now there is a need to also update the CPUID database:

https://lore.kernel.org/lkml/87o7642u7w.ffs@tglx/

The invlpgb flag is already in the CPUID database:

https://gitlab.com/x86-cpuid.org/x86-cpuid-db/-/blob/tip/db/xml/leaf_80000008.xml#L53

Signature · 1 line
All Rights Reversed.
maintainer
#3 lore raw
In reply to Rik van Riel
Quoted 4 lines · Rik van Riel

Add the definition for the X86_FEATURE_INVLPGB CPUID flag.

Tested by booting a kernel with this change on an AMD Milan system, and making sure the "invlpgb" flag shows up in /proc/cpuinfo

Why?

Signature · 1 line
Sent from a small device: formatting sucks and brevity is inevitable.
#4 lore raw
Quoted 9 lines · Borislav Petkov
Quoted 4 lines · Rik van Riel

Add the definition for the X86_FEATURE_INVLPGB CPUID flag.

Tested by booting a kernel with this change on an AMD Milan system, and making sure the "invlpgb" flag shows up in /proc/cpuinfo

Why?

I would like to avoid TLB flush IPIs for the top N (maybe 8 or 16?) TLB flushing processes in the system. We can figure out what these processes are by keeping a score of TLB flushes * number of CPUs over some time period.

That seems like something AMD CPUs might be able to do, without running out of PCIDs even on larger systems.

The TLB flush IPIs are taking a considerable amount of compute power across a large fleet, and is something I would like to optimize.

Signature · 1 line
All Rights Reversed.
maintainer
#5 lore raw
Quoted 4 lines · Rik van Riel

I would like to avoid TLB flush IPIs for the top N (maybe 8 or 16?) TLB flushing processes in the system. We can figure out what these processes are by keeping a score of TLB flushes * number of CPUs over some time period.

Documentation/arch/x86/cpuinfo.rst

What does that have to do with showing the flag in /proc/cpuinfo?

Signature · 4 lines
Regards/Gruss,
    Boris.

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