[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 6/6] DO NOT APPLY: Example breakage


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 4 May 2023 20:39:24 +0100
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Thu, 04 May 2023 19:39:40 +0000
  • Ironport-data: A9a23:6OvrB6+gnEOK1t08d7VHDrUD0H6TJUtcMsCJ2f8bNWPcYEJGY0x3y 2QdD2+COPzcZmShc9p+PY3n9k9SupGDz4MwHgVl+yw8E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjUAOG6UKicYXoZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ire7kI+1BjOkGlA5AdmOKgX5AW2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDkkTs thJBmEQXyqv3fOTwLyxYfZRvN0aeZyD0IM34hmMzBncBPciB5vCX7/L9ZlT2zJYasJmRKiEI ZBDMHw2MUqGOkcUUrsUIMtWcOOAr3/zaTBH7nmSorI6+TP7xw1tyrn9dtHSf7RmQO0MxhnJ/ TuYpzqR7hcyK5/HmAS1rC6WgLXQvgb0Q9o/G+aB+as/6LGU7jNKU0BHPbehmtGph0j7V99BJ kg8/is1sbN05EGtVsP6XRCzvDiDpBF0ZjZLO7RkskfXkPOSulvHQDFeFVatdeDKqudrAhh7+ A6UrunFXy1KsLOfYm2gzK6t+Gba1TcuEYMSWcMVZVJbs4K7+dtj0U2nosVLS/Ds0ICscd3k6 3XT9XVl2e1O5SIe///jlW0rlQ5AsXQgouQdwgzMFlyo4QpiDGJOT9z5sAOLhRqswWvwc7Vgg JTns5LEhAz2JcvR/BFhuc1UdF1T296LMSfHnXlkFIQ7+jKm9haLJN4Au2skehswY55fJlcFh XPuVf55vscPbBNGk4cuC25ONyja5fe5Tom0PhwlRtFPfoJwZGe6wc2aXmbJhzqFuBF1wckC1 WKzLZ7E4YAyVf42k1Jbho41jdcW+8zJ7TmOHs6mlU78ieX2ibz8Ye5tDWZip9sRtMusyDg5O f4GXydW432ziNHDXxQ=
  • Ironport-hdrordr: A9a23:n00BHKOCaufrE8BcThWjsMiBIKoaSvp037BL7TEVdfUxSKGlfq +V88jzuSWbtN9pYgBFpTnYAtjmfZq+z+8W3WByB9uftWDd0QPDEGgF1+rfKlXbcBEWndQttp uIHZIfNDUlZWIK9PoT/2GDYqkdKMjuytHPuQ/Bp00dNT2CYZsQkzuQV26gYzZLrBEvP+tCKH KGjvA32gadRQ==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Prior to disentangling X86_NR_FEAT from FEATURESET_NR_ENTRIES, GCC 12
correctly notices:

  lib/x86/cpuid.c: In function 'x86_cpu_policy_to_featureset':
  lib/x86/cpuid.c:82:7: error: array subscript 16 is outside array bounds of 
'uint32_t[16]' {aka 'unsigned int[16]'} [-Werror=array-bounds=]
     82 |     fs[FEATURESET_7a2]       = p->feat._7a2;
        |     ~~^~~~~~~~~~~~~~~~
  lib/x86/cpuid.c:64:42: note: at offset 64 into object 'fs' of size [0, 64]

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/include/xen/lib/x86/cpu-policy.h   | 6 +++++-
 xen/include/xen/lib/x86/cpuid-consts.h | 2 ++
 xen/lib/x86/cpuid.c                    | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/include/xen/lib/x86/cpu-policy.h 
b/xen/include/xen/lib/x86/cpu-policy.h
index 01431de056c8..164b3f4aac13 100644
--- a/xen/include/xen/lib/x86/cpu-policy.h
+++ b/xen/include/xen/lib/x86/cpu-policy.h
@@ -192,7 +192,11 @@ struct cpu_policy
             };
 
             /* Subleaf 2. */
-            uint32_t /* a */:32, /* b */:32, /* c */:32;
+            union {
+                uint32_t _7a2;
+                struct { DECL_BITFIELD(7a2); };
+            };
+            uint32_t /* b */:32, /* c */:32;
             union {
                 uint32_t _7d2;
                 struct { DECL_BITFIELD(7d2); };
diff --git a/xen/include/xen/lib/x86/cpuid-consts.h 
b/xen/include/xen/lib/x86/cpuid-consts.h
index 9fe931b8e31f..5dd9727fec79 100644
--- a/xen/include/xen/lib/x86/cpuid-consts.h
+++ b/xen/include/xen/lib/x86/cpuid-consts.h
@@ -20,8 +20,10 @@
 #define FEATURESET_7d2   13 /* 0x00000007:2.edx    */
 #define FEATURESET_7c1   14 /* 0x00000007:1.ecx    */
 #define FEATURESET_7d1   15 /* 0x00000007:1.edx    */
+#define FEATURESET_7a2   16
 
 #define X86_NR_FEAT (FEATURESET_7d1 + 1)
+//#define X86_NR_FEAT (FEATURESET_7a2 + 1)
 
 #endif /* !XEN_LIB_X86_CONSTS_H */
 
diff --git a/xen/lib/x86/cpuid.c b/xen/lib/x86/cpuid.c
index 76f26e92af8d..90bc82a18c30 100644
--- a/xen/lib/x86/cpuid.c
+++ b/xen/lib/x86/cpuid.c
@@ -79,6 +79,7 @@ void x86_cpu_policy_to_featureset(
     fs[FEATURESET_7d2]       = p->feat._7d2;
     fs[FEATURESET_7c1]       = p->feat._7c1;
     fs[FEATURESET_7d1]       = p->feat._7d1;
+    fs[FEATURESET_7a2]       = p->feat._7a2;
 }
 
 void x86_cpu_featureset_to_policy(
@@ -100,6 +101,7 @@ void x86_cpu_featureset_to_policy(
     p->feat._7d2             = fs[FEATURESET_7d2];
     p->feat._7c1             = fs[FEATURESET_7c1];
     p->feat._7d1             = fs[FEATURESET_7d1];
+    p->feat._7a2             = fs[FEATURESET_7a2];
 }
 
 void x86_cpu_policy_recalc_synth(struct cpu_policy *p)
-- 
2.30.2




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.