[PATCH 09/32] cpu_map: Group models in index.xml

Jiri Denemark posted 32 patches 2 weeks ago
There is a newer version of this series
[PATCH 09/32] cpu_map: Group models in index.xml
Posted by Jiri Denemark 2 weeks ago
We already visually group the included models according to vendor using
comments. This patch introduces a new <group> element for doing it
properly in a machine friendly way.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/cpu/cpu_map.c     |   2 +-
 src/cpu_map/index.xml | 226 ++++++++++++++++++++++--------------------
 2 files changed, 121 insertions(+), 107 deletions(-)

diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c
index 16795a9a0a..9c405f19bb 100644
--- a/src/cpu/cpu_map.c
+++ b/src/cpu/cpu_map.c
@@ -116,7 +116,7 @@ loadIncludes(xmlXPathContextPtr ctxt,
     int n;
     size_t i;
 
-    n = virXPathNodeSet("include", ctxt, &nodes);
+    n = virXPathNodeSet("include|group[@name|@vendor]/include", ctxt, &nodes);
     if (n < 0)
         return -1;
 
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index 15cb63afe5..2cb97a83ba 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -3,122 +3,136 @@
     <include filename='x86_vendors.xml'/>
     <include filename='x86_features.xml'/>
 
-    <!-- models -->
-    <include filename='x86_486.xml'/>
-
-    <!-- Intel-based QEMU generic CPU models -->
-    <include filename='x86_pentium.xml'/>
-    <include filename='x86_pentium2.xml'/>
-    <include filename='x86_pentium3.xml'/>
-    <include filename='x86_pentiumpro.xml'/>
-    <include filename='x86_coreduo.xml'/>
-    <include filename='x86_n270.xml'/>
-    <include filename='x86_core2duo.xml'/>
-
-    <!-- Generic QEMU CPU models -->
-    <include filename='x86_qemu32.xml'/>
-    <include filename='x86_kvm32.xml'/>
-    <include filename='x86_cpu64-rhel5.xml'/>
-    <include filename='x86_cpu64-rhel6.xml'/>
-    <include filename='x86_qemu64.xml'/>
-    <include filename='x86_kvm64.xml'/>
-
-    <!-- Intel CPU models -->
-    <include filename='x86_Conroe.xml'/>
-    <include filename='x86_Penryn.xml'/>
-    <include filename='x86_Nehalem.xml'/>
-    <include filename='x86_Nehalem-IBRS.xml'/>
-    <include filename='x86_Westmere.xml'/>
-    <include filename='x86_Westmere-IBRS.xml'/>
-    <include filename='x86_SandyBridge.xml'/>
-    <include filename='x86_SandyBridge-IBRS.xml'/>
-    <include filename='x86_IvyBridge.xml'/>
-    <include filename='x86_IvyBridge-IBRS.xml'/>
-    <include filename='x86_Haswell-noTSX.xml'/>
-    <include filename='x86_Haswell-noTSX-IBRS.xml'/>
-    <include filename='x86_Haswell.xml'/>
-    <include filename='x86_Haswell-IBRS.xml'/>
-    <include filename='x86_Broadwell-noTSX.xml'/>
-    <include filename='x86_Broadwell-noTSX-IBRS.xml'/>
-    <include filename='x86_Broadwell.xml'/>
-    <include filename='x86_Broadwell-IBRS.xml'/>
-    <include filename='x86_Skylake-Client.xml'/>
-    <include filename='x86_Skylake-Client-IBRS.xml'/>
-    <include filename='x86_Skylake-Client-noTSX-IBRS.xml'/>
-    <include filename='x86_Skylake-Server.xml'/>
-    <include filename='x86_Skylake-Server-IBRS.xml'/>
-    <include filename='x86_Skylake-Server-noTSX-IBRS.xml'/>
-    <include filename='x86_Cascadelake-Server.xml'/>
-    <include filename='x86_Cascadelake-Server-noTSX.xml'/>
-    <include filename='x86_Icelake-Client.xml'/>
-    <include filename='x86_Icelake-Client-noTSX.xml'/>
-    <include filename='x86_Icelake-Server.xml'/>
-    <include filename='x86_Icelake-Server-noTSX.xml'/>
-    <include filename='x86_Cooperlake.xml'/>
-    <include filename='x86_Snowridge.xml'/>
-    <include filename='x86_SapphireRapids.xml'/>
-    <include filename='x86_GraniteRapids.xml'/>
-    <include filename='x86_SierraForest.xml'/>
-
-    <!-- AMD CPUs -->
-    <include filename='x86_athlon.xml'/>
-    <include filename='x86_phenom.xml'/>
-    <include filename='x86_Opteron_G1.xml'/>
-    <include filename='x86_Opteron_G2.xml'/>
-    <include filename='x86_Opteron_G3.xml'/>
-    <include filename='x86_Opteron_G4.xml'/>
-    <include filename='x86_Opteron_G5.xml'/>
-    <include filename='x86_EPYC.xml'/>
-    <include filename='x86_EPYC-IBPB.xml'/>
-    <include filename='x86_EPYC-Rome.xml'/>
-    <include filename='x86_EPYC-Milan.xml'/>
-    <include filename='x86_EPYC-Genoa.xml'/>
-
-    <!-- Hygon CPU models -->
-    <include filename='x86_Dhyana.xml'/>
+    <group name='generic'>
+      <include filename='x86_486.xml'/>
+    </group>
+
+    <group name='Intel-based QEMU generic CPU models'>
+      <include filename='x86_pentium.xml'/>
+      <include filename='x86_pentium2.xml'/>
+      <include filename='x86_pentium3.xml'/>
+      <include filename='x86_pentiumpro.xml'/>
+      <include filename='x86_coreduo.xml'/>
+      <include filename='x86_n270.xml'/>
+      <include filename='x86_core2duo.xml'/>
+    </group>
+
+    <group name='Generic QEMU CPU models'>
+      <include filename='x86_qemu32.xml'/>
+      <include filename='x86_kvm32.xml'/>
+      <include filename='x86_cpu64-rhel5.xml'/>
+      <include filename='x86_cpu64-rhel6.xml'/>
+      <include filename='x86_qemu64.xml'/>
+      <include filename='x86_kvm64.xml'/>
+    </group>
+
+    <group vendor='Intel'>
+      <include filename='x86_Conroe.xml'/>
+      <include filename='x86_Penryn.xml'/>
+      <include filename='x86_Nehalem.xml'/>
+      <include filename='x86_Nehalem-IBRS.xml'/>
+      <include filename='x86_Westmere.xml'/>
+      <include filename='x86_Westmere-IBRS.xml'/>
+      <include filename='x86_SandyBridge.xml'/>
+      <include filename='x86_SandyBridge-IBRS.xml'/>
+      <include filename='x86_IvyBridge.xml'/>
+      <include filename='x86_IvyBridge-IBRS.xml'/>
+      <include filename='x86_Haswell-noTSX.xml'/>
+      <include filename='x86_Haswell-noTSX-IBRS.xml'/>
+      <include filename='x86_Haswell.xml'/>
+      <include filename='x86_Haswell-IBRS.xml'/>
+      <include filename='x86_Broadwell-noTSX.xml'/>
+      <include filename='x86_Broadwell-noTSX-IBRS.xml'/>
+      <include filename='x86_Broadwell.xml'/>
+      <include filename='x86_Broadwell-IBRS.xml'/>
+      <include filename='x86_Skylake-Client.xml'/>
+      <include filename='x86_Skylake-Client-IBRS.xml'/>
+      <include filename='x86_Skylake-Client-noTSX-IBRS.xml'/>
+      <include filename='x86_Skylake-Server.xml'/>
+      <include filename='x86_Skylake-Server-IBRS.xml'/>
+      <include filename='x86_Skylake-Server-noTSX-IBRS.xml'/>
+      <include filename='x86_Cascadelake-Server.xml'/>
+      <include filename='x86_Cascadelake-Server-noTSX.xml'/>
+      <include filename='x86_Icelake-Client.xml'/>
+      <include filename='x86_Icelake-Client-noTSX.xml'/>
+      <include filename='x86_Icelake-Server.xml'/>
+      <include filename='x86_Icelake-Server-noTSX.xml'/>
+      <include filename='x86_Cooperlake.xml'/>
+      <include filename='x86_Snowridge.xml'/>
+      <include filename='x86_SapphireRapids.xml'/>
+      <include filename='x86_GraniteRapids.xml'/>
+      <include filename='x86_SierraForest.xml'/>
+    </group>
+
+    <group vendor='AMD'>
+      <include filename='x86_athlon.xml'/>
+      <include filename='x86_phenom.xml'/>
+      <include filename='x86_Opteron_G1.xml'/>
+      <include filename='x86_Opteron_G2.xml'/>
+      <include filename='x86_Opteron_G3.xml'/>
+      <include filename='x86_Opteron_G4.xml'/>
+      <include filename='x86_Opteron_G5.xml'/>
+      <include filename='x86_EPYC.xml'/>
+      <include filename='x86_EPYC-IBPB.xml'/>
+      <include filename='x86_EPYC-Rome.xml'/>
+      <include filename='x86_EPYC-Milan.xml'/>
+      <include filename='x86_EPYC-Genoa.xml'/>
+    </group>
+
+    <group vendor='Hygon'>
+      <include filename='x86_Dhyana.xml'/>
+    </group>
   </arch>
 
   <arch name='ppc64'>
     <include filename='ppc64_vendors.xml'/>
 
-    <!-- IBM-based CPU models -->
-    <include filename='ppc64_POWER6.xml'/>
-    <include filename='ppc64_POWER7.xml'/>
-    <include filename='ppc64_POWER8.xml'/>
-    <include filename='ppc64_POWER9.xml'/>
-    <include filename='ppc64_POWER10.xml'/>
-
-    <!-- Freescale-based CPU models -->
-    <include filename='ppc64_POWERPC_e5500.xml'/>
-    <include filename='ppc64_POWERPC_e6500.xml'/>
+    <group name='IBM-based CPU models'>
+      <include filename='ppc64_POWER6.xml'/>
+      <include filename='ppc64_POWER7.xml'/>
+      <include filename='ppc64_POWER8.xml'/>
+      <include filename='ppc64_POWER9.xml'/>
+      <include filename='ppc64_POWER10.xml'/>
+    </group>
+
+    <group name='Freescale-based CPU models'>
+      <include filename='ppc64_POWERPC_e5500.xml'/>
+      <include filename='ppc64_POWERPC_e6500.xml'/>
+    </group>
   </arch>
 
   <arch name='arm'>
     <include filename='arm_vendors.xml'/>
     <include filename='arm_features.xml'/>
 
-    <!-- ARM-based CPU models -->
-    <include filename='arm_cortex-a53.xml'/>
-    <include filename='arm_cortex-a57.xml'/>
-    <include filename='arm_cortex-a72.xml'/>
-    <include filename='arm_Neoverse-N1.xml'/>
-    <include filename='arm_Neoverse-N2.xml'/>
-    <include filename='arm_Neoverse-V1.xml'/>
-
-    <!-- Qualcomm-based CPU models -->
-    <include filename='arm_Falkor.xml'/>
-
-    <!-- Cavium-based CPU models -->
-    <include filename='arm_ThunderX299xx.xml'/>
-
-    <!-- Fujitsu-based CPU models -->
-    <include filename='arm_a64fx.xml'/>
-
-    <!-- Hisilicon-based CPU models -->
-    <include filename='arm_Kunpeng-920.xml'/>
-
-    <!-- Phytium-based CPU models -->
-    <include filename='arm_FT-2000plus.xml'/>
-    <include filename='arm_Tengyun-S2500.xml'/>
+    <group name='ARM-based CPU models'>
+      <include filename='arm_cortex-a53.xml'/>
+      <include filename='arm_cortex-a57.xml'/>
+      <include filename='arm_cortex-a72.xml'/>
+      <include filename='arm_Neoverse-N1.xml'/>
+      <include filename='arm_Neoverse-N2.xml'/>
+      <include filename='arm_Neoverse-V1.xml'/>
+    </group>
+
+    <group name='Qualcomm-based CPU models'>
+      <include filename='arm_Falkor.xml'/>
+    </group>
+
+    <group name='Cavium-based CPU models'>
+      <include filename='arm_ThunderX299xx.xml'/>
+    </group>
+
+    <group name='Fujitsu-based CPU models'>
+      <include filename='arm_a64fx.xml'/>
+    </group>
+
+    <group name='Hisilicon-based CPU models'>
+      <include filename='arm_Kunpeng-920.xml'/>
+    </group>
+
+    <group name='Phytium-based CPU models'>
+      <include filename='arm_FT-2000plus.xml'/>
+      <include filename='arm_Tengyun-S2500.xml'/>
+    </group>
   </arch>
 </cpus>
-- 
2.47.0
Re: [PATCH 09/32] cpu_map: Group models in index.xml
Posted by Daniel P. Berrangé 1 week, 6 days ago
On Tue, Nov 19, 2024 at 07:49:45PM +0100, Jiri Denemark wrote:
> We already visually group the included models according to vendor using
> comments. This patch introduces a new <group> element for doing it
> properly in a machine friendly way.

AFAICT the <group> has no functional effect

> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  src/cpu/cpu_map.c     |   2 +-
>  src/cpu_map/index.xml | 226 ++++++++++++++++++++++--------------------
>  2 files changed, 121 insertions(+), 107 deletions(-)

> diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
> index 15cb63afe5..2cb97a83ba 100644
> --- a/src/cpu_map/index.xml
> +++ b/src/cpu_map/index.xml
> @@ -3,122 +3,136 @@
>      <include filename='x86_vendors.xml'/>
>      <include filename='x86_features.xml'/>

> +
> +    <group name='Intel-based QEMU generic CPU models'>
> +      <include filename='x86_pentium.xml'/>
> +      <include filename='x86_pentium2.xml'/>
> +      <include filename='x86_pentium3.xml'/>
> +      <include filename='x86_pentiumpro.xml'/>
> +      <include filename='x86_coreduo.xml'/>
> +      <include filename='x86_n270.xml'/>
> +      <include filename='x86_core2duo.xml'/>
> +    </group>
> +
> +    <group name='Generic QEMU CPU models'>
> +      <include filename='x86_qemu32.xml'/>
> +      <include filename='x86_kvm32.xml'/>
> +      <include filename='x86_cpu64-rhel5.xml'/>
> +      <include filename='x86_cpu64-rhel6.xml'/>
> +      <include filename='x86_qemu64.xml'/>
> +      <include filename='x86_kvm64.xml'/>
> +    </group>
> +
> +    <group vendor='Intel'>

In some cases youve used 'name' and some 'vendor', which seems
fairly arbitrary, but I guess we're ignoring this attrbiute
entirely.

Still all the CPUs above have either 'Intel' or 'AMD' set
as their vendor in QEMU, so separating them off feels a
bit odd.

If we're just going to group everything based on vendor,
why not just call the tag <vendor name=...> ?

> +      <include filename='x86_Conroe.xml'/>
> +      <include filename='x86_Penryn.xml'/>
> +      <include filename='x86_Nehalem.xml'/>
> +      <include filename='x86_Nehalem-IBRS.xml'/>
> +      <include filename='x86_Westmere.xml'/>
> +      <include filename='x86_Westmere-IBRS.xml'/>
> +      <include filename='x86_SandyBridge.xml'/>
> +      <include filename='x86_SandyBridge-IBRS.xml'/>
> +      <include filename='x86_IvyBridge.xml'/>
> +      <include filename='x86_IvyBridge-IBRS.xml'/>
> +      <include filename='x86_Haswell-noTSX.xml'/>
> +      <include filename='x86_Haswell-noTSX-IBRS.xml'/>
> +      <include filename='x86_Haswell.xml'/>
> +      <include filename='x86_Haswell-IBRS.xml'/>
> +      <include filename='x86_Broadwell-noTSX.xml'/>
> +      <include filename='x86_Broadwell-noTSX-IBRS.xml'/>
> +      <include filename='x86_Broadwell.xml'/>
> +      <include filename='x86_Broadwell-IBRS.xml'/>
> +      <include filename='x86_Skylake-Client.xml'/>
> +      <include filename='x86_Skylake-Client-IBRS.xml'/>
> +      <include filename='x86_Skylake-Client-noTSX-IBRS.xml'/>
> +      <include filename='x86_Skylake-Server.xml'/>
> +      <include filename='x86_Skylake-Server-IBRS.xml'/>
> +      <include filename='x86_Skylake-Server-noTSX-IBRS.xml'/>
> +      <include filename='x86_Cascadelake-Server.xml'/>
> +      <include filename='x86_Cascadelake-Server-noTSX.xml'/>
> +      <include filename='x86_Icelake-Client.xml'/>
> +      <include filename='x86_Icelake-Client-noTSX.xml'/>
> +      <include filename='x86_Icelake-Server.xml'/>
> +      <include filename='x86_Icelake-Server-noTSX.xml'/>
> +      <include filename='x86_Cooperlake.xml'/>
> +      <include filename='x86_Snowridge.xml'/>
> +      <include filename='x86_SapphireRapids.xml'/>
> +      <include filename='x86_GraniteRapids.xml'/>
> +      <include filename='x86_SierraForest.xml'/>
> +    </group>
> +
> +    <group vendor='AMD'>
> +      <include filename='x86_athlon.xml'/>
> +      <include filename='x86_phenom.xml'/>
> +      <include filename='x86_Opteron_G1.xml'/>
> +      <include filename='x86_Opteron_G2.xml'/>
> +      <include filename='x86_Opteron_G3.xml'/>
> +      <include filename='x86_Opteron_G4.xml'/>
> +      <include filename='x86_Opteron_G5.xml'/>
> +      <include filename='x86_EPYC.xml'/>
> +      <include filename='x86_EPYC-IBPB.xml'/>
> +      <include filename='x86_EPYC-Rome.xml'/>
> +      <include filename='x86_EPYC-Milan.xml'/>
> +      <include filename='x86_EPYC-Genoa.xml'/>
> +    </group>
> +
> +    <group vendor='Hygon'>
> +      <include filename='x86_Dhyana.xml'/>
> +    </group>
>    </arch>
>  
>    <arch name='ppc64'>
>      <include filename='ppc64_vendors.xml'/>
>  
> -    <!-- IBM-based CPU models -->
> -    <include filename='ppc64_POWER6.xml'/>
> -    <include filename='ppc64_POWER7.xml'/>
> -    <include filename='ppc64_POWER8.xml'/>
> -    <include filename='ppc64_POWER9.xml'/>
> -    <include filename='ppc64_POWER10.xml'/>
> -
> -    <!-- Freescale-based CPU models -->
> -    <include filename='ppc64_POWERPC_e5500.xml'/>
> -    <include filename='ppc64_POWERPC_e6500.xml'/>
> +    <group name='IBM-based CPU models'>
> +      <include filename='ppc64_POWER6.xml'/>
> +      <include filename='ppc64_POWER7.xml'/>
> +      <include filename='ppc64_POWER8.xml'/>
> +      <include filename='ppc64_POWER9.xml'/>
> +      <include filename='ppc64_POWER10.xml'/>
> +    </group>
> +
> +    <group name='Freescale-based CPU models'>
> +      <include filename='ppc64_POWERPC_e5500.xml'/>
> +      <include filename='ppc64_POWERPC_e6500.xml'/>
> +    </group>
>    </arch>
>  
>    <arch name='arm'>
>      <include filename='arm_vendors.xml'/>
>      <include filename='arm_features.xml'/>
>  
> -    <!-- ARM-based CPU models -->
> -    <include filename='arm_cortex-a53.xml'/>
> -    <include filename='arm_cortex-a57.xml'/>
> -    <include filename='arm_cortex-a72.xml'/>
> -    <include filename='arm_Neoverse-N1.xml'/>
> -    <include filename='arm_Neoverse-N2.xml'/>
> -    <include filename='arm_Neoverse-V1.xml'/>
> -
> -    <!-- Qualcomm-based CPU models -->
> -    <include filename='arm_Falkor.xml'/>
> -
> -    <!-- Cavium-based CPU models -->
> -    <include filename='arm_ThunderX299xx.xml'/>
> -
> -    <!-- Fujitsu-based CPU models -->
> -    <include filename='arm_a64fx.xml'/>
> -
> -    <!-- Hisilicon-based CPU models -->
> -    <include filename='arm_Kunpeng-920.xml'/>
> -
> -    <!-- Phytium-based CPU models -->
> -    <include filename='arm_FT-2000plus.xml'/>
> -    <include filename='arm_Tengyun-S2500.xml'/>
> +    <group name='ARM-based CPU models'>
> +      <include filename='arm_cortex-a53.xml'/>
> +      <include filename='arm_cortex-a57.xml'/>
> +      <include filename='arm_cortex-a72.xml'/>
> +      <include filename='arm_Neoverse-N1.xml'/>
> +      <include filename='arm_Neoverse-N2.xml'/>
> +      <include filename='arm_Neoverse-V1.xml'/>
> +    </group>
> +
> +    <group name='Qualcomm-based CPU models'>
> +      <include filename='arm_Falkor.xml'/>
> +    </group>
> +
> +    <group name='Cavium-based CPU models'>
> +      <include filename='arm_ThunderX299xx.xml'/>
> +    </group>
> +
> +    <group name='Fujitsu-based CPU models'>
> +      <include filename='arm_a64fx.xml'/>
> +    </group>
> +
> +    <group name='Hisilicon-based CPU models'>
> +      <include filename='arm_Kunpeng-920.xml'/>
> +    </group>
> +
> +    <group name='Phytium-based CPU models'>
> +      <include filename='arm_FT-2000plus.xml'/>
> +      <include filename='arm_Tengyun-S2500.xml'/>
> +    </group>
>    </arch>
>  </cpus>
> -- 
> 2.47.0
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Re: [PATCH 09/32] cpu_map: Group models in index.xml
Posted by Jiri Denemark 1 week, 5 days ago
On Wed, Nov 20, 2024 at 12:11:19 +0000, Daniel P. Berrangé wrote:
> On Tue, Nov 19, 2024 at 07:49:45PM +0100, Jiri Denemark wrote:
> > We already visually group the included models according to vendor using
> > comments. This patch introduces a new <group> element for doing it
> > properly in a machine friendly way.
> 
> AFAICT the <group> has no functional effect

I added it so the following commit can automatically add new CPU models
in the right place. So yes, no functional effect for the CPU map itself.

> 
> > 
> > Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> > ---
> >  src/cpu/cpu_map.c     |   2 +-
> >  src/cpu_map/index.xml | 226 ++++++++++++++++++++++--------------------
> >  2 files changed, 121 insertions(+), 107 deletions(-)
> 
> > diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
> > index 15cb63afe5..2cb97a83ba 100644
> > --- a/src/cpu_map/index.xml
> > +++ b/src/cpu_map/index.xml
> > @@ -3,122 +3,136 @@
> >      <include filename='x86_vendors.xml'/>
> >      <include filename='x86_features.xml'/>
> 
> > +
> > +    <group name='Intel-based QEMU generic CPU models'>
> > +      <include filename='x86_pentium.xml'/>
> > +      <include filename='x86_pentium2.xml'/>
> > +      <include filename='x86_pentium3.xml'/>
> > +      <include filename='x86_pentiumpro.xml'/>
> > +      <include filename='x86_coreduo.xml'/>
> > +      <include filename='x86_n270.xml'/>
> > +      <include filename='x86_core2duo.xml'/>
> > +    </group>
> > +
> > +    <group name='Generic QEMU CPU models'>
> > +      <include filename='x86_qemu32.xml'/>
> > +      <include filename='x86_kvm32.xml'/>
> > +      <include filename='x86_cpu64-rhel5.xml'/>
> > +      <include filename='x86_cpu64-rhel6.xml'/>
> > +      <include filename='x86_qemu64.xml'/>
> > +      <include filename='x86_kvm64.xml'/>
> > +    </group>
> > +
> > +    <group vendor='Intel'>
> 
> In some cases youve used 'name' and some 'vendor', which seems
> fairly arbitrary, but I guess we're ignoring this attrbiute
> entirely.
> 
> Still all the CPUs above have either 'Intel' or 'AMD' set
> as their vendor in QEMU, so separating them off feels a
> bit odd.

Yes, it's completely arbitrary. I basically just changed the comments
into <group name='the text of the comment'/>, with the exception of a
few groups to which the script is going to add new models. I agree it's
odd, but after playing with XPath and trying to come up with a way to
use the existing comments to detect where new models should be added
this solution looked very clean and nice :-) I guess I could also go
with just <group name='the text of the comment'/> in all cases for
consistency.

BTW, the XPath way almost works as you can really reference a comment in
the document and even match its content. I just didn't find a way to
select a node that is after a specific comment, but before another
comment. Which I guess is a good thing as it was pretty disgusting :-)

> If we're just going to group everything based on vendor,
> why not just call the tag <vendor name=...> ?

We can't use just vendor because some models (the old ones) don't have a
vendor. We could perhaps use something like vendor='generic',
vendor='QEMU' or something similar, although using the complete text
from the comment makes reading a bit easier for people.

Jirka
Re: [PATCH 09/32] cpu_map: Group models in index.xml
Posted by Daniel P. Berrangé 1 week, 5 days ago
On Thu, Nov 21, 2024 at 02:35:34PM +0100, Jiri Denemark wrote:
> On Wed, Nov 20, 2024 at 12:11:19 +0000, Daniel P. Berrangé wrote:
> > On Tue, Nov 19, 2024 at 07:49:45PM +0100, Jiri Denemark wrote:
> > > We already visually group the included models according to vendor using
> > > comments. This patch introduces a new <group> element for doing it
> > > properly in a machine friendly way.
> > 
> > AFAICT the <group> has no functional effect

> 
> > If we're just going to group everything based on vendor,
> > why not just call the tag <vendor name=...> ?
> 
> We can't use just vendor because some models (the old ones) don't have a
> vendor. We could perhaps use something like vendor='generic',
> vendor='QEMU' or something similar, although using the complete text
> from the comment makes reading a bit easier for people.

From QEMU's POV every model has a vendor.

Looking at these:

+    <group name='generic'>
+      <include filename='x86_486.xml'/>
+    </group>

This is an Intel model

+
+    <group name='Intel-based QEMU generic CPU models'>
+      <include filename='x86_pentium.xml'/>
+      <include filename='x86_pentium2.xml'/>
+      <include filename='x86_pentium3.xml'/>
+      <include filename='x86_pentiumpro.xml'/>
+      <include filename='x86_coreduo.xml'/>
+      <include filename='x86_n270.xml'/>
+      <include filename='x86_core2duo.xml'/>
+    </group>

and these are all intel models.

I'd expect all of these to be under the main Intel
vendor block.


+
+    <group name='Generic QEMU CPU models'>
+      <include filename='x86_qemu32.xml'/>
+      <include filename='x86_kvm32.xml'/>
+      <include filename='x86_cpu64-rhel5.xml'/>
+      <include filename='x86_cpu64-rhel6.xml'/>
+      <include filename='x86_qemu64.xml'/>
+      <include filename='x86_kvm64.xml'/>
+    </group>

These names don't directly correspond to a specific physical piece of
silicon shipped by a vendor, but QEMU does tag them with a vendor
internally, either intel or amd.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Re: [PATCH 09/32] cpu_map: Group models in index.xml
Posted by Jiri Denemark 1 week, 5 days ago
On Thu, Nov 21, 2024 at 14:02:22 +0000, Daniel P. Berrangé wrote:
> On Thu, Nov 21, 2024 at 02:35:34PM +0100, Jiri Denemark wrote:
> > On Wed, Nov 20, 2024 at 12:11:19 +0000, Daniel P. Berrangé wrote:
> > > On Tue, Nov 19, 2024 at 07:49:45PM +0100, Jiri Denemark wrote:
> > > > We already visually group the included models according to vendor using
> > > > comments. This patch introduces a new <group> element for doing it
> > > > properly in a machine friendly way.
> > > 
> > > AFAICT the <group> has no functional effect
> 
> > 
> > > If we're just going to group everything based on vendor,
> > > why not just call the tag <vendor name=...> ?
> > 
> > We can't use just vendor because some models (the old ones) don't have a
> > vendor. We could perhaps use something like vendor='generic',
> > vendor='QEMU' or something similar, although using the complete text
> > from the comment makes reading a bit easier for people.
> 
> From QEMU's POV every model has a vendor.

Yeah, I was talking about our POV. Also the point of this patch was not
really to change grouping, just mark the groups in some way the script
can properly recognize them. I think the current groups are good enough.

Jirka