Skip to contentSkip to conversation

x86/cpuid: Drop special_features[]

PATCH In review Andrew Cooper 2 participants 5 messages Jun 7, 2021 – Jun 8, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/cpuid: Drop special_features[]

While the ! annotation is useful to indicate that something special is happening, an array of bits is not. Drop it, to prevent mistakes.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

---
 xen/arch/x86/cpuid.c        | 2 --
 xen/include/asm-x86/cpuid.h | 1 -
 xen/tools/gen-cpuid.py      | 3 ---
 3 files changed, 6 deletions(-)
xen/arch/x86/cpuid.c +0 -2
index 958caf35da..2079a30ae4 100644
@@ -14,7 +14,6 @@
 #include <asm/xstate.h>
 
 const uint32_t known_features[] = INIT_KNOWN_FEATURES;
-const uint32_t special_features[] = INIT_SPECIAL_FEATURES;
 
 static const uint32_t __initconst pv_max_featuremask[] = INIT_PV_MAX_FEATURES;
 static const uint32_t hvm_shadow_max_featuremask[] = INIT_HVM_SHADOW_MAX_FEATURES;
@@ -1132,7 +1131,6 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
 static void __init __maybe_unused build_assertions(void)
 {
     BUILD_BUG_ON(ARRAY_SIZE(known_features) != FSCAPINTS);
-    BUILD_BUG_ON(ARRAY_SIZE(special_features) != FSCAPINTS);
     BUILD_BUG_ON(ARRAY_SIZE(pv_max_featuremask) != FSCAPINTS);
     BUILD_BUG_ON(ARRAY_SIZE(hvm_shadow_max_featuremask) != FSCAPINTS);
     BUILD_BUG_ON(ARRAY_SIZE(hvm_hap_max_featuremask) != FSCAPINTS);
xen/include/asm-x86/cpuid.h +0 -1
index 7baf6c9628..46904061d0 100644
@@ -14,7 +14,6 @@
 #include <public/sysctl.h>
 
 extern const uint32_t known_features[FSCAPINTS];
-extern const uint32_t special_features[FSCAPINTS];
 
 void init_guest_cpuid(void);
 
xen/tools/gen-cpuid.py +0 -3
index b953648b65..c6b5056a8d 100755
@@ -362,8 +362,6 @@ def write_results(state):
 
 #define INIT_KNOWN_FEATURES { \\\n%s\n}
 
-#define INIT_SPECIAL_FEATURES { \\\n%s\n}
-
 #define INIT_PV_DEF_FEATURES { \\\n%s\n}
 
 #define INIT_PV_MAX_FEATURES { \\\n%s\n}
@@ -384,7 +382,6 @@ def write_results(state):
 """ % (state.nr_entries,
        next(featureset_to_uint32s(state.common_1d, 1)),
        format_uint32s(state, state.names.keys(), 4),
-       format_uint32s(state, state.raw['!'], 4),
        format_uint32s(state, state.pv_def, 4),
        format_uint32s(state, state.pv_max, 4),
        format_uint32s(state, state.hvm_shadow_def, 4),
Signature · 1 line
2.11.0
#2 lore raw
In reply to Andrew Cooper
Quoted 8 lines · Andrew Cooper

While the ! annotation is useful to indicate that something special is happening, an array of bits is not. Drop it, to prevent mistakes.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

Quoted 5 lines
---
 xen/arch/x86/cpuid.c        | 2 --
 xen/include/asm-x86/cpuid.h | 1 -
 xen/tools/gen-cpuid.py      | 3 ---
 3 files changed, 6 deletions(-)

As osstest points out this didn't go quite far enough, or too far:
Either XC_FEATUREMASK_SPECIAL also needs dropping (including its uses in libxenguest and xen-cpuid) or, considering exposing this information via xen-cpuid isn't entirely without purpose, the script part of the original change needs undoing or making conditional e.g. upon __XEN__.

Jan

#3 lore raw
Quoted 14 lines · Jan Beulich
Quoted 8 lines · Andrew Cooper

While the ! annotation is useful to indicate that something special is happening, an array of bits is not. Drop it, to prevent mistakes.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

Quoted 5 lines
---
 xen/arch/x86/cpuid.c        | 2 --
 xen/include/asm-x86/cpuid.h | 1 -
 xen/tools/gen-cpuid.py      | 3 ---
 3 files changed, 6 deletions(-)
Quoted 6 lines

As osstest points out this didn't go quite far enough, or too far:
Either XC_FEATUREMASK_SPECIAL also needs dropping (including its uses in libxenguest and xen-cpuid) or, considering exposing this information via xen-cpuid isn't entirely without purpose, the script part of the original change needs undoing or making conditional e.g. upon __XEN__.

Yes - Gitlab CI didn't spot, because there is a different breakage from PV32 blocking things.

I think I'll reinstate the gen-cpuid.py hunks because having xen-cpuid print out the bits when asked is helpful.

~Andrew

#4 lore raw
Quoted 22 lines · Andrew Cooper
Quoted 14 lines · Jan Beulich
Quoted 8 lines · Andrew Cooper

While the ! annotation is useful to indicate that something special is happening, an array of bits is not. Drop it, to prevent mistakes.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

Quoted 5 lines
---
 xen/arch/x86/cpuid.c        | 2 --
 xen/include/asm-x86/cpuid.h | 1 -
 xen/tools/gen-cpuid.py      | 3 ---
 3 files changed, 6 deletions(-)
Quoted 6 lines

As osstest points out this didn't go quite far enough, or too far:
Either XC_FEATUREMASK_SPECIAL also needs dropping (including its uses in libxenguest and xen-cpuid) or, considering exposing this information via xen-cpuid isn't entirely without purpose, the script part of the original change needs undoing or making conditional e.g. upon __XEN__.

Quoted 2 lines

Yes - Gitlab CI didn't spot, because there is a different breakage from PV32 blocking things.

Oh, what further problem do we have? What I can see there (picking a random build log) is the failure from the change here ...

Quoted 2 lines

I think I'll reinstate the gen-cpuid.py hunks because having xen-cpuid print out the bits when asked is helpful.

And maybe put the #define inside "#ifndef __XEN__" then?

Jan