Skip to contentSkip to conversation

x86/cpufeatures: make clearcpuid=invlpgb work

PATCH In review Rik van Riel 2 participants 2 messages Jul 29 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/cpufeatures: make clearcpuid=invlpgb work

With the recently found INVLPGB / TLBSYNC issue, there has been some interest in disabling invlpgb TLB flushing, in order to rule out that issue wihle tracking down some userspace crash.

The top search result shows "clearcpuid=invlpgb"

However, invlpgb is not actually in x86_cap_flags, so booting with clearcpuid=invlpgb results in the following message:

clearcpuid: unknown CPU flag: invlpgb

Adding "invlpgb" to the comment after X86_FEATURE_INVLPGB causes mkcapflags.sh to pick up invlpgb, and add it to x86_cap_flags.

With that change, clearcpuid=invlpgb works:

clearcpuid: force-disabling CPU feature flag: invlpgb

---
 arch/x86/include/asm/cpufeatures.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/cpufeatures.h +1 -1
index 1b4a48bff18f..62fa2b0236af 100644
@@ -332,7 +332,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 and TLBSYNC instructions supported */
+#define X86_FEATURE_INVLPGB		(13*32+ 3) /* "invplgb" INVLPGB and TLBSYNC instructions supported */
 #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.54.0
maintainer
#1 lore raw
Quoted 4 lines · Rik van Riel

With the recently found INVLPGB / TLBSYNC issue, there has been some interest in disabling invlpgb TLB flushing, in order to rule out that issue wihle tracking down some userspace crash.

Yeah, except we discourage people from using clearcpuid= because that's a hack.

Let's define a separate cmdline option now, pls, considering this is a valid use case. And because writing it is looong and error prone and the feature name is actually TLBI, we could do simply

tlbi=off

and everyone's happy.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

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