Skip to contentSkip to conversation

Add machine type pc-1.0-qemu-kvm for live migrate compatibility with qemu-kvm

PATCH Superseded Alex Bligh 7 participants 29 messages Sep 21, 2014 – Sep 23, 2014

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Alex Bligh

author
#0 lore raw

v3 cover Add machine type pc-1.0-qemu-kvm for live migrate compatibility with qemu-kvm

This patch series adds inbound migrate capability from qemu-kvm version 1.0. The main ideas are those set out in Cole Robinson's patch here:
http://pkgs.fedoraproject.org/cgit/qemu.git/tree/0001-Fix-migration-from-qemu-kvm.patch?h=f20
however, rather than patching statically (and breaking inbound migration on existing machine types), I have added a new machine type (pc-1.0-qemu-kvm) without affecting any other machine types. The existing pc-1.0 machine type is renamed to pc-1.0-qemu-git, with pc-1.0 becoming an alias for one or another, as selected by a configure option (defaulting to pc-1.0-qemu-git, IE no change).

Two aproaches are taken:

* In hw/timer/i8254_common.c, the VMSTATE_UINT32_TEST macro is used to test the version for the irq_disable flags, allowing version 3 or more, or version 2 for an inbound migrate from qemu-kvm (only).

* In hw/acpi/piix4.c, qemu-kvm incorrectly uses version 2 for a version 3 structure, causing acpi_load_old to be used. acpi_load_old detects this situation based on the machine type and restarts the attempt to load the vmstate using a customised VMStateDescription. The above cleaner approach is unavailable here.

I developed this on qemu 2.0 but have forward ported it (trivially) to master. My testing has been on a VM live-migrated-to-file from Ubuntu Precise qemu-kvm 1.0.

I have given this a moderate degree of testing but it could do with more.

Note that certain hardware devices (including QXL) will not migrate properly due to a fundamental difference in their internal state between versions.

Also note that (as expected) migration from qemu-2.x to qemu-1.0 will not work, even if the machine types are the same.

Alex Bligh (2):
Add machine type pc-1.0-qemu-kvm for live migrate compatibility with
qemu-kvm
Add configure option --enable-pc-1-0-qemu-kvm

 configure               |   12 ++++++++++++
 hw/acpi/piix4.c         |   47 +++++++++++++++++++++++++++++++++++++++++++++--
 hw/i386/pc_piix.c       |   38 +++++++++++++++++++++++++++++++++++++-
 hw/timer/i8254_common.c |   10 +++++++++-
 4 files changed, 103 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v3 1/2 Add machine type pc-1.0-qemu-kvm for live migrate compatibility with qemu-kvm

Add a machine type pc-1.0-qemu-kvm for live migrate compatibility with qemu-kvm version 1.0.

---
 hw/acpi/piix4.c         |   47 +++++++++++++++++++++++++++++++++++++++++++++--
 hw/i386/pc_piix.c       |   30 ++++++++++++++++++++++++++++++
 hw/timer/i8254_common.c |   10 +++++++++-
 3 files changed, 84 insertions(+), 3 deletions(-)
hw/acpi/piix4.c +45 -2
index b72b34e..e016005 100644
@@ -37,6 +37,8 @@
 #include "hw/acpi/memory_hotplug.h"
 #include "hw/acpi/acpi_dev_interface.h"
 
+extern int qemu_kvm_1_0_compat;
+
 //#define DEBUG
 
 #ifdef DEBUG
@@ -200,12 +202,24 @@ static const VMStateDescription vmstate_pci_status = {
     }
 };
 
+static const VMStateDescription vmstate_acpi_compat;
+
 static int acpi_load_old(QEMUFile *f, void *opaque, int version_id)
 {
     PIIX4PMState *s = opaque;
     int ret, i;
     uint16_t temp;
 
+    /* If we are expecting the inbound migration to come from
+     * qemu-kvm 1.0, it will have a version_id of 2 but really
+     * be version 3, so call back the original vmstate_load_state
+     * with a different more tolerant vmstate descriptor
+     */
+    if ((version_id == 2) && (qemu_kvm_1_0_compat)) {
+        return vmstate_load_state(f, &vmstate_acpi_compat,
+                                  opaque, version_id);
+    }
+
     ret = pci_device_load(PCI_DEVICE(s), f);
     if (ret < 0) {
         return ret;
@@ -267,8 +281,9 @@ static const VMStateDescription vmstate_memhp_state = {
 };
 
 /* qemu-kvm 1.2 uses version 3 but advertised as 2
- * To support incoming qemu-kvm 1.2 migration, change version_id
- * and minimum_version_id to 2 below (which breaks migration from
+ * To support incoming qemu-kvm 1.2 migration, we support
+ * via a command line option a change to minimum_version_id
+ * of 2 in a _compat structure (which breaks migration from
  * qemu 1.2).
  *
  */
@@ -307,6 +322,34 @@ static const VMStateDescription vmstate_acpi = {
     }
 };
 
+static const VMStateDescription vmstate_acpi_compat = {
+    .name = "piix4_pm",
+    .version_id = 3,
+    .minimum_version_id = 2,
+    .minimum_version_id_old = 1,
+    .load_state_old = NULL, /* to avoid recursion */
+    .post_load = vmstate_acpi_post_load,
+    .fields      = (VMStateField[]) {
+        VMSTATE_PCI_DEVICE(parent_obj, PIIX4PMState),
+        VMSTATE_UINT16(ar.pm1.evt.sts, PIIX4PMState),
+        VMSTATE_UINT16(ar.pm1.evt.en, PIIX4PMState),
+        VMSTATE_UINT16(ar.pm1.cnt.cnt, PIIX4PMState),
+        VMSTATE_STRUCT(apm, PIIX4PMState, 0, vmstate_apm, APMState),
+        VMSTATE_TIMER(ar.tmr.timer, PIIX4PMState),
+        VMSTATE_INT64(ar.tmr.overflow_time, PIIX4PMState),
+        VMSTATE_STRUCT(ar.gpe, PIIX4PMState, 2, vmstate_gpe, ACPIGPE),
+        VMSTATE_STRUCT_TEST(
+            acpi_pci_hotplug.acpi_pcihp_pci_status[ACPI_PCIHP_BSEL_DEFAULT],
+            PIIX4PMState,
+            vmstate_test_no_use_acpi_pci_hotplug,
+            2, vmstate_pci_status,
+            struct AcpiPciHpPciStatus),
+        VMSTATE_PCI_HOTPLUG(acpi_pci_hotplug, PIIX4PMState,
+                            vmstate_test_use_acpi_pci_hotplug),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static void piix4_reset(void *opaque)
 {
     PIIX4PMState *s = opaque;
hw/i386/pc_piix.c +30 -0
index 7081c08..48a4942 100644
@@ -70,6 +70,8 @@ static bool smbios_legacy_mode;
 static bool gigabyte_align = true;
 static bool has_reserved_memory = true;
 
+int qemu_kvm_1_0_compat;
+
 /* PC hardware initialisation */
 static void pc_init1(MachineState *machine,
                      int pci_enabled,
@@ -386,6 +388,14 @@ static void pc_init_pci_1_2(MachineState *machine)
     pc_init_pci(machine);
 }
 
+/* PC machine init function for qemu-kvm 1.0 */
+static void pc_init_pci_1_2_qemu_kvm(MachineState *machine)
+{
+    qemu_kvm_1_0_compat = 1;
+    pc_compat_1_2(machine);
+    pc_init_pci(machine);
+}
+
 /* PC init function for pc-0.10 to pc-0.13 */
 static void pc_init_pci_no_kvmclock(MachineState *machine)
 {
@@ -644,6 +654,25 @@ static QEMUMachine pc_machine_v1_0 = {
     .hw_version = "1.0",
 };
 
+#define PC_COMPAT_1_0_QEMU_KVM \
+        PC_COMPAT_1_0,\
+        {\
+            .driver   = "cirrus-vga",\
+            .property = "vgamem_mb",\
+            .value    = stringify(16),\
+        }
+
+static QEMUMachine pc_machine_v1_0_qemu_kvm = {
+    PC_I440FX_1_2_MACHINE_OPTIONS,
+    .name = "pc-1.0-qemu-kvm",
+    .init = pc_init_pci_1_2_qemu_kvm,
+    .compat_props = (GlobalProperty[]) {
+        PC_COMPAT_1_0_QEMU_KVM,
+        { /* end of list */ }
+    },
+    .hw_version = "1.0",
+};
+
 #define PC_COMPAT_0_15 \
         PC_COMPAT_1_0
 
@@ -886,6 +915,7 @@ static void pc_machine_init(void)
     qemu_register_pc_machine(&pc_machine_v1_2);
     qemu_register_pc_machine(&pc_machine_v1_1);
     qemu_register_pc_machine(&pc_machine_v1_0);
+    qemu_register_pc_machine(&pc_machine_v1_0_qemu_kvm);
     qemu_register_pc_machine(&pc_machine_v0_15);
     qemu_register_pc_machine(&pc_machine_v0_14);
     qemu_register_pc_machine(&pc_machine_v0_13);
hw/timer/i8254_common.c +9 -1
index 07345f6..b4deead 100644
@@ -29,6 +29,8 @@
 #include "hw/timer/i8254.h"
 #include "hw/timer/i8254_internal.h"
 
+extern int qemu_kvm_1_0_compat;
+
 /* val must be 0 or 1 */
 void pit_set_gate(ISADevice *dev, int channel, int val)
 {
@@ -257,6 +259,11 @@ static int pit_dispatch_post_load(void *opaque, int version_id)
     return 0;
 }
 
+static bool has_irq_disabled(void *opaque, int version_id)
+{
+    return (version_id >= 3) || ((version_id == 2) && qemu_kvm_1_0_compat);
+}
+
 static const VMStateDescription vmstate_pit_common = {
     .name = "i8254",
     .version_id = 3,
@@ -266,7 +273,8 @@ static const VMStateDescription vmstate_pit_common = {
     .pre_save = pit_dispatch_pre_save,
     .post_load = pit_dispatch_post_load,
     .fields = (VMStateField[]) {
-        VMSTATE_UINT32_V(channels[0].irq_disabled, PITCommonState, 3),
+        VMSTATE_UINT32_TEST(channels[0].irq_disabled, PITCommonState,
+                            has_irq_disabled),
         VMSTATE_STRUCT_ARRAY(channels, PITCommonState, 3, 2,
                              vmstate_pit_channel, PITChannelState),
         VMSTATE_INT64(channels[0].next_transition_time,
Signature · 1 line
1.7.9.5
#2 lore raw
Quoted 15 lines · Alex Bligh

Add a machine type pc-1.0-qemu-kvm for live migrate compatibility with qemu-kvm version 1.0.

---
 hw/acpi/piix4.c         |   47 +++++++++++++++++++++++++++++++++++++++++++++--
 hw/i386/pc_piix.c       |   30 ++++++++++++++++++++++++++++++
 hw/timer/i8254_common.c |   10 +++++++++-
 3 files changed, 84 insertions(+), 3 deletions(-)
hw/acpi/piix4.c +0 -0
index b72b34e..e016005 100644

hw/acpi/piix4.c line 44

Quoted 8 lines
hw/acpi/piix4.c +2 -0
@@ -37,6 +37,8 @@
 #include "hw/acpi/memory_hotplug.h"
 #include "hw/acpi/acpi_dev_interface.h"
 
+extern int qemu_kvm_1_0_compat;
+
 //#define DEBUG
 
 #ifdef DEBUG

Please dont' put extern declarations in C files.
You lose a useful type-safety compile-time check.

hw/acpi/piix4.c static const VMStateDescription vmstate_pci_status = { · line 206

Quoted 6 lines
hw/acpi/piix4.c +2 -0
@@ -200,12 +202,24 @@ static const VMStateDescription vmstate_pci_status = {
     }
 };
 
+static const VMStateDescription vmstate_acpi_compat;
+

Don't declare things like this, re-order them in a separate patch so forward declarations are not necessary.

Quoted 99 lines
hw/acpi/piix4.c +41 -2
 static int acpi_load_old(QEMUFile *f, void *opaque, int version_id)
 {
     PIIX4PMState *s = opaque;
     int ret, i;
     uint16_t temp;
 
+    /* If we are expecting the inbound migration to come from
+     * qemu-kvm 1.0, it will have a version_id of 2 but really
+     * be version 3, so call back the original vmstate_load_state
+     * with a different more tolerant vmstate descriptor
+     */
+    if ((version_id == 2) && (qemu_kvm_1_0_compat)) {
+        return vmstate_load_state(f, &vmstate_acpi_compat,
+                                  opaque, version_id);
+    }
+
     ret = pci_device_load(PCI_DEVICE(s), f);
     if (ret < 0) {
         return ret;
@@ -267,8 +281,9 @@ static const VMStateDescription vmstate_memhp_state = {
 };
 
 /* qemu-kvm 1.2 uses version 3 but advertised as 2
- * To support incoming qemu-kvm 1.2 migration, change version_id
- * and minimum_version_id to 2 below (which breaks migration from
+ * To support incoming qemu-kvm 1.2 migration, we support
+ * via a command line option a change to minimum_version_id
+ * of 2 in a _compat structure (which breaks migration from
  * qemu 1.2).
  *
  */
@@ -307,6 +322,34 @@ static const VMStateDescription vmstate_acpi = {
     }
 };
 
+static const VMStateDescription vmstate_acpi_compat = {
+    .name = "piix4_pm",
+    .version_id = 3,
+    .minimum_version_id = 2,
+    .minimum_version_id_old = 1,
+    .load_state_old = NULL, /* to avoid recursion */
+    .post_load = vmstate_acpi_post_load,
+    .fields      = (VMStateField[]) {
+        VMSTATE_PCI_DEVICE(parent_obj, PIIX4PMState),
+        VMSTATE_UINT16(ar.pm1.evt.sts, PIIX4PMState),
+        VMSTATE_UINT16(ar.pm1.evt.en, PIIX4PMState),
+        VMSTATE_UINT16(ar.pm1.cnt.cnt, PIIX4PMState),
+        VMSTATE_STRUCT(apm, PIIX4PMState, 0, vmstate_apm, APMState),
+        VMSTATE_TIMER(ar.tmr.timer, PIIX4PMState),
+        VMSTATE_INT64(ar.tmr.overflow_time, PIIX4PMState),
+        VMSTATE_STRUCT(ar.gpe, PIIX4PMState, 2, vmstate_gpe, ACPIGPE),
+        VMSTATE_STRUCT_TEST(
+            acpi_pci_hotplug.acpi_pcihp_pci_status[ACPI_PCIHP_BSEL_DEFAULT],
+            PIIX4PMState,
+            vmstate_test_no_use_acpi_pci_hotplug,
+            2, vmstate_pci_status,
+            struct AcpiPciHpPciStatus),
+        VMSTATE_PCI_HOTPLUG(acpi_pci_hotplug, PIIX4PMState,
+                            vmstate_test_use_acpi_pci_hotplug),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static void piix4_reset(void *opaque)
 {
     PIIX4PMState *s = opaque;
hw/i386/pc_piix.c +11 -0
index 7081c08..48a4942 100644
@@ -70,6 +70,8 @@ static bool smbios_legacy_mode;
 static bool gigabyte_align = true;
 static bool has_reserved_memory = true;
 
+int qemu_kvm_1_0_compat;
+
 /* PC hardware initialisation */
 static void pc_init1(MachineState *machine,
                      int pci_enabled,
@@ -386,6 +388,14 @@ static void pc_init_pci_1_2(MachineState *machine)
     pc_init_pci(machine);
 }
 
+/* PC machine init function for qemu-kvm 1.0 */
+static void pc_init_pci_1_2_qemu_kvm(MachineState *machine)
+{
+    qemu_kvm_1_0_compat = 1;
+    pc_compat_1_2(machine);
+    pc_init_pci(machine);
+}
+
 /* PC init function for pc-0.10 to pc-0.13 */
 static void pc_init_pci_no_kvmclock(MachineState *machine)
 {
@@ -644,6 +654,25 @@ static QEMUMachine pc_machine_v1_0 = {
     .hw_version = "1.0",
 };
 
+#define PC_COMPAT_1_0_QEMU_KVM \

hw/i386/pc_piix.c static QEMUMachine pc_machine_v1_0 = { · line 667

Quoted 10 lines
hw/i386/pc_piix.c +10 -0
+        PC_COMPAT_1_0,\
+        {\
+            .driver   = "cirrus-vga",\
+            .property = "vgamem_mb",\
+            .value    = stringify(16),\
+        }
+
+static QEMUMachine pc_machine_v1_0_qemu_kvm = {
+    PC_I440FX_1_2_MACHINE_OPTIONS,
+    .name = "pc-1.0-qemu-kvm",

I think pc-qemu-kvm-1.0 is slightly better - more consistent with other machine names.

Quoted 24 lines
hw/i386/pc_piix.c +9 -0
+    .init = pc_init_pci_1_2_qemu_kvm,
+    .compat_props = (GlobalProperty[]) {
+        PC_COMPAT_1_0_QEMU_KVM,
+        { /* end of list */ }
+    },
+    .hw_version = "1.0",
+};
+
 #define PC_COMPAT_0_15 \
         PC_COMPAT_1_0
 
@@ -886,6 +915,7 @@ static void pc_machine_init(void)
     qemu_register_pc_machine(&pc_machine_v1_2);
     qemu_register_pc_machine(&pc_machine_v1_1);
     qemu_register_pc_machine(&pc_machine_v1_0);
+    qemu_register_pc_machine(&pc_machine_v1_0_qemu_kvm);
     qemu_register_pc_machine(&pc_machine_v0_15);
     qemu_register_pc_machine(&pc_machine_v0_14);
     qemu_register_pc_machine(&pc_machine_v0_13);
hw/timer/i8254_common.c +0 -0
index 07345f6..b4deead 100644

hw/timer/i8254_common.c line 36

Quoted 8 lines
hw/timer/i8254_common.c +2 -0
@@ -29,6 +29,8 @@
 #include "hw/timer/i8254.h"
 #include "hw/timer/i8254_internal.h"
 
+extern int qemu_kvm_1_0_compat;
+
 /* val must be 0 or 1 */
 void pit_set_gate(ISADevice *dev, int channel, int val)
 {

Can you add a device property like we do for
other compat behaviours?
That's better than a global variable.
Same for other devices.

Quoted 24 lines
hw/timer/i8254_common.c +7 -1
@@ -257,6 +259,11 @@ static int pit_dispatch_post_load(void *opaque, int version_id)
     return 0;
 }
 
+static bool has_irq_disabled(void *opaque, int version_id)
+{
+    return (version_id >= 3) || ((version_id == 2) && qemu_kvm_1_0_compat);
+}
+
 static const VMStateDescription vmstate_pit_common = {
     .name = "i8254",
     .version_id = 3,
@@ -266,7 +273,8 @@ static const VMStateDescription vmstate_pit_common = {
     .pre_save = pit_dispatch_pre_save,
     .post_load = pit_dispatch_post_load,
     .fields = (VMStateField[]) {
-        VMSTATE_UINT32_V(channels[0].irq_disabled, PITCommonState, 3),
+        VMSTATE_UINT32_TEST(channels[0].irq_disabled, PITCommonState,
+                            has_irq_disabled),
         VMSTATE_STRUCT_ARRAY(channels, PITCommonState, 3, 2,
                              vmstate_pit_channel, PITChannelState),
         VMSTATE_INT64(channels[0].next_transition_time,
Signature · 1 line
1.7.9.5
author
#3 lore raw

Michael,

(Reordering)

Quoted 5 lines · Michael S. Tsirkin
Quoted 5 lines
hw/timer/i8254_common.c +0 -0
@@ -257,6 +259,11 @@ static int pit_dispatch_post_load(void *opaque, int version_id)
    return 0;
 }
 
Quoted 9 lines

hw/timer/i8254_common.c static int pit_dispatch_post_load(void *opaque, int version_id) · line 266

Quoted 5 lines
hw/timer/i8254_common.c +5 -0
+static bool has_irq_disabled(void *opaque, int version_id)
+{
+    return (version_id >= 3) || ((version_id == 2) && qemu_kvm_1_0_compat);
+}
+

Can you add a device property like we do for
other compat behaviours?
That's better than a global variable.
Same for other devices.

I can see 'opaque' points to PIIX4PMState or PITCommonState. Do you mean to put them in there? Could you point to an example to copy.

Signature · 1 line
Alex Bligh
#4 lore raw
Quoted 21 lines · Alex Bligh

Michael,

(Reordering)

Quoted 5 lines · Michael S. Tsirkin
Quoted 5 lines
hw/timer/i8254_common.c +0 -0
@@ -257,6 +259,11 @@ static int pit_dispatch_post_load(void *opaque, int version_id)
    return 0;
 }
 
Quoted 9 lines

hw/timer/i8254_common.c static int pit_dispatch_post_load(void *opaque, int version_id) · line 266

Quoted 5 lines
hw/timer/i8254_common.c +5 -0
+static bool has_irq_disabled(void *opaque, int version_id)
+{
+    return (version_id >= 3) || ((version_id == 2) && qemu_kvm_1_0_compat);
+}
+

Can you add a device property like we do for
other compat behaviours?
That's better than a global variable.
Same for other devices.

Quoted 2 lines

I can see 'opaque' points to PIIX4PMState or PITCommonState. Do you mean to put them in there? Could you point to an example to copy.

Look for PC_COMPAT_ macros, we have a ton of flags like this.

Quoted 5 lines
Signature · 1 line
Alex Bligh
author
#5 lore raw

PATCH v3 2/2 Add configure option --enable-pc-1-0-qemu-kvm

In reply to Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

---
 configure         |   12 ++++++++++++
 hw/i386/pc_piix.c |    8 +++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
configure +12 -0
index f7685b5..b143302 100755
@@ -335,6 +335,7 @@ libssh2=""
 vhdx=""
 quorum=""
 numa=""
+pc_1_0_qemu_kvm="no"
 
 # parse CC options first
 for opt do
@@ -1125,6 +1126,10 @@ for opt do
   ;;
   --enable-numa) numa="yes"
   ;;
+  --disable-pc-1-0-qemu-kvm) pc_1_0_qemu_kvm="no"
+  ;;
+  --enable-pc-1-0-qemu-kvm) pc_1_0_qemu_kvm="yes"
+  ;;
   *)
       echo "ERROR: unknown option $opt"
       echo "Try '$0 --help' for more information"
@@ -1394,6 +1399,8 @@ Advanced options (experts only):
   --enable-quorum          enable quorum block filter support
   --disable-numa           disable libnuma support
   --enable-numa            enable libnuma support
+  --disable-pc-1-0-qemu-kvm disable pc-1.0 machine type reflecting qemu-kvm
+  --enable-pc-1-0-qemu-kvm enable pc-1.0 machine type reflecting qemu-kvm
 
 NOTE: The object files are built at the place where configure is launched
 EOF
@@ -4262,6 +4269,7 @@ echo "Quorum            $quorum"
 echo "lzo support       $lzo"
 echo "snappy support    $snappy"
 echo "NUMA host support $numa"
+echo "pc-1.0 qemu-kvm   $pc_1_0_qemu_kvm"
 
 if test "$sdl_too_old" = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -5241,6 +5249,10 @@ if test "$numa" = "yes"; then
   echo "CONFIG_NUMA=y" >> $config_host_mak
 fi
 
+if test "$pc_1_0_qemu_kvm" = "yes"; then
+  echo "CONFIG_PC_1_0_QEMU_KVM=y" >> $config_host_mak
+fi
+
 # build tree in object directory in case the source is not in the current directory
 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
 DIRS="$DIRS fsdev"
hw/i386/pc_piix.c +7 -1
index 48a4942..b7a4af0 100644
@@ -646,7 +646,10 @@ static QEMUMachine pc_machine_v1_1 = {
 
 static QEMUMachine pc_machine_v1_0 = {
     PC_I440FX_1_2_MACHINE_OPTIONS,
-    .name = "pc-1.0",
+    .name = "pc-1.0-qemu-git",
+#ifndef CONFIG_PC_1_0_QEMU_KVM
+    .alias = "pc-1.0",
+#endif
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_1_0,
         { /* end of list */ }
@@ -665,6 +668,9 @@ static QEMUMachine pc_machine_v1_0 = {
 static QEMUMachine pc_machine_v1_0_qemu_kvm = {
     PC_I440FX_1_2_MACHINE_OPTIONS,
     .name = "pc-1.0-qemu-kvm",
+#ifdef CONFIG_PC_1_0_QEMU_KVM
+    .alias = "pc-1.0",
+#endif
     .init = pc_init_pci_1_2_qemu_kvm,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_1_0_QEMU_KVM,
Signature · 1 line
1.7.9.5
#6 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 11 lines · Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

I have to say, this one bothers me.
We end up not being able to predict what does pc-1.0 reference.

Users also don't get qemu from git so I don't see why does git make sense in the name?

Legacy management applications invoked qemu as qemu-kvm - how about detecting that name and switching
the machine types?
It might make sense to also set -enable-kvm and change default CPU to kvm64 in this case.

Quoted 84 lines
---
 configure         |   12 ++++++++++++
 hw/i386/pc_piix.c |    8 +++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
configure +12 -0
index f7685b5..b143302 100755
@@ -335,6 +335,7 @@ libssh2=""
 vhdx=""
 quorum=""
 numa=""
+pc_1_0_qemu_kvm="no"
 
 # parse CC options first
 for opt do
@@ -1125,6 +1126,10 @@ for opt do
   ;;
   --enable-numa) numa="yes"
   ;;
+  --disable-pc-1-0-qemu-kvm) pc_1_0_qemu_kvm="no"
+  ;;
+  --enable-pc-1-0-qemu-kvm) pc_1_0_qemu_kvm="yes"
+  ;;
   *)
       echo "ERROR: unknown option $opt"
       echo "Try '$0 --help' for more information"
@@ -1394,6 +1399,8 @@ Advanced options (experts only):
   --enable-quorum          enable quorum block filter support
   --disable-numa           disable libnuma support
   --enable-numa            enable libnuma support
+  --disable-pc-1-0-qemu-kvm disable pc-1.0 machine type reflecting qemu-kvm
+  --enable-pc-1-0-qemu-kvm enable pc-1.0 machine type reflecting qemu-kvm
 
 NOTE: The object files are built at the place where configure is launched
 EOF
@@ -4262,6 +4269,7 @@ echo "Quorum            $quorum"
 echo "lzo support       $lzo"
 echo "snappy support    $snappy"
 echo "NUMA host support $numa"
+echo "pc-1.0 qemu-kvm   $pc_1_0_qemu_kvm"
 
 if test "$sdl_too_old" = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -5241,6 +5249,10 @@ if test "$numa" = "yes"; then
   echo "CONFIG_NUMA=y" >> $config_host_mak
 fi
 
+if test "$pc_1_0_qemu_kvm" = "yes"; then
+  echo "CONFIG_PC_1_0_QEMU_KVM=y" >> $config_host_mak
+fi
+
 # build tree in object directory in case the source is not in the current directory
 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
 DIRS="$DIRS fsdev"
hw/i386/pc_piix.c +7 -1
index 48a4942..b7a4af0 100644
@@ -646,7 +646,10 @@ static QEMUMachine pc_machine_v1_1 = {
 
 static QEMUMachine pc_machine_v1_0 = {
     PC_I440FX_1_2_MACHINE_OPTIONS,
-    .name = "pc-1.0",
+    .name = "pc-1.0-qemu-git",
+#ifndef CONFIG_PC_1_0_QEMU_KVM
+    .alias = "pc-1.0",
+#endif
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_1_0,
         { /* end of list */ }
@@ -665,6 +668,9 @@ static QEMUMachine pc_machine_v1_0 = {
 static QEMUMachine pc_machine_v1_0_qemu_kvm = {
     PC_I440FX_1_2_MACHINE_OPTIONS,
     .name = "pc-1.0-qemu-kvm",
+#ifdef CONFIG_PC_1_0_QEMU_KVM
+    .alias = "pc-1.0",
+#endif
     .init = pc_init_pci_1_2_qemu_kvm,
     .compat_props = (GlobalProperty[]) {
         PC_COMPAT_1_0_QEMU_KVM,
Signature · 1 line
1.7.9.5
#7 lore raw

Re: [Qemu-devel] [libvirt] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

Quoted 5 lines
Quoted 1 line

I have to say, this one bothers me.
We end up not being able to predict what does pc-1.0 reference.

Yeah, this is not good. Any single machine type name should have fixed semantics - having two different semantics depending on build options means mgmt apps can no longer simply compare the machine type name to determine if it is a match with the same name on a different host.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#8 lore raw

Re: [Qemu-devel] [libvirt] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 25 lines · Daniel P. Berrange
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

Quoted 5 lines
Quoted 1 line

I have to say, this one bothers me.
We end up not being able to predict what does pc-1.0 reference.

Yeah, this is not good. Any single machine type name should have fixed semantics - having two different semantics depending on build options means mgmt apps can no longer simply compare the machine type name to determine if it is a match with the same name on a different host.

Quoted 2 lines

Regards,
Daniel

Right. However, the fact remains that distros shipped qemu and qemu-kvm that had pc-1.0 meaning different things. What do you think about my idea to detect the meaning for pc-1.0 based on argv[0]?

Quoted 5 lines
Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#9 lore raw

Re: [Qemu-devel] [libvirt] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

In reply to Daniel P. Berrange
Quoted 18 lines · Daniel P. Berrange
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

Quoted 5 lines
Quoted 1 line

I have to say, this one bothers me.
We end up not being able to predict what does pc-1.0 reference.

Quoted 5 lines

Yeah, this is not good. Any single machine type name should have fixed semantics - having two different semantics depending on build options means mgmt apps can no longer simply compare the machine type name to determine if it is a match with the same name on a different host.

You're right. However, this particular horse left the barn a long time
ago: the pc-* machine types differ in qemu-kvm and upstream QEMU.

Sure, when qemu-kvm was merged back into QEMU, its machine type variants were dropped. But they live on in various downstreams that just like QEMU had to pick between compatibility with upstream QEMU and qemu-kvm, but unlike QEMU picked compatibility with qemu-kvm.

So this patch does *not* break any management apps by letting them "no longer simply compare the machine type name to determine if it is a match with the same name on a different host". They never could for these messed up machine types, at least not without knowing exactly what kind of QEMU runs on the hosts in question.

All this patch does is adding another facet to "exactly what kind of QEMU".

#10 lore raw

Re: [Qemu-devel] [libvirt] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 34 lines · Markus Armbruster
Quoted 18 lines · Daniel P. Berrange
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

Quoted 5 lines
Quoted 1 line

I have to say, this one bothers me.
We end up not being able to predict what does pc-1.0 reference.

Quoted 5 lines

Yeah, this is not good. Any single machine type name should have fixed semantics - having two different semantics depending on build options means mgmt apps can no longer simply compare the machine type name to determine if it is a match with the same name on a different host.

You're right. However, this particular horse left the barn a long time
ago: the pc-* machine types differ in qemu-kvm and upstream QEMU.

Sure, when qemu-kvm was merged back into QEMU, its machine type variants were dropped. But they live on in various downstreams that just like QEMU had to pick between compatibility with upstream QEMU and qemu-kvm, but unlike QEMU picked compatibility with qemu-kvm.

Quoted 8 lines

So this patch does *not* break any management apps by letting them "no longer simply compare the machine type name to determine if it is a match with the same name on a different host". They never could for these messed up machine types, at least not without knowing exactly what kind of QEMU runs on the hosts in question.

All this patch does is adding another facet to "exactly what kind of QEMU".

Right, but IMHO doing it at compile-time is wrong.
If distros want compatiblity with both sometimes, what then? Build two binaries with different flags?
Should be a runtime option that management sets after (somehow?) figuring out what's going on, on source.

How does it do that? Not sure - but I'm sure destination distro has no way to figure it out.

Signature · 1 line
MST
#11 lore raw

Re: [Qemu-devel] [libvirt] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 44 lines · Michael S. Tsirkin
Quoted 34 lines · Markus Armbruster
Quoted 18 lines · Daniel P. Berrange
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

Quoted 5 lines
Quoted 1 line

I have to say, this one bothers me.
We end up not being able to predict what does pc-1.0 reference.

Quoted 5 lines

Yeah, this is not good. Any single machine type name should have fixed semantics - having two different semantics depending on build options means mgmt apps can no longer simply compare the machine type name to determine if it is a match with the same name on a different host.

You're right. However, this particular horse left the barn a long time
ago: the pc-* machine types differ in qemu-kvm and upstream QEMU.

Sure, when qemu-kvm was merged back into QEMU, its machine type variants were dropped. But they live on in various downstreams that just like QEMU had to pick between compatibility with upstream QEMU and qemu-kvm, but unlike QEMU picked compatibility with qemu-kvm.

Quoted 8 lines

So this patch does *not* break any management apps by letting them "no longer simply compare the machine type name to determine if it is a match with the same name on a different host". They never could for these messed up machine types, at least not without knowing exactly what kind of QEMU runs on the hosts in question.

All this patch does is adding another facet to "exactly what kind of QEMU".

Quoted 8 lines

Right, but IMHO doing it at compile-time is wrong.
If distros want compatiblity with both sometimes, what then? Build two binaries with different flags?
Should be a runtime option that management sets after (somehow?) figuring out what's going on, on source.

How does it do that? Not sure - but I'm sure destination distro has no way to figure it out.

It's not even just between distributions. Anyone who used qemu-2.0 to start a pc-1.0 machine type will have a different mt than someone who starts a vm under Ubuntu's (qemu-)kvm 1.0. Sadly.

So in the packages at https://launchpad.net/~serge-hallyn/+archive/ubuntu/qemu-p-migration
the default can be configured at build-time, but it can be specified on
the command-line (which is then controlled by a new libvirt flag).

-serge

#12 lore raw

Re: [Qemu-devel] [libvirt] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

In reply to Markus Armbruster

Il 22/09/2014 17:24, Markus Armbruster ha scritto:

Quoted 7 lines

You're right. However, this particular horse left the barn a long time
ago: the pc-* machine types differ in qemu-kvm and upstream QEMU.

Sure, when qemu-kvm was merged back into QEMU, its machine type variants were dropped. But they live on in various downstreams that just like QEMU had to pick between compatibility with upstream QEMU and qemu-kvm, but unlike QEMU picked compatibility with qemu-kvm.

And fixing this should have been downstream's job. Fedora did it at the time, RHEL7 did it. Ubuntu didn't, and probably neither did Debian.

This patch singles out pc-1.0 just because it used to be the default in Ubuntu 12.04. So basically it's making upstream carry the burden of a decision of the Ubuntu folks. It's understandable that Alex disagrees with the decision, but nevertheless it's not something that upstream should agree with.

Also, another horse that has left the barn: it's already too late to apply this patch to upstream Ubuntu. If you do that, any machine created with 12.04 and reused with 14.04 will fail to migrate to another 14.04 machine that includes this patch, as I understand it.

So as things stand, I don't see a reason to apply this patch upstream.

Paolo

author
#13 lore raw

Re: [Qemu-devel] [libvirt] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 8 lines · Paolo Bonzini

time, RHEL7 did it. Ubuntu didn't, and probably neither did Debian.

This patch singles out pc-1.0 just because it used to be the default in Ubuntu 12.04. So basically it's making upstream carry the burden of a decision of the Ubuntu folks. It's understandable that Alex disagrees with the decision, but nevertheless it's not something that upstream should agree with.

Quoted 6 lines

Also, another horse that has left the barn: it's already too late to apply this patch to upstream Ubuntu. If you do that, any machine created with 12.04 and reused with 14.04 will fail to migrate to another 14.04 machine that includes this patch, as I understand it.

So as things stand, I don't see a reason to apply this patch upstream.

Well, Ubuntu (Serge I think) said in the Ubuntu bug report he'd be quite willing to break migration of pc-1.0 machine types from 14.04 to 14.04 because that machine type isn't the default anyway on 14.04.

But that isn't the point, as the patch (as a whole) doesn't break anything - it merely gives the possibility to import pc-1.0 machines from qemu-kvm. That's useful even if you build qemu from source every time.

Or were you just arguing against the ./configure option?

Signature · 1 line
Alex Bligh
#14 lore raw

Re: [Qemu-devel] [libvirt] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Il 22/09/2014 19:30, Alex Bligh ha scritto:

Quoted 11 lines

Well, Ubuntu (Serge I think) said in the Ubuntu bug report he'd be quite willing to break migration of pc-1.0 machine types from 14.04 to 14.04 because that machine type isn't the default anyway on 14.04.

But that isn't the point, as the patch (as a whole) doesn't break anything - it merely gives the possibility to import pc-1.0 machines from qemu-kvm. That's useful even if you build qemu from source every time.

Or were you just arguing against the ./configure option?

I'm arguing against special-casing pc-1.0. Just apply the patch to Ubuntu downstream and call it a day.

It's perfectly normal for machine types to be part of the downstream (not so secret) sauce.

Paolo

author
#15 lore raw

Re: [Qemu-devel] [libvirt] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 5 lines · Paolo Bonzini

I'm arguing against special-casing pc-1.0. Just apply the patch to Ubuntu downstream and call it a day.

It's perfectly normal for machine types to be part of the downstream (not so secret) sauce.

Well, I've just sent through a version that works as a machine parameter instead. If upstream doesn't like this, I'd prefer downstream took v2 of the patch (which makes -M pc-1.0 work) instead. That's also what Serge tested.

Signature · 1 line
Alex Bligh
#16 lore raw

Re: [Qemu-devel] [libvirt] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 6 lines · Alex Bligh
Quoted 3 lines · Paolo Bonzini

I'm arguing against special-casing pc-1.0. Just apply the patch to Ubuntu downstream and call it a day.

Quoted 7 lines
Quoted 2 lines

It's perfectly normal for machine types to be part of the downstream (not so secret) sauce.

Well, I've just sent through a version that works as a machine parameter instead. If upstream doesn't like this, I'd prefer downstream took v2 of the patch (which makes -M pc-1.0 work) instead. That's also what Serge tested.

Yeah, prefer v2 as well. Sorry if that means wasted time on your part.

Though I'm also thinking I prefer to have pc-1.0-precise defined in both precise's qemu-kvm 1.0, and later qemu 2.x, and requiring some purely-on-precise action to switch the machine type from pc-1.0 to pc-1.0-precise before migrating to trusty/later.

But as I mentioned elsewhere there's still the concerns of (a) how much other still (like virito-net) will still break, and (b) the practical issues of how to ship the old roms.

-serge

author
#17 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

In reply to Michael S. Tsirkin
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

Quoted 5 lines
Quoted 1 line

I have to say, this one bothers me.
We end up not being able to predict what does pc-1.0 reference.

The whole point is to make it easy for distributions to make pc-1.0 do an appropriate thing for them, an appropriate thing being what their previous release(s) meant by pc-1.0. Sadly, pc-1.0 means more than one thing - on Ubuntu it really means "qemu-kvm's pc-1.0" and on other systems (and upstream) it means "qemu-git's pc-1.0". This is horrible, but it's not the fault of this patch, is simply current reality. Right now, you can't tell what pc-1.0 does anyway, as it does a different thing on Ubuntu Precise to Ubuntu Trusty (for instance).

If we're going to provide compatibility to the machine type name level (which is the purpose here) then sadly we need something like this.

As for 'not being able to predict', actually post this patch the situation is far clearer, as '-M ?' tells you exactly what pc-1.0 will do, by showing what it's an alias for.

Quoted 2 lines

Users also don't get qemu from git so I don't see why does git make sense in the name?

Agree with that, but I couldn't think of anything better. 'qemu-upstream'? 'qemu'?

Quoted 4 lines

Legacy management applications invoked qemu as qemu-kvm - how about detecting that name and switching
the machine types?
It might make sense to also set -enable-kvm a

Sadly that is not true. For instance on Ubuntu Precise it's invoked as qemu-system-x86_64 by at least one management application known to me.

I'm not quite sure why you say "legacy management applications". This applies to /any/ management application. Unless we're going to burden every management application with this problem, we need to fix it.

Just as a reminder, the ./configure value defaults to off, which means there is no change in current behaviour. Only if the ./configure value is changed does it result in the behaviour of pc-1.0 changing, and that is evident from the help line. And it's possible to specify a specific variant of 1.0 (irrespective of the default) from the command line.

Signature · 1 line
Alex Bligh
#18 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 30 lines · Alex Bligh
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

Quoted 5 lines
Quoted 1 line

I have to say, this one bothers me.
We end up not being able to predict what does pc-1.0 reference.

The whole point is to make it easy for distributions to make pc-1.0 do an appropriate thing for them, an appropriate thing being what their previous release(s) meant by pc-1.0. Sadly, pc-1.0 means more than one thing - on Ubuntu it really means "qemu-kvm's pc-1.0" and on other systems (and upstream) it means "qemu-git's pc-1.0". This is horrible, but it's not the fault of this patch, is simply current reality. Right now, you can't tell what pc-1.0 does anyway, as it does a different thing on Ubuntu Precise to Ubuntu Trusty (for instance).

Quoted 3 lines

If we're going to provide compatibility to the machine type name level (which is the purpose here) then sadly we need something like this.

Ack for "something" but not like this, I suspect.

Quoted 10 lines

As for 'not being able to predict', actually post this patch the situation is far clearer, as '-M ?' tells you exactly what pc-1.0 will do, by showing what it's an alias for.

Quoted 2 lines

Users also don't get qemu from git so I don't see why does git make sense in the name?

Agree with that, but I couldn't think of anything better. 'qemu-upstream'? 'qemu'?

Quoted 8 lines
Quoted 4 lines

Legacy management applications invoked qemu as qemu-kvm - how about detecting that name and switching
the machine types?
It might make sense to also set -enable-kvm a

Sadly that is not true. For instance on Ubuntu Precise it's invoked as qemu-system-x86_64 by at least one management application known to me.

Well change it to call qemu-kvm then :)
Also what happens if you install qemu as well?
Does it conflict?

Quoted 2 lines

I'm not quite sure why you say "legacy management applications".

Because any non legacy one can be patched.

Quoted 6 lines

This applies to /any/ management application. Unless we're going to burden every management application with this problem, we need to fix it.

Just as a reminder, the ./configure value defaults to off, which means there is no change in current behaviour.

Yes but this still perpetuates the mess.

If you prefer using -M pc-1.0, add a new property
and teach management to set it.

But no silent compile-time behind the scenes changes please.

Quoted 11 lines

Only if the ./configure value is changed does it result in the behaviour of pc-1.0 changing, and that is evident from the help line. And it's possible to specify a specific variant of 1.0 (irrespective of the default) from the command line.

Signature · 1 line
Alex Bligh
author
#19 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 7 lines
Quoted 3 lines

Sadly that is not true. For instance on Ubuntu Precise it's invoked as qemu-system-x86_64 by at least one management application known to me.

Well change it to call qemu-kvm then :)
Also what happens if you install qemu as well?
Does it conflict?

I'm not an Ubuntu maintainer but AFAIK qemu-kvm is deprecated. It may only be there to support upgrades.

We still need to support migration from qemu running on Precise to qemu running on Trusty. The trusty instance may not have qemu-kvm installed. If we were looking at argv[0], we'd really want to look at it on the /sending/ machine.

Forcing qemu to be involved as qemu-kvm solely on the basis some users might want to migrate a VM in from a previous version does not sound practical.

Quoted 4 lines
Quoted 2 lines

I'm not quite sure why you say "legacy management applications".

Because any non legacy one can be patched.

Well this is where we diverge. I think the distro needs a way to change the default behaviour, i.e. so the existing command line will do something different.

Quoted 7 lines
Quoted 6 lines

This applies to /any/ management application. Unless we're going to burden every management application with this problem, we need to fix it.

Just as a reminder, the ./configure value defaults to off, which means there is no change in current behaviour.

Quoted 6 lines

Yes but this still perpetuates the mess.

If you prefer using -M pc-1.0, add a new property
and teach management to set it.

But no silent compile-time behind the scenes changes please.

OK, how about we keep the aliases, and make pc-1.0 default to the pc-1.0-qemu-git. We then add a command line option to make pc-1.0 mean pc-1.0-qemu-kvm, with that obviously defaulting to off.

Then distros can then put the option in
/etc/qemu/target-x86_64.conf or whatever.

Signature · 1 line
Alex Bligh
#20 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Am 22.09.2014 um 15:05 schrieb Alex Bligh:

Quoted 43 lines
Quoted 7 lines
Quoted 3 lines

Sadly that is not true. For instance on Ubuntu Precise it's invoked as qemu-system-x86_64 by at least one management application known to me.

Well change it to call qemu-kvm then :)
Also what happens if you install qemu as well?
Does it conflict?

I'm not an Ubuntu maintainer but AFAIK qemu-kvm is deprecated. It may only be there to support upgrades.

We still need to support migration from qemu running on Precise to qemu running on Trusty. The trusty instance may not have qemu-kvm installed. If we were looking at argv[0], we'd really want to look at it on the /sending/ machine.

Forcing qemu to be involved as qemu-kvm solely on the basis some users might want to migrate a VM in from a previous version does not sound practical.

Quoted 4 lines
Quoted 2 lines

I'm not quite sure why you say "legacy management applications".

Because any non legacy one can be patched.

Well this is where we diverge. I think the distro needs a way to change the default behaviour, i.e. so the existing command line will do something different.

Quoted 7 lines
Quoted 6 lines

This applies to /any/ management application. Unless we're going to burden every management application with this problem, we need to fix it.

Just as a reminder, the ./configure value defaults to off, which means there is no change in current behaviour.

Quoted 6 lines

Yes but this still perpetuates the mess.

If you prefer using -M pc-1.0, add a new property
and teach management to set it.

But no silent compile-time behind the scenes changes please.

Quoted 7 lines

OK, how about we keep the aliases, and make pc-1.0 default to the pc-1.0-qemu-git. We then add a command line option to make pc-1.0 mean pc-1.0-qemu-kvm, with that obviously defaulting to off.

Then distros can then put the option in
/etc/qemu/target-x86_64.conf or whatever.

What about adding a bool property "qemu-kvm-compat" to the MachineClass? Then a qemu-kvm shell script (like SUSE uses) can pass -global machine.qemu-kvm-compat=on whereas qemu-system-x86_64 would run in the default non-qemu-kvm mode (config on disk would affect both). It would also allow running -machine pc-0.15,qemu-kvm-compat=on, ditching lots of new machine names and avoiding the name bikeshedding.

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
author
#21 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 6 lines · Andreas Färber

What about adding a bool property "qemu-kvm-compat" to the MachineClass? Then a qemu-kvm shell script (like SUSE uses) can pass -global machine.qemu-kvm-compat=on whereas qemu-system-x86_64 would run in the default non-qemu-kvm mode (config on disk would affect both). It would also allow running -machine pc-0.15,qemu-kvm-compat=on, ditching lots of new machine names and avoiding the name bikeshedding.

I'd be happy with that. Presumably downstream can then patch things so qemu-kvm-compat defaults in the way they want (if we don't like the configure option).

However, that's not compatible with using PC_COMPAT as far as I know (unless there is some cunning way you can make a machine parameter change compat_props things).

Signature · 1 line
Alex Bligh
#22 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 5 lines · Alex Bligh
Quoted 3 lines · Andreas Färber

What about adding a bool property "qemu-kvm-compat" to the MachineClass? Then a qemu-kvm shell script (like SUSE uses) can pass -global machine.qemu-kvm-compat=on whereas qemu-system-x86_64 would run in the

No need to mess with -global, just use -machine qemu-kvm-compat=off. You can have multiple -machine, and the last key=value wins.

Quoted 11 lines
Quoted 3 lines

default non-qemu-kvm mode (config on disk would affect both). It would also allow running -machine pc-0.15,qemu-kvm-compat=on, ditching lots of new machine names and avoiding the name bikeshedding.

I'd be happy with that. Presumably downstream can then patch things so qemu-kvm-compat defaults in the way they want (if we don't like the configure option).

However, that's not compatible with using PC_COMPAT as far as I know (unless there is some cunning way you can make a machine parameter change compat_props things).

Monkey-patching MACHINE_GET_CLASS(machine)->compat_props? Gross, but I don't have better ideas to offer.

#23 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

In reply to Alex Bligh
Quoted 3 lines · Alex Bligh

However, that's not compatible with using PC_COMPAT as far as I know (unless there is some cunning way you can make a machine parameter change compat_props things).

Of course not, PC_COMPAT is the reverse: have machine type influence properties.

#24 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

In reply to Andreas Färber
Quoted 59 lines · Andreas Färber

Am 22.09.2014 um 15:05 schrieb Alex Bligh:

Quoted 43 lines
Quoted 7 lines
Quoted 3 lines

Sadly that is not true. For instance on Ubuntu Precise it's invoked as qemu-system-x86_64 by at least one management application known to me.

Well change it to call qemu-kvm then :)
Also what happens if you install qemu as well?
Does it conflict?

I'm not an Ubuntu maintainer but AFAIK qemu-kvm is deprecated. It may only be there to support upgrades.

We still need to support migration from qemu running on Precise to qemu running on Trusty. The trusty instance may not have qemu-kvm installed. If we were looking at argv[0], we'd really want to look at it on the /sending/ machine.

Forcing qemu to be involved as qemu-kvm solely on the basis some users might want to migrate a VM in from a previous version does not sound practical.

Quoted 4 lines
Quoted 2 lines

I'm not quite sure why you say "legacy management applications".

Because any non legacy one can be patched.

Well this is where we diverge. I think the distro needs a way to change the default behaviour, i.e. so the existing command line will do something different.

Quoted 7 lines
Quoted 6 lines

This applies to /any/ management application. Unless we're going to burden every management application with this problem, we need to fix it.

Just as a reminder, the ./configure value defaults to off, which means there is no change in current behaviour.

Quoted 6 lines

Yes but this still perpetuates the mess.

If you prefer using -M pc-1.0, add a new property
and teach management to set it.

But no silent compile-time behind the scenes changes please.

Quoted 7 lines

OK, how about we keep the aliases, and make pc-1.0 default to the pc-1.0-qemu-git. We then add a command line option to make pc-1.0 mean pc-1.0-qemu-kvm, with that obviously defaulting to off.

Then distros can then put the option in
/etc/qemu/target-x86_64.conf or whatever.

What about adding a bool property "qemu-kvm-compat" to the MachineClass? Then a qemu-kvm shell script (like SUSE uses) can pass -global machine.qemu-kvm-compat=on whereas qemu-system-x86_64 would run in the default non-qemu-kvm mode (config on disk would affect both). It would also allow running -machine pc-0.15,qemu-kvm-compat=on, ditching lots of new machine names and avoiding the name bikeshedding.

Quoted 2 lines

Regards,
Andreas

Ack. Exactly.

Quoted 3 lines
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#25 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

In reply to Michael S. Tsirkin
Quoted 17 lines · Michael S. Tsirkin
Quoted 11 lines · Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

I have to say, this one bothers me.
We end up not being able to predict what does pc-1.0 reference.

Quoted 6 lines

Users also don't get qemu from git so I don't see why does git make sense in the name?

Legacy management applications invoked qemu as qemu-kvm - how about detecting that name and switching
the machine types?

Ugh! I like that even less than a configure option.

Quoted 2 lines

It might make sense to also set -enable-kvm and change default CPU to kvm64 in this case.

Yup.

#26 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 19 lines · Markus Armbruster
Quoted 17 lines · Michael S. Tsirkin
Quoted 11 lines · Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

I have to say, this one bothers me.
We end up not being able to predict what does pc-1.0 reference.

Quoted 8 lines
Quoted 6 lines

Users also don't get qemu from git so I don't see why does git make sense in the name?

Legacy management applications invoked qemu as qemu-kvm - how about detecting that name and switching
the machine types?

Ugh! I like that even less than a configure option.

configure options are tested even less than runtime ones:
each distro has to pick up a set of options and all
users are stuck with it.
So let's assume Ubuntu sets this and something is broken. How is a Fedora user to test this? Find out configure flags that Ubuntu uses and rebuild from source? It's hard to get people to triage bugs as it is.
That's why changing behaviour in subtle ways depending on configure options is a very bad idea.

So a flag might be better, but if we want to be compatible with qemu-kvm, poking at argv[0] still better than configure.

Quoted 4 lines
Quoted 2 lines

It might make sense to also set -enable-kvm and change default CPU to kvm64 in this case.

Yup.

#27 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 29 lines · Michael S. Tsirkin
Quoted 19 lines · Markus Armbruster
Quoted 17 lines · Michael S. Tsirkin
Quoted 11 lines · Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

I have to say, this one bothers me.
We end up not being able to predict what does pc-1.0 reference.

Quoted 8 lines
Quoted 6 lines

Users also don't get qemu from git so I don't see why does git make sense in the name?

Legacy management applications invoked qemu as qemu-kvm - how about detecting that name and switching
the machine types?

Ugh! I like that even less than a configure option.

Quoted 9 lines

configure options are tested even less than runtime ones:
each distro has to pick up a set of options and all
users are stuck with it.
So let's assume Ubuntu sets this and something is broken. How is a Fedora user to test this? Find out configure flags that Ubuntu uses and rebuild from source? It's hard to get people to triage bugs as it is.
That's why changing behaviour in subtle ways depending on configure options is a very bad idea.

All it changes is a default machine type. I wouldn't classify that as "very bad". Fortunately, our difference of opinion doesn't matter, because the conclusion of the thread is "leave it to the distros".

Quoted 2 lines

So a flag might be better, but if we want to be compatible with qemu-kvm, poking at argv[0] still better than configure.

That I do consider a genuinely bad idea.

Example of usage messed up by it: I symlink from my ~/bin to executables in various build trees. If one of these programs changed behavior depending on what it finds in argv[0], I'd have to know *exactly* how it matches argv[0] to choose suitable names for my symlinks.

The name "qemu-kvm" is not a useful indicator of compatibility with the qemu-kvm fork of QEMU anyway. There are programs out there calling themselves qemu-kvm that aren't compatible with the qemu-kvm fork. And there are programs out there that are compatible, but call themselves something else.

#28 lore raw

Re: [Qemu-devel] [PATCH v3 2/2] Add configure option --enable-pc-1-0-qemu-kvm

Quoted 55 lines · Markus Armbruster
Quoted 29 lines · Michael S. Tsirkin
Quoted 19 lines · Markus Armbruster
Quoted 17 lines · Michael S. Tsirkin
Quoted 11 lines · Alex Bligh

Add a configure option --enable-pc-1-0-qemu-kvm and the corresponding --disable-pc-1-0-qemu-kvm, defaulting to disabled.

Rename machine type pc-1.0 to pc-1.0-qemu-git.

Make pc-1.0 machine type an alias of either pc-1.0-qemu-kvm or pc-1.0-qemu-git depending on the value of the config option.

I have to say, this one bothers me.
We end up not being able to predict what does pc-1.0 reference.

Quoted 8 lines
Quoted 6 lines

Users also don't get qemu from git so I don't see why does git make sense in the name?

Legacy management applications invoked qemu as qemu-kvm - how about detecting that name and switching
the machine types?

Ugh! I like that even less than a configure option.

Quoted 9 lines

configure options are tested even less than runtime ones:
each distro has to pick up a set of options and all
users are stuck with it.
So let's assume Ubuntu sets this and something is broken. How is a Fedora user to test this? Find out configure flags that Ubuntu uses and rebuild from source? It's hard to get people to triage bugs as it is.
That's why changing behaviour in subtle ways depending on configure options is a very bad idea.

All it changes is a default machine type. I wouldn't classify that as "very bad". Fortunately, our difference of opinion doesn't matter, because the conclusion of the thread is "leave it to the distros".

Quoted 2 lines

So a flag might be better, but if we want to be compatible with qemu-kvm, poking at argv[0] still better than configure.

That I do consider a genuinely bad idea.

Example of usage messed up by it: I symlink from my ~/bin to executables in various build trees. If one of these programs changed behavior depending on what it finds in argv[0], I'd have to know *exactly* how it matches argv[0] to choose suitable names for my symlinks.

Quoted 5 lines

The name "qemu-kvm" is not a useful indicator of compatibility with the qemu-kvm fork of QEMU anyway. There are programs out there calling themselves qemu-kvm that aren't compatible with the qemu-kvm fork. And there are programs out there that are compatible, but call themselves something else.

I think the approach v4 takes is reasonable, though. I didn't look at the implementation yet.

Signature · 1 line
MST