Skip to contentSkip to conversation

virtio: move 'use-disabled-flag' property to hw_compat_4_2

PATCH Applied Stefano Garzarella 3 participants 8 messages Jan 8, 2021 – Jan 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio: move 'use-disabled-flag' property to hw_compat_4_2

Commit 9d7bd0826f introduced a new 'use-disabled-flag' property set to true by default.
To allow the migration, we set this property to false in the hw_compat, but in the wrong place (hw_compat_4_1).

Since commit 9d7bd0826f was released with QEMU 5.0, we move 'use-disabled-flag' property to hw_compat_4_2, so 4.2 machine types will have the pre-patch behavior and the migration can work.

The issue was discovered with vhost-vsock device and 4.2 machine type without running any kernel in the VM:

    $ qemu-4.2 -M pc-q35-4.2,accel=kvm \
        -device vhost-vsock-pci,guest-cid=4 \
        -monitor stdio -incoming tcp:0:3333
    $ qemu-5.2 -M pc-q35-4.2,accel=kvm \
        -device vhost-vsock-pci,guest-cid=3 \
        -monitor stdio
    (qemu) migrate -d tcp:0:3333
    # qemu-4.2 output
    qemu-system-x86_64: Failed to load virtio-vhost_vsock:virtio
    qemu-system-x86_64: error while loading state for instance 0x0 of device '0000:00:03.0/virtio-vhost_vsock'
    qemu-system-x86_64: load of migration failed: No such file or directory
Fixes 9d7bd0826f ("virtio-pci: disable vring processing when bus-mastering is disabled")
---
 hw/core/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/machine.c +1 -1
index de3b8f1b31..5d6163ab70 100644
@@ -70,12 +70,12 @@ GlobalProperty hw_compat_4_2[] = {
     { "qxl", "revision", "4" },
     { "qxl-vga", "revision", "4" },
     { "fw_cfg", "acpi-mr-restore", "false" },
+    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2);
 
 GlobalProperty hw_compat_4_1[] = {
     { "virtio-pci", "x-pcie-flr-init", "off" },
-    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_1_len = G_N_ELEMENTS(hw_compat_4_1);
 
Signature · 1 line
2.26.2
#1 lore raw

Ping :-)

Quoted 57 lines · Stefano Garzarella

Commit 9d7bd0826f introduced a new 'use-disabled-flag' property set to true by default.
To allow the migration, we set this property to false in the hw_compat, but in the wrong place (hw_compat_4_1).

Since commit 9d7bd0826f was released with QEMU 5.0, we move 'use-disabled-flag' property to hw_compat_4_2, so 4.2 machine types will have the pre-patch behavior and the migration can work.

The issue was discovered with vhost-vsock device and 4.2 machine type without running any kernel in the VM:

   $ qemu-4.2 -M pc-q35-4.2,accel=kvm \
       -device vhost-vsock-pci,guest-cid=4 \
       -monitor stdio -incoming tcp:0:3333
   $ qemu-5.2 -M pc-q35-4.2,accel=kvm \
       -device vhost-vsock-pci,guest-cid=3 \
       -monitor stdio
   (qemu) migrate -d tcp:0:3333
   # qemu-4.2 output
   qemu-system-x86_64: Failed to load virtio-vhost_vsock:virtio
   qemu-system-x86_64: error while loading state for instance 0x0 of device '0000:00:03.0/virtio-vhost_vsock'
   qemu-system-x86_64: load of migration failed: No such file or directory
Fixes 9d7bd0826f ("virtio-pci: disable vring processing when bus-mastering is disabled")

---
hw/core/machine.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/machine.c +1 -1
index de3b8f1b31..5d6163ab70 100644
@@ -70,12 +70,12 @@ GlobalProperty hw_compat_4_2[] = {
    { "qxl", "revision", "4" },
    { "qxl-vga", "revision", "4" },
    { "fw_cfg", "acpi-mr-restore", "false" },
+    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2);
 
 GlobalProperty hw_compat_4_1[] = {
    { "virtio-pci", "x-pcie-flr-init", "off" },
-    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_1_len = G_N_ELEMENTS(hw_compat_4_1);
 
Signature · 1 line
2.26.2
#2 lore raw

queued, thanks!

Quoted 60 lines · Stefano Garzarella

Ping :-)

Quoted 57 lines · Stefano Garzarella

Commit 9d7bd0826f introduced a new 'use-disabled-flag' property set to true by default.
To allow the migration, we set this property to false in the hw_compat, but in the wrong place (hw_compat_4_1).

Since commit 9d7bd0826f was released with QEMU 5.0, we move 'use-disabled-flag' property to hw_compat_4_2, so 4.2 machine types will have the pre-patch behavior and the migration can work.

The issue was discovered with vhost-vsock device and 4.2 machine type without running any kernel in the VM:

   $ qemu-4.2 -M pc-q35-4.2,accel=kvm \
       -device vhost-vsock-pci,guest-cid=4 \
       -monitor stdio -incoming tcp:0:3333
   $ qemu-5.2 -M pc-q35-4.2,accel=kvm \
       -device vhost-vsock-pci,guest-cid=3 \
       -monitor stdio
   (qemu) migrate -d tcp:0:3333
   # qemu-4.2 output
   qemu-system-x86_64: Failed to load virtio-vhost_vsock:virtio
   qemu-system-x86_64: error while loading state for instance 0x0 of device '0000:00:03.0/virtio-vhost_vsock'
   qemu-system-x86_64: load of migration failed: No such file or directory
Fixes 9d7bd0826f ("virtio-pci: disable vring processing when bus-mastering is disabled")

---
hw/core/machine.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/machine.c +1 -1
index de3b8f1b31..5d6163ab70 100644
@@ -70,12 +70,12 @@ GlobalProperty hw_compat_4_2[] = {
    { "qxl", "revision", "4" },
    { "qxl-vga", "revision", "4" },
    { "fw_cfg", "acpi-mr-restore", "false" },
+    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2);
 
 GlobalProperty hw_compat_4_1[] = {
    { "virtio-pci", "x-pcie-flr-init", "off" },
-    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_1_len = G_N_ELEMENTS(hw_compat_4_1);
 
Signature · 1 line
2.26.2
#3 lore raw
In reply to Stefano Garzarella
Quoted 8 lines · * Stefano Garzarella ([email protected]) wrote:

Commit 9d7bd0826f introduced a new 'use-disabled-flag' property set to true by default.
To allow the migration, we set this property to false in the hw_compat, but in the wrong place (hw_compat_4_1).

Since commit 9d7bd0826f was released with QEMU 5.0, we move 'use-disabled-flag' property to hw_compat_4_2, so 4.2 machine types will have the pre-patch behavior and the migration can work.

Be a little careful that fixing this probably causes a migration from 5.2->6.0 to fail with this machine type; so when we do these type of fixes we often fix an old machine type between some pair of qemu versions and then break it between a different set.

Dave

Quoted 47 lines

The issue was discovered with vhost-vsock device and 4.2 machine type without running any kernel in the VM:

    $ qemu-4.2 -M pc-q35-4.2,accel=kvm \
        -device vhost-vsock-pci,guest-cid=4 \
        -monitor stdio -incoming tcp:0:3333
    $ qemu-5.2 -M pc-q35-4.2,accel=kvm \
        -device vhost-vsock-pci,guest-cid=3 \
        -monitor stdio
    (qemu) migrate -d tcp:0:3333
    # qemu-4.2 output
    qemu-system-x86_64: Failed to load virtio-vhost_vsock:virtio
    qemu-system-x86_64: error while loading state for instance 0x0 of device '0000:00:03.0/virtio-vhost_vsock'
    qemu-system-x86_64: load of migration failed: No such file or directory
Fixes 9d7bd0826f ("virtio-pci: disable vring processing when bus-mastering is disabled")
---
 hw/core/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/machine.c +1 -1
index de3b8f1b31..5d6163ab70 100644
@@ -70,12 +70,12 @@ GlobalProperty hw_compat_4_2[] = {
     { "qxl", "revision", "4" },
     { "qxl-vga", "revision", "4" },
     { "fw_cfg", "acpi-mr-restore", "false" },
+    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2);
 
 GlobalProperty hw_compat_4_1[] = {
     { "virtio-pci", "x-pcie-flr-init", "off" },
-    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_1_len = G_N_ELEMENTS(hw_compat_4_1);
 
Signature · 1 line
2.26.2
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#4 lore raw
Quoted 6 lines · Dr. David Alan Gilbert
Quoted 5 lines · * Stefano Garzarella ([email protected]) wrote:

Commit 9d7bd0826f introduced a new 'use-disabled-flag' property set to true by default.
To allow the migration, we set this property to false in the hw_compat, but in the wrong place (hw_compat_4_1).

Quoted 8 lines
Quoted 3 lines

Since commit 9d7bd0826f was released with QEMU 5.0, we move 'use-disabled-flag' property to hw_compat_4_2, so 4.2 machine types will have the pre-patch behavior and the migration can work.

Be a little careful that fixing this probably causes a migration from 5.2->6.0 to fail with this machine type; so when we do these type of fixes we often fix an old machine type between some pair of qemu versions and then break it between a different set.

Good point!

I did some tests using the example below always using pc-q35-4.2 and it seems that works well:

- 5.2 -> 6.0 pass
- 5.2 -> 4.2 FAIL

- 6.0 -> 5.2    pass
- 6.0 -> 4.2    pass
- 4.2 -> 5.2    pass
- 4.2 -> 6.0    pass

Should I run some more tests?

Thanks,
Stefano

Quoted 53 lines

Dave

Quoted 47 lines

The issue was discovered with vhost-vsock device and 4.2 machine type without running any kernel in the VM:

    $ qemu-4.2 -M pc-q35-4.2,accel=kvm \
        -device vhost-vsock-pci,guest-cid=4 \
        -monitor stdio -incoming tcp:0:3333
    $ qemu-5.2 -M pc-q35-4.2,accel=kvm \
        -device vhost-vsock-pci,guest-cid=3 \
        -monitor stdio
    (qemu) migrate -d tcp:0:3333
    # qemu-4.2 output
    qemu-system-x86_64: Failed to load virtio-vhost_vsock:virtio
    qemu-system-x86_64: error while loading state for instance 0x0 of device '0000:00:03.0/virtio-vhost_vsock'
    qemu-system-x86_64: load of migration failed: No such file or directory
Fixes 9d7bd0826f ("virtio-pci: disable vring processing when bus-mastering is disabled")
---
 hw/core/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/machine.c +1 -2
index de3b8f1b31..5d6163ab70 100644
@@ -70,12 +70,12 @@ GlobalProperty hw_compat_4_2[] = {
     { "qxl", "revision", "4" },
     { "qxl-vga", "revision", "4" },
     { "fw_cfg", "acpi-mr-restore", "false" },
+    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2);
 
 GlobalProperty hw_compat_4_1[] = {
     { "virtio-pci", "x-pcie-flr-init", "off" },
-    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_1_len = G_N_ELEMENTS(hw_compat_4_1);
 
--

2.26.2

Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#5 lore raw
Quoted 28 lines · Stefano Garzarella
Quoted 6 lines · Dr. David Alan Gilbert
Quoted 5 lines · * Stefano Garzarella ([email protected]) wrote:

Commit 9d7bd0826f introduced a new 'use-disabled-flag' property set to true by default.
To allow the migration, we set this property to false in the hw_compat, but in the wrong place (hw_compat_4_1).

Quoted 8 lines
Quoted 3 lines

Since commit 9d7bd0826f was released with QEMU 5.0, we move 'use-disabled-flag' property to hw_compat_4_2, so 4.2 machine types will have the pre-patch behavior and the migration can work.

Be a little careful that fixing this probably causes a migration from 5.2->6.0 to fail with this machine type; so when we do these type of fixes we often fix an old machine type between some pair of qemu versions and then break it between a different set.

Good point!

I did some tests using the example below always using pc-q35-4.2 and it seems that works well:

- 5.2 -> 6.0 pass
- 5.2 -> 4.2 FAIL

- 6.0 -> 5.2    pass
- 6.0 -> 4.2    pass
- 4.2 -> 5.2    pass
- 4.2 -> 6.0    pass
Quoted 4 lines

Should I run some more tests?

Thanks,
Stefano

dgilbert how about an ack?

Quoted 53 lines
Quoted 53 lines

Dave

Quoted 47 lines

The issue was discovered with vhost-vsock device and 4.2 machine type without running any kernel in the VM:

    $ qemu-4.2 -M pc-q35-4.2,accel=kvm \
        -device vhost-vsock-pci,guest-cid=4 \
        -monitor stdio -incoming tcp:0:3333
    $ qemu-5.2 -M pc-q35-4.2,accel=kvm \
        -device vhost-vsock-pci,guest-cid=3 \
        -monitor stdio
    (qemu) migrate -d tcp:0:3333
    # qemu-4.2 output
    qemu-system-x86_64: Failed to load virtio-vhost_vsock:virtio
    qemu-system-x86_64: error while loading state for instance 0x0 of device '0000:00:03.0/virtio-vhost_vsock'
    qemu-system-x86_64: load of migration failed: No such file or directory
Fixes 9d7bd0826f ("virtio-pci: disable vring processing when bus-mastering is disabled")
---
 hw/core/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/machine.c +1 -2
index de3b8f1b31..5d6163ab70 100644
@@ -70,12 +70,12 @@ GlobalProperty hw_compat_4_2[] = {
     { "qxl", "revision", "4" },
     { "qxl-vga", "revision", "4" },
     { "fw_cfg", "acpi-mr-restore", "false" },
+    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2);
 
 GlobalProperty hw_compat_4_1[] = {
     { "virtio-pci", "x-pcie-flr-init", "off" },
-    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_1_len = G_N_ELEMENTS(hw_compat_4_1);
 
--

2.26.2

Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#6 lore raw
In reply to Stefano Garzarella
Quoted 21 lines · * Stefano Garzarella ([email protected]) wrote:
Quoted 6 lines · Dr. David Alan Gilbert
Quoted 5 lines · * Stefano Garzarella ([email protected]) wrote:

Commit 9d7bd0826f introduced a new 'use-disabled-flag' property set to true by default.
To allow the migration, we set this property to false in the hw_compat, but in the wrong place (hw_compat_4_1).

Quoted 8 lines
Quoted 3 lines

Since commit 9d7bd0826f was released with QEMU 5.0, we move 'use-disabled-flag' property to hw_compat_4_2, so 4.2 machine types will have the pre-patch behavior and the migration can work.

Be a little careful that fixing this probably causes a migration from 5.2->6.0 to fail with this machine type; so when we do these type of fixes we often fix an old machine type between some pair of qemu versions and then break it between a different set.

Good point!

I did some tests using the example below always using pc-q35-4.2 and it seems that works well:

Quoted 8 lines

- 5.2 -> 6.0 pass
- 5.2 -> 4.2 FAIL

- 6.0 -> 5.2    pass
- 6.0 -> 4.2    pass
- 4.2 -> 5.2    pass
- 4.2 -> 6.0    pass

Should I run some more tests?

Apologies for the delay; I had to step back and understand a bit about what was going on.

The problem here is that you're sending a 'disabled' subsection when that option is true; your patch doesn't change the 4.1 machine type but it does change the 4.2 machine type; and that makes the 4.2 machine type not send it; so that means your patched version *will* work to existing code (because it's a subsection anyway it doesn't break the stream format when it's missing).

Quoted 57 lines

Thanks,
Stefano

Quoted 53 lines

Dave

Quoted 47 lines

The issue was discovered with vhost-vsock device and 4.2 machine type without running any kernel in the VM:

    $ qemu-4.2 -M pc-q35-4.2,accel=kvm \
        -device vhost-vsock-pci,guest-cid=4 \
        -monitor stdio -incoming tcp:0:3333
    $ qemu-5.2 -M pc-q35-4.2,accel=kvm \
        -device vhost-vsock-pci,guest-cid=3 \
        -monitor stdio
    (qemu) migrate -d tcp:0:3333
    # qemu-4.2 output
    qemu-system-x86_64: Failed to load virtio-vhost_vsock:virtio
    qemu-system-x86_64: error while loading state for instance 0x0 of device '0000:00:03.0/virtio-vhost_vsock'
    qemu-system-x86_64: load of migration failed: No such file or directory
Fixes 9d7bd0826f ("virtio-pci: disable vring processing when bus-mastering is disabled")
---
 hw/core/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/machine.c +1 -2
index de3b8f1b31..5d6163ab70 100644
@@ -70,12 +70,12 @@ GlobalProperty hw_compat_4_2[] = {
     { "qxl", "revision", "4" },
     { "qxl-vga", "revision", "4" },
     { "fw_cfg", "acpi-mr-restore", "false" },
+    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_2_len = G_N_ELEMENTS(hw_compat_4_2);
 
 GlobalProperty hw_compat_4_1[] = {
     { "virtio-pci", "x-pcie-flr-init", "off" },
-    { "virtio-device", "use-disabled-flag", "false" },
 };
 const size_t hw_compat_4_1_len = G_N_ELEMENTS(hw_compat_4_1);
 
--

2.26.2

Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
#7 lore raw
Quoted 29 lines · Dr. David Alan Gilbert
Quoted 28 lines · * Stefano Garzarella ([email protected]) wrote:
Quoted 6 lines · Dr. David Alan Gilbert
Quoted 5 lines · * Stefano Garzarella ([email protected]) wrote:

Commit 9d7bd0826f introduced a new 'use-disabled-flag' property set to true by default.
To allow the migration, we set this property to false in the hw_compat, but in the wrong place (hw_compat_4_1).

Quoted 8 lines
Quoted 3 lines

Since commit 9d7bd0826f was released with QEMU 5.0, we move 'use-disabled-flag' property to hw_compat_4_2, so 4.2 machine types will have the pre-patch behavior and the migration can work.

Be a little careful that fixing this probably causes a migration from 5.2->6.0 to fail with this machine type; so when we do these type of fixes we often fix an old machine type between some pair of qemu versions and then break it between a different set.

Good point!

I did some tests using the example below always using pc-q35-4.2 and it seems that works well:

- 5.2 -> 6.0 pass
- 5.2 -> 4.2 FAIL

- 6.0 -> 5.2    pass
- 6.0 -> 4.2    pass
- 4.2 -> 5.2    pass
- 4.2 -> 6.0    pass
Quoted 4 lines
Quoted 1 line

Should I run some more tests?

Apologies for the delay; I had to step back and understand a bit about what was going on.

no problem :-)

Quoted 8 lines

The problem here is that you're sending a 'disabled' subsection when that option is true; your patch doesn't change the 4.1 machine type but it does change the 4.2 machine type; and that makes the 4.2 machine type not send it; so that means your patched version *will* work to existing code (because it's a subsection anyway it doesn't break the stream format when it's missing).

Thanks for the detailed explanation!

Quoted 3 lines

Thanks,
Stefano