Skip to contentSkip to conversation

spapr/kvm: Set default cpu model for all machine classes

PATCH In review David Gibson 7 participants 16 messages Oct 30, 2019 – Nov 15, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spapr/kvm: Set default cpu model for all machine classes

We have to set the default model of all machine classes, not just for the active one. Otherwise, "query-machines" will indicate the wrong CPU model ("qemu-s390x-cpu" instead of "host-s390x-cpu") as "default-cpu-type".

s390x already fixed this in de60a92e "s390x/kvm: Set default cpu model for all machine classes". This patch applies a similar fix for the pseries-* machine types on ppc64.

Doing a

    {"execute":"query-machines"}
under KVM now results in
    {
      "hotpluggable-cpus": true,
      "name": "pseries-4.2",
      "numa-mem-supported": true,
      "default-cpu-type": "host-powerpc64-cpu",
      "is-default": true,
      "cpu-max": 1024,
      "deprecated": false,
      "alias": "pseries"
    },
    {
      "hotpluggable-cpus": true,
      "name": "pseries-4.1",
      "numa-mem-supported": true,
      "default-cpu-type": "host-powerpc64-cpu",
      "cpu-max": 1024,
      "deprecated": false
    },
    ...

Libvirt probes all machines via "-machine none,accel=kvm:tcg" and will currently see the wrong CPU model under KVM.

Cc David Hildenbrand <[email protected]>
Cc Igor Mammedov <[email protected]>
---
 target/ppc/kvm.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
target/ppc/kvm.c +13 -8
index 7d2e8969ac..c77f9848ec 100644
@@ -100,7 +100,7 @@ static bool kvmppc_is_pr(KVMState *ks)
     return kvm_vm_check_extension(ks, KVM_CAP_PPC_GET_PVINFO) != 0;
 }
 
-static int kvm_ppc_register_host_cpu_type(MachineState *ms);
+static int kvm_ppc_register_host_cpu_type(void);
 static void kvmppc_get_cpu_characteristics(KVMState *s);
 static int kvmppc_get_dec_bits(void);
 
@@ -147,7 +147,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
         exit(1);
     }
 
-    kvm_ppc_register_host_cpu_type(ms);
+    kvm_ppc_register_host_cpu_type();
 
     return 0;
 }
@@ -2534,13 +2534,19 @@ PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
     return pvr_pcc;
 }
 
-static int kvm_ppc_register_host_cpu_type(MachineState *ms)
+static void pseries_machine_class_fixup(ObjectClass *oc, void *opaque)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->default_cpu_type = TYPE_HOST_POWERPC_CPU;
+}
+
+static int kvm_ppc_register_host_cpu_type(void)
 {
     TypeInfo type_info = {
         .name = TYPE_HOST_POWERPC_CPU,
         .class_init = kvmppc_host_cpu_class_init,
     };
-    MachineClass *mc = MACHINE_GET_CLASS(ms);
     PowerPCCPUClass *pvr_pcc;
     ObjectClass *oc;
     DeviceClass *dc;
@@ -2552,10 +2558,9 @@ static int kvm_ppc_register_host_cpu_type(MachineState *ms)
     }
     type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
     type_register(&type_info);
-    if (object_dynamic_cast(OBJECT(ms), TYPE_SPAPR_MACHINE)) {
-        /* override TCG default cpu type with 'host' cpu model */
-        mc->default_cpu_type = TYPE_HOST_POWERPC_CPU;
-    }
+    /* override TCG default cpu type with 'host' cpu model */
+    object_class_foreach(pseries_machine_class_fixup, TYPE_SPAPR_MACHINE,
+                         false, NULL);
 
     oc = object_class_by_name(type_info.name);
     g_assert(oc);
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · David Gibson

We have to set the default model of all machine classes, not just for the active one. Otherwise, "query-machines" will indicate the wrong CPU model ("qemu-s390x-cpu" instead of "host-s390x-cpu") as "default-cpu-type".

Maybe use ppc CPU models here instead of s390x ones :)

Quoted 87 lines

s390x already fixed this in de60a92e "s390x/kvm: Set default cpu model for all machine classes". This patch applies a similar fix for the pseries-* machine types on ppc64.

Doing a

     {"execute":"query-machines"}
under KVM now results in
     {
       "hotpluggable-cpus": true,
       "name": "pseries-4.2",
       "numa-mem-supported": true,
       "default-cpu-type": "host-powerpc64-cpu",
       "is-default": true,
       "cpu-max": 1024,
       "deprecated": false,
       "alias": "pseries"
     },
     {
       "hotpluggable-cpus": true,
       "name": "pseries-4.1",
       "numa-mem-supported": true,
       "default-cpu-type": "host-powerpc64-cpu",
       "cpu-max": 1024,
       "deprecated": false
     },
     ...

Libvirt probes all machines via "-machine none,accel=kvm:tcg" and will currently see the wrong CPU model under KVM.

Cc David Hildenbrand <[email protected]>
Cc Igor Mammedov <[email protected]>
---
  target/ppc/kvm.c | 21 +++++++++++++--------
  1 file changed, 13 insertions(+), 8 deletions(-)
target/ppc/kvm.c +10 -4
index 7d2e8969ac..c77f9848ec 100644
@@ -100,7 +100,7 @@ static bool kvmppc_is_pr(KVMState *ks)
      return kvm_vm_check_extension(ks, KVM_CAP_PPC_GET_PVINFO) != 0;
  }
 
-static int kvm_ppc_register_host_cpu_type(MachineState *ms);
+static int kvm_ppc_register_host_cpu_type(void);
  static void kvmppc_get_cpu_characteristics(KVMState *s);
  static int kvmppc_get_dec_bits(void);
 
@@ -147,7 +147,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
          exit(1);
      }
 
-    kvm_ppc_register_host_cpu_type(ms);
+    kvm_ppc_register_host_cpu_type();
 
      return 0;
  }
@@ -2534,13 +2534,19 @@ PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
      return pvr_pcc;
  }
 
-static int kvm_ppc_register_host_cpu_type(MachineState *ms)
+static void pseries_machine_class_fixup(ObjectClass *oc, void *opaque)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->default_cpu_type = TYPE_HOST_POWERPC_CPU;
+}
+
+static int kvm_ppc_register_host_cpu_type(void)
  {
      TypeInfo type_info = {
          .name = TYPE_HOST_POWERPC_CPU,
          .class_init = kvmppc_host_cpu_class_init,
      };
-    MachineClass *mc = MACHINE_GET_CLASS(ms);
      PowerPCCPUClass *pvr_pcc;
      ObjectClass *oc;
      DeviceClass *dc;
@@ -2552,10 +2558,9 @@ static int kvm_ppc_register_host_cpu_type(MachineState *ms)
      }
      type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
      type_register(&type_info);

target/ppc/kvm.c static int kvm_ppc_register_host_cpu_type(MachineState *ms) · line 2566

Quoted 10 lines
target/ppc/kvm.c +3 -4
-    if (object_dynamic_cast(OBJECT(ms), TYPE_SPAPR_MACHINE)) {
-        /* override TCG default cpu type with 'host' cpu model */
-        mc->default_cpu_type = TYPE_HOST_POWERPC_CPU;
-    }
+    /* override TCG default cpu type with 'host' cpu model */
+    object_class_foreach(pseries_machine_class_fixup, TYPE_SPAPR_MACHINE,
+                         false, NULL);
 
      oc = object_class_by_name(type_info.name);
      g_assert(oc);
Signature · 3 lines
Thanks,

David / dhildenb
#2 lore raw
Quoted 6 lines · David Hildenbrand
Quoted 3 lines · David Gibson

We have to set the default model of all machine classes, not just for the active one. Otherwise, "query-machines" will indicate the wrong CPU model ("qemu-s390x-cpu" instead of "host-s390x-cpu") as "default-cpu-type".

Maybe use ppc CPU models here instead of s390x ones :)

Oops, thanks.

Quoted 95 lines
Quoted 82 lines

s390x already fixed this in de60a92e "s390x/kvm: Set default cpu model for all machine classes". This patch applies a similar fix for the pseries-* machine types on ppc64.

Doing a

     {"execute":"query-machines"}
under KVM now results in
     {
       "hotpluggable-cpus": true,
       "name": "pseries-4.2",
       "numa-mem-supported": true,
       "default-cpu-type": "host-powerpc64-cpu",
       "is-default": true,
       "cpu-max": 1024,
       "deprecated": false,
       "alias": "pseries"
     },
     {
       "hotpluggable-cpus": true,
       "name": "pseries-4.1",
       "numa-mem-supported": true,
       "default-cpu-type": "host-powerpc64-cpu",
       "cpu-max": 1024,
       "deprecated": false
     },
     ...

Libvirt probes all machines via "-machine none,accel=kvm:tcg" and will currently see the wrong CPU model under KVM.

Cc David Hildenbrand <[email protected]>
Cc Igor Mammedov <[email protected]>
---
  target/ppc/kvm.c | 21 +++++++++++++--------
  1 file changed, 13 insertions(+), 8 deletions(-)
target/ppc/kvm.c +10 -4
index 7d2e8969ac..c77f9848ec 100644
@@ -100,7 +100,7 @@ static bool kvmppc_is_pr(KVMState *ks)
      return kvm_vm_check_extension(ks, KVM_CAP_PPC_GET_PVINFO) != 0;
  }
-static int kvm_ppc_register_host_cpu_type(MachineState *ms);
+static int kvm_ppc_register_host_cpu_type(void);
  static void kvmppc_get_cpu_characteristics(KVMState *s);
  static int kvmppc_get_dec_bits(void);
@@ -147,7 +147,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
          exit(1);
      }
-    kvm_ppc_register_host_cpu_type(ms);
+    kvm_ppc_register_host_cpu_type();
      return 0;
  }
@@ -2534,13 +2534,19 @@ PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
      return pvr_pcc;
  }
-static int kvm_ppc_register_host_cpu_type(MachineState *ms)
+static void pseries_machine_class_fixup(ObjectClass *oc, void *opaque)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->default_cpu_type = TYPE_HOST_POWERPC_CPU;
+}
+
+static int kvm_ppc_register_host_cpu_type(void)
  {
      TypeInfo type_info = {
          .name = TYPE_HOST_POWERPC_CPU,
          .class_init = kvmppc_host_cpu_class_init,
      };
-    MachineClass *mc = MACHINE_GET_CLASS(ms);
      PowerPCCPUClass *pvr_pcc;
      ObjectClass *oc;
      DeviceClass *dc;
@@ -2552,10 +2558,9 @@ static int kvm_ppc_register_host_cpu_type(MachineState *ms)
      }
      type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
      type_register(&type_info);

target/ppc/kvm.c static int kvm_ppc_register_host_cpu_type(MachineState *ms) · line 2566

Quoted 10 lines
target/ppc/kvm.c +3 -4
-    if (object_dynamic_cast(OBJECT(ms), TYPE_SPAPR_MACHINE)) {
-        /* override TCG default cpu type with 'host' cpu model */
-        mc->default_cpu_type = TYPE_HOST_POWERPC_CPU;
-    }
+    /* override TCG default cpu type with 'host' cpu model */
+    object_class_foreach(pseries_machine_class_fixup, TYPE_SPAPR_MACHINE,
+                         false, NULL);
      oc = object_class_by_name(type_info.name);
      g_assert(oc);
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#3 lore raw
In reply to David Gibson
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Subject: [PATCH] spapr/kvm: Set default cpu model for all machine classes
Type: series
Message-id: [email protected]

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test'
4581a2a spapr/kvm: Set default cpu model for all machine classes

=== OUTPUT BEGIN ===
ERROR: Missing Signed-off-by: line(s)

total: 1 errors, 0 warnings, 50 lines checked

Commit 4581a2a674f4 (spapr/kvm: Set default cpu model for all machine classes) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#4 lore raw
In reply to David Gibson
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1 === TEST SCRIPT END ===

TEST check-unit: tests/test-throttle
TEST check-unit: tests/test-thread-pool
**
ERROR:/tmp/qemu-test/src/tests/migration-test.c:903:wait_for_migration_fail: assertion failed: (!strcmp(status, "setup") || !strcmp(status, "failed") || (allow_active && !strcmp(status, "active")))
ERROR - Bail out! ERROR:/tmp/qemu-test/src/tests/migration-test.c:903:wait_for_migration_fail: assertion failed: (!strcmp(status, "setup") || !strcmp(status, "failed") || (allow_active && !strcmp(status, "active")))
make: *** [check-qtest-aarch64] Error 1
make: *** Waiting for unfinished jobs....
TEST check-unit: tests/test-hbitmap
TEST check-unit: tests/test-bdrv-drain
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=f34ee869f98f4d8fb89f4cce4cdaca05', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-xiqo9ndm/src/docker-src.2019-10-30-14.06.50.25613:/var/tmp/qemu:z,ro', 'qemu:centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=f34ee869f98f4d8fb89f4cce4cdaca05
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-xiqo9ndm/src'
make: *** [docker-run-test-quick@centos7] Error 2

real 9m9.268s
user 0m8.646s

The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

Reviewed-by on v1 1/1
#5 lore raw
In reply to David Gibson
Quoted 4 lines · On Wed, 30 Oct 2019 17:32:43 +0100 David Gibson <[email protected]>…

We have to set the default model of all machine classes, not just for the active one. Otherwise, "query-machines" will indicate the wrong CPU model ("qemu-s390x-cpu" instead of "host-s390x-cpu") as "default-cpu-type".

A PPC cpu model might be better.

Quoted 27 lines

s390x already fixed this in de60a92e "s390x/kvm: Set default cpu model for all machine classes". This patch applies a similar fix for the pseries-* machine types on ppc64.

Doing a

    {"execute":"query-machines"}
under KVM now results in
    {
      "hotpluggable-cpus": true,
      "name": "pseries-4.2",
      "numa-mem-supported": true,
      "default-cpu-type": "host-powerpc64-cpu",
      "is-default": true,
      "cpu-max": 1024,
      "deprecated": false,
      "alias": "pseries"
    },
    {
      "hotpluggable-cpus": true,
      "name": "pseries-4.1",
      "numa-mem-supported": true,
      "default-cpu-type": "host-powerpc64-cpu",
      "cpu-max": 1024,
      "deprecated": false
    },
    ...
Quoted 6 lines

Libvirt probes all machines via "-machine none,accel=kvm:tcg" and will currently see the wrong CPU model under KVM.

Cc David Hildenbrand <[email protected]>
Cc Igor Mammedov <[email protected]>

Missing S-o-b.

With these fixed.

Quoted 62 lines
---
 target/ppc/kvm.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
target/ppc/kvm.c +13 -8
index 7d2e8969ac..c77f9848ec 100644
@@ -100,7 +100,7 @@ static bool kvmppc_is_pr(KVMState *ks)
     return kvm_vm_check_extension(ks, KVM_CAP_PPC_GET_PVINFO) != 0;
 }
 
-static int kvm_ppc_register_host_cpu_type(MachineState *ms);
+static int kvm_ppc_register_host_cpu_type(void);
 static void kvmppc_get_cpu_characteristics(KVMState *s);
 static int kvmppc_get_dec_bits(void);
 
@@ -147,7 +147,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
         exit(1);
     }
 
-    kvm_ppc_register_host_cpu_type(ms);
+    kvm_ppc_register_host_cpu_type();
 
     return 0;
 }
@@ -2534,13 +2534,19 @@ PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
     return pvr_pcc;
 }
 
-static int kvm_ppc_register_host_cpu_type(MachineState *ms)
+static void pseries_machine_class_fixup(ObjectClass *oc, void *opaque)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->default_cpu_type = TYPE_HOST_POWERPC_CPU;
+}
+
+static int kvm_ppc_register_host_cpu_type(void)
 {
     TypeInfo type_info = {
         .name = TYPE_HOST_POWERPC_CPU,
         .class_init = kvmppc_host_cpu_class_init,
     };
-    MachineClass *mc = MACHINE_GET_CLASS(ms);
     PowerPCCPUClass *pvr_pcc;
     ObjectClass *oc;
     DeviceClass *dc;
@@ -2552,10 +2558,9 @@ static int kvm_ppc_register_host_cpu_type(MachineState *ms)
     }
     type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
     type_register(&type_info);
-    if (object_dynamic_cast(OBJECT(ms), TYPE_SPAPR_MACHINE)) {
-        /* override TCG default cpu type with 'host' cpu model */
-        mc->default_cpu_type = TYPE_HOST_POWERPC_CPU;
-    }
+    /* override TCG default cpu type with 'host' cpu model */
+    object_class_foreach(pseries_machine_class_fixup, TYPE_SPAPR_MACHINE,
+                         false, NULL);
 
     oc = object_class_by_name(type_info.name);
     g_assert(oc);
#6 lore raw
Quoted 9 lines · Greg Kurz
Quoted 4 lines · On Wed, 30 Oct 2019 17:32:43 +0100 David Gibson <[email protected]>…

We have to set the default model of all machine classes, not just for the active one. Otherwise, "query-machines" will indicate the wrong CPU model ("qemu-s390x-cpu" instead of "host-s390x-cpu") as "default-cpu-type".

A PPC cpu model might be better.

Indeed.

Quoted 28 lines
Quoted 28 lines

s390x already fixed this in de60a92e "s390x/kvm: Set default cpu model for all machine classes". This patch applies a similar fix for the pseries-* machine types on ppc64.

Doing a

    {"execute":"query-machines"}
under KVM now results in
    {
      "hotpluggable-cpus": true,
      "name": "pseries-4.2",
      "numa-mem-supported": true,
      "default-cpu-type": "host-powerpc64-cpu",
      "is-default": true,
      "cpu-max": 1024,
      "deprecated": false,
      "alias": "pseries"
    },
    {
      "hotpluggable-cpus": true,
      "name": "pseries-4.1",
      "numa-mem-supported": true,
      "default-cpu-type": "host-powerpc64-cpu",
      "cpu-max": 1024,
      "deprecated": false
    },
    ...
Quoted 8 lines
Quoted 6 lines

Libvirt probes all machines via "-machine none,accel=kvm:tcg" and will currently see the wrong CPU model under KVM.

Cc David Hildenbrand <[email protected]>
Cc Igor Mammedov <[email protected]>

Missing S-o-b.

Oops, fixed.

Quoted 67 lines

With these fixed.

Quoted 62 lines
---
 target/ppc/kvm.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
target/ppc/kvm.c +13 -8
index 7d2e8969ac..c77f9848ec 100644
@@ -100,7 +100,7 @@ static bool kvmppc_is_pr(KVMState *ks)
     return kvm_vm_check_extension(ks, KVM_CAP_PPC_GET_PVINFO) != 0;
 }
 
-static int kvm_ppc_register_host_cpu_type(MachineState *ms);
+static int kvm_ppc_register_host_cpu_type(void);
 static void kvmppc_get_cpu_characteristics(KVMState *s);
 static int kvmppc_get_dec_bits(void);
 
@@ -147,7 +147,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
         exit(1);
     }
 
-    kvm_ppc_register_host_cpu_type(ms);
+    kvm_ppc_register_host_cpu_type();
 
     return 0;
 }
@@ -2534,13 +2534,19 @@ PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)
     return pvr_pcc;
 }
 
-static int kvm_ppc_register_host_cpu_type(MachineState *ms)
+static void pseries_machine_class_fixup(ObjectClass *oc, void *opaque)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->default_cpu_type = TYPE_HOST_POWERPC_CPU;
+}
+
+static int kvm_ppc_register_host_cpu_type(void)
 {
     TypeInfo type_info = {
         .name = TYPE_HOST_POWERPC_CPU,
         .class_init = kvmppc_host_cpu_class_init,
     };
-    MachineClass *mc = MACHINE_GET_CLASS(ms);
     PowerPCCPUClass *pvr_pcc;
     ObjectClass *oc;
     DeviceClass *dc;
@@ -2552,10 +2558,9 @@ static int kvm_ppc_register_host_cpu_type(MachineState *ms)
     }
     type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
     type_register(&type_info);
-    if (object_dynamic_cast(OBJECT(ms), TYPE_SPAPR_MACHINE)) {
-        /* override TCG default cpu type with 'host' cpu model */
-        mc->default_cpu_type = TYPE_HOST_POWERPC_CPU;
-    }
+    /* override TCG default cpu type with 'host' cpu model */
+    object_class_foreach(pseries_machine_class_fixup, TYPE_SPAPR_MACHINE,
+                         false, NULL);
 
     oc = object_class_by_name(type_info.name);
     g_assert(oc);
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#7 lore raw
In reply to David Gibson
Quoted 11 lines · David Gibson

We have to set the default model of all machine classes, not just for the active one. Otherwise, "query-machines" will indicate the wrong CPU model ("qemu-s390x-cpu" instead of "host-s390x-cpu") as "default-cpu-type".

s390x already fixed this in de60a92e "s390x/kvm: Set default cpu model for all machine classes". This patch applies a similar fix for the pseries-* machine types on ppc64.

Libvirt probes all machines via "-machine none,accel=kvm:tcg" and will currently see the wrong CPU model under KVM.

Isn't this a bug in libvirt ? The default CPU for one machine type tells you nothing at all about the default machine for another CPU type. Libvirt needs to ask about the default CPU for the machine it's actually interested in, which is not likely to be "none".

thanks
-- PMM

#8 lore raw
Quoted 4 lines · Peter Maydell

Isn't this a bug in libvirt ? The default CPU for one machine type tells you nothing at all about the default machine for another CPU type. Libvirt needs to ask about the default CPU for the machine it's actually interested in, which is not likely to be "none".

Oh, wait, I should have read the QMP output rather than skipping over it -- it uses -machine none but then issues a QMP command asking about all machines, not just the current one. Sorry for the noise.

-- PMM

Tested-by on v1 1/1
#9 lore raw
In reply to David Gibson
Quoted 31 lines · David Gibson

We have to set the default model of all machine classes, not just for the active one. Otherwise, "query-machines" will indicate the wrong CPU model ("qemu-s390x-cpu" instead of "host-s390x-cpu") as "default-cpu-type".

s390x already fixed this in de60a92e "s390x/kvm: Set default cpu model for all machine classes". This patch applies a similar fix for the pseries-* machine types on ppc64.

Doing a

    {"execute":"query-machines"}
under KVM now results in
    {
      "hotpluggable-cpus": true,
      "name": "pseries-4.2",
      "numa-mem-supported": true,
      "default-cpu-type": "host-powerpc64-cpu",
      "is-default": true,
      "cpu-max": 1024,
      "deprecated": false,
      "alias": "pseries"
    },
    {
      "hotpluggable-cpus": true,
      "name": "pseries-4.1",
      "numa-mem-supported": true,
      "default-cpu-type": "host-powerpc64-cpu",
      "cpu-max": 1024,
      "deprecated": false
    },
    ...
Quoted 6 lines

Libvirt probes all machines via "-machine none,accel=kvm:tcg" and will currently see the wrong CPU model under KVM.

Cc David Hildenbrand <[email protected]>
Cc Igor Mammedov <[email protected]>

Works as expected now, thanks.

#10 lore raw
In reply to David Gibson

Hi David.

Quoted 31 lines · David Gibson

We have to set the default model of all machine classes, not just for the active one. Otherwise, "query-machines" will indicate the wrong CPU model ("qemu-s390x-cpu" instead of "host-s390x-cpu") as "default-cpu-type".

s390x already fixed this in de60a92e "s390x/kvm: Set default cpu model for all machine classes". This patch applies a similar fix for the pseries-* machine types on ppc64.

Doing a

    {"execute":"query-machines"}
under KVM now results in
    {
      "hotpluggable-cpus": true,
      "name": "pseries-4.2",
      "numa-mem-supported": true,
      "default-cpu-type": "host-powerpc64-cpu",
      "is-default": true,
      "cpu-max": 1024,
      "deprecated": false,
      "alias": "pseries"
    },
    {
      "hotpluggable-cpus": true,
      "name": "pseries-4.1",
      "numa-mem-supported": true,
      "default-cpu-type": "host-powerpc64-cpu",
      "cpu-max": 1024,
      "deprecated": false
    },
    ...
Quoted 2 lines

Libvirt probes all machines via "-machine none,accel=kvm:tcg" and will currently see the wrong CPU model under KVM.

Will this patch make it into 4.2.0?

Jirka

#11 lore raw
Quoted 34 lines · On Wed, 13 Nov 2019 15:43:44 +0100 Jiri Denemark <[email protected]> wrote:

Hi David.

Quoted 31 lines · David Gibson

We have to set the default model of all machine classes, not just for the active one. Otherwise, "query-machines" will indicate the wrong CPU model ("qemu-s390x-cpu" instead of "host-s390x-cpu") as "default-cpu-type".

s390x already fixed this in de60a92e "s390x/kvm: Set default cpu model for all machine classes". This patch applies a similar fix for the pseries-* machine types on ppc64.

Doing a

    {"execute":"query-machines"}
under KVM now results in
    {
      "hotpluggable-cpus": true,
      "name": "pseries-4.2",
      "numa-mem-supported": true,
      "default-cpu-type": "host-powerpc64-cpu",
      "is-default": true,
      "cpu-max": 1024,
      "deprecated": false,
      "alias": "pseries"
    },
    {
      "hotpluggable-cpus": true,
      "name": "pseries-4.1",
      "numa-mem-supported": true,
      "default-cpu-type": "host-powerpc64-cpu",
      "cpu-max": 1024,
      "deprecated": false
    },
    ...
Quoted 5 lines
Quoted 2 lines

Libvirt probes all machines via "-machine none,accel=kvm:tcg" and will currently see the wrong CPU model under KVM.

Will this patch make it into 4.2.0?

David is away until the 19th of November, which is the release date of rc2 according to the planning [*]. Then we have rc3 the 26th, and final release (or rc4) the 3rd of December, so it should be ok.

If David cannot make it for some reason, I guess Laurent Vivier or myself can send a PR with this patch, as already suggested by David in the past.

Cheers,

--
Greg

[*] https://wiki.qemu.org/Planning/4.2

Quoted 3 lines

Jirka

#12 lore raw
Quoted 3 lines · Greg Kurz

David is away until the 19th of November, which is the release date of rc2 according to the planning [*]. Then we have rc3 the 26th, and final release (or rc4) the 3rd of December, so it should be ok.

Please don't actively plan to delay putting changes in until later release candidates. The release process involves steadily winding up the bar of whether it's worth putting in and hopefully reducing the volume of changes between rcs. In an ideal world rc3 would have very few changes, and then there would be no changes at all between rc3 and the final release.

thanks
-- PMM

#13 lore raw
Quoted 5 lines · On Wed, 13 Nov 2019 15:31:58 +0000 Peter Maydell <[email protected]>…
Quoted 3 lines · Greg Kurz

David is away until the 19th of November, which is the release date of rc2 according to the planning [*]. Then we have rc3 the 26th, and final release (or rc4) the 3rd of December, so it should be ok.

Quoted 8 lines

Please don't actively plan to delay putting changes in until later release candidates. The release process involves steadily winding up the bar of whether it's worth putting in and hopefully reducing the volume of changes between rcs. In an ideal world rc3 would have very few changes, and then there would be no changes at all between rc3 and the final release.

Right. I could discuss with Laurent: David should be back on Monday actually. Hopefully he can a send a PR before rc2.

Quoted 3 lines

thanks
-- PMM

#14 lore raw
Quoted 17 lines · Greg Kurz
Quoted 5 lines · On Wed, 13 Nov 2019 15:31:58 +0000 Peter Maydell <[email protected]>…
Quoted 3 lines · Greg Kurz

David is away until the 19th of November, which is the release date of rc2 according to the planning [*]. Then we have rc3 the 26th, and final release (or rc4) the 3rd of December, so it should be ok.

Quoted 8 lines

Please don't actively plan to delay putting changes in until later release candidates. The release process involves steadily winding up the bar of whether it's worth putting in and hopefully reducing the volume of changes between rcs. In an ideal world rc3 would have very few changes, and then there would be no changes at all between rc3 and the final release.

Quoted 2 lines

Right. I could discuss with Laurent: David should be back on Monday actually. Hopefully he can a send a PR before rc2.

I'm back home now, back to work on Monday. It'll probably take me a full day of catching up on email and whatnot, so the earliest I'd be likely to do the PR is Tuesday. If you can get it ready before that, please go ahead.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#15 lore raw
Quoted 18 lines · David Gibson
Quoted 17 lines · Greg Kurz
Quoted 13 lines · On Wed, 13 Nov 2019 15:31:58 +0000 Peter Maydell <[email protected]>…
Quoted 3 lines · Greg Kurz

David is away until the 19th of November, which is the release date of rc2 according to the planning [*]. Then we have rc3 the 26th, and final release (or rc4) the 3rd of December, so it should be ok.

Please don't actively plan to delay putting changes in until later release candidates. The release process involves steadily winding up the bar of whether it's worth putting in and hopefully reducing the volume of changes between rcs. In an ideal world rc3 would have very few changes, and then there would be no changes at all between rc3 and the final release.

Quoted 8 lines
Quoted 2 lines

Right. I could discuss with Laurent: David should be back on Monday actually. Hopefully he can a send a PR before rc2.

I'm back home now, back to work on Monday. It'll probably take me a full day of catching up on email and whatnot, so the earliest I'd be likely to do the PR is Tuesday. If you can get it ready before that, please go ahead.

I'm going to take your ppc-for-4.2 branch to build and test, and then I will do the PR, probably today.

Thanks,
Laurent