Skip to contentSkip to conversation

x86: hide MWAITX from PV domains

PATCH In review Jan Beulich 2 participants 3 messages Oct 13, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: hide MWAITX from PV domains

Since MWAIT is hidden too. (Linux starting with 4.3 is making use of that feature, and is checking for it without looking at the MWAIT one.)

xen/arch/x86/traps.c +1 -0
@@ -964,6 +964,7 @@ void pv_cpuid(struct cpu_user_regs *regs
         __clear_bit(X86_FEATURE_LWP % 32, &c);
         __clear_bit(X86_FEATURE_NODEID_MSR % 32, &c);
         __clear_bit(X86_FEATURE_TOPOEXT % 32, &c);
+        __clear_bit(X86_FEATURE_MWAITX % 32, &c);
         break;
 
     case 0x0000000a: /* Architectural Performance Monitor Features (Intel) */
xen/include/asm-x86/cpufeature.h +1 -0
@@ -140,6 +140,7 @@
 #define X86_FEATURE_TBM         (6*32+21) /* trailing bit manipulations */
 #define X86_FEATURE_TOPOEXT     (6*32+22) /* topology extensions CPUID leafs */
 #define X86_FEATURE_DBEXT       (6*32+26) /* data breakpoint extension */
+#define X86_FEATURE_MWAITX      (6*32+29) /* MWAIT extension (MONITORX/MWAITX) */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 7 */
 #define X86_FEATURE_FSGSBASE	(7*32+ 0) /* {RD,WR}{FS,GS}BASE instructions */
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Jan Beulich

Since MWAIT is hidden too. (Linux starting with 4.3 is making use of that feature, and is checking for it without looking at the MWAIT one.)

This is surely a Linux bug which wants fixing as well?

Quoted 2 lines
Quoted 24 lines
xen/arch/x86/traps.c +1 -0
@@ -964,6 +964,7 @@ void pv_cpuid(struct cpu_user_regs *regs
         __clear_bit(X86_FEATURE_LWP % 32, &c);
         __clear_bit(X86_FEATURE_NODEID_MSR % 32, &c);
         __clear_bit(X86_FEATURE_TOPOEXT % 32, &c);
+        __clear_bit(X86_FEATURE_MWAITX % 32, &c);
         break;
 
     case 0x0000000a: /* Architectural Performance Monitor Features (Intel) */
xen/include/asm-x86/cpufeature.h +1 -0
@@ -140,6 +140,7 @@
 #define X86_FEATURE_TBM         (6*32+21) /* trailing bit manipulations */
 #define X86_FEATURE_TOPOEXT     (6*32+22) /* topology extensions CPUID leafs */
 #define X86_FEATURE_DBEXT       (6*32+26) /* data breakpoint extension */
+#define X86_FEATURE_MWAITX      (6*32+29) /* MWAIT extension (MONITORX/MWAITX) */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 7 */
 #define X86_FEATURE_FSGSBASE	(7*32+ 0) /* {RD,WR}{FS,GS}BASE instructions */
#2 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 13.10.15 at 15:15, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich

Since MWAIT is hidden too. (Linux starting with 4.3 is making use of that feature, and is checking for it without looking at the MWAIT one.)

This is surely a Linux bug which wants fixing as well?

I don't think that's a bug - I cannot see it being invalid to have MWAITX but not MWAIT. That's just pretty unlikely.

Jan