Skip to contentSkip to conversation

hw: Fix crash that happens when introspecting scsi-block on older machine types

PATCH In review Thomas Huth 3 participants 3 messages Jul 3, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw: Fix crash that happens when introspecting scsi-block on older machine types

"make check SPEED=slow" is currently failing the device-introspect-test on older machine types since introspecting "scsi-block" is causing an abort:

 $ ./qemu-system-x86_64 -M pc-q35-8.0 -monitor stdio
 QEMU 9.0.50 monitor - type 'help' for more information
 (qemu) device_add scsi-block,help
 Unexpected error in object_property_find_err() at
 ../../devel/qemu/qom/object.c:1357:
 can't apply global scsi-disk-base.migrate-emulated-scsi-request=false:
 Property 'scsi-block.migrate-emulated-scsi-request' not found
 Aborted (core dumped)

The problem is that the compat code tries to change the "migrate-emulated-scsi-request" property for all devices that are derived from "scsi-block", but the property has only been added to "scsi-hd" and "scsi-cd" via the DEFINE_SCSI_DISK_PROPERTIES macro.

Thus let's fix the problem by only changing the property on the devices that really have this property.

Fixes b4912afa5f ("scsi-disk: Fix crash for VM configured with USB CDROM after live migration")
---
 hw/core/machine.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/core/machine.c +2 -1
index 655d75c21f..60858a8565 100644
@@ -36,7 +36,8 @@
 
 GlobalProperty hw_compat_9_0[] = {
     {"arm-cpu", "backcompat-cntfrq", "true" },
-    {"scsi-disk-base", "migrate-emulated-scsi-request", "false" },
+    {"scsi-hd", "migrate-emulated-scsi-request", "false" },
+    {"scsi-cd", "migrate-emulated-scsi-request", "false" },
     {"vfio-pci", "skip-vsc-check", "false" },
 };
 const size_t hw_compat_9_0_len = G_N_ELEMENTS(hw_compat_9_0);
Signature · 1 line
2.45.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Thomas Huth

"make check SPEED=slow" is currently failing the device-introspect-test on older machine types since introspecting "scsi-block" is causing an abort:

  $ ./qemu-system-x86_64 -M pc-q35-8.0 -monitor stdio
  QEMU 9.0.50 monitor - type 'help' for more information
  (qemu) device_add scsi-block,help
  Unexpected error in object_property_find_err() at
  ../../devel/qemu/qom/object.c:1357:
  can't apply global scsi-disk-base.migrate-emulated-scsi-request=false:
  Property 'scsi-block.migrate-emulated-scsi-request' not found
  Aborted (core dumped)

The problem is that the compat code tries to change the "migrate-emulated-scsi-request" property for all devices that are derived from "scsi-block", but the property has only been added to "scsi-hd" and "scsi-cd" via the DEFINE_SCSI_DISK_PROPERTIES macro.

Quoted 4 lines

Thus let's fix the problem by only changing the property on the devices that really have this property.

Fixes b4912afa5f ("scsi-disk: Fix crash for VM configured with USB CDROM after live migration")

(FTR this commit was not reviewed).

Quoted 4 lines
---
  hw/core/machine.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Acked-by on v1 1/1
#2 lore raw
In reply to Thomas Huth
Quoted 12 lines · Thomas Huth

"make check SPEED=slow" is currently failing the device-introspect-test on older machine types since introspecting "scsi-block" is causing an abort:

 $ ./qemu-system-x86_64 -M pc-q35-8.0 -monitor stdio
 QEMU 9.0.50 monitor - type 'help' for more information
 (qemu) device_add scsi-block,help
 Unexpected error in object_property_find_err() at
 ../../devel/qemu/qom/object.c:1357:
 can't apply global scsi-disk-base.migrate-emulated-scsi-request=false:
 Property 'scsi-block.migrate-emulated-scsi-request' not found
 Aborted (core dumped)
Quoted 8 lines

The problem is that the compat code tries to change the "migrate-emulated-scsi-request" property for all devices that are derived from "scsi-block", but the property has only been added to "scsi-hd" and "scsi-cd" via the DEFINE_SCSI_DISK_PROPERTIES macro.

Thus let's fix the problem by only changing the property on the devices that really have this property.

Thanks for the fix.

Quoted 22 lines
Fixes b4912afa5f ("scsi-disk: Fix crash for VM configured with USB CDROM

after live migration")

---
 hw/core/machine.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/core/machine.c +2 -2
index 655d75c21f..60858a8565 100644
@@ -36,7 +36,8 @@
 
 GlobalProperty hw_compat_9_0[] = {
     {"arm-cpu", "backcompat-cntfrq", "true" },
-    {"scsi-disk-base", "migrate-emulated-scsi-request", "false" },
+    {"scsi-hd", "migrate-emulated-scsi-request", "false" },
+    {"scsi-cd", "migrate-emulated-scsi-request", "false" },
     {"vfio-pci", "skip-vsc-check", "false" },
 };
 const size_t hw_compat_9_0_len = G_N_ELEMENTS(hw_compat_9_0);
--
Quoted 2 lines

2.45.2

Signature · 1 line
Best regards