qemu-e2k/hw/s390x
Halil Pasic 8ed179c937 s390x/css: catch section mismatch on load
Prior to the virtio-ccw-2.7 machine (and commit 2a79eb1a), our virtio
devices residing under the virtual-css bus do not have qdev_path based
migration stream identifiers (because their qdev_path is NULL). The ids
are instead generated when the device is registered as a composition of
the so called idstr, which takes the vmsd name as its value, and an
instance_id, which is which is calculated as a maximal instance_id
registered with the same idstr plus one, or zero (if none was registered
previously).

That means, under certain circumstances, one device might try, and even
succeed, to load the state of a different device. This can lead to
trouble.

Let us fail the migration if the above problem is detected during load.

How to reproduce the problem:
1) start qemu-system-s390x making sure you have the following devices
   defined on your command line:
     -device virtio-rng-ccw,id=rng1,devno=fe.0.0001
     -device virtio-rng-ccw,id=rng2,devno=fe.0.0002
2) detach the devices and reattach in reverse order using the monitor:
     (qemu) device_del rng1
     (qemu) device_del rng2
     (qemu) device_add virtio-rng-ccw,id=rng2,devno=fe.0.0002
     (qemu) device_add virtio-rng-ccw,id=rng1,devno=fe.0.0001
3) save the state of the vm into a temporary file and quit QEMU:
     (qemu) migrate "exec:gzip -c > /tmp/tmp_vmstate.gz"
     (qemu) q
4) use your command line from step 1 with
     -incoming "exec:gzip -c -d /tmp/tmp_vmstate.gz"
   appended to reproduce the problem (while trying to to load the saved vm)

CC: qemu-stable@nongnu.org
Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-Id: <20170518111405.56947-1-pasic@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
2017-06-06 10:16:46 +02:00
..
3270-ccw.c s390x/css: realize css_create_sch 2017-05-19 12:29:01 +02:00
Makefile.objs s390x/css: device support for s390-ccw passthrough 2017-05-19 12:29:01 +02:00
ccw-device.c s390x/css: consolidate the devno property for ccw devices 2017-04-21 09:32:09 +02:00
ccw-device.h s390x/css: consolidate the devno property for ccw devices 2017-04-21 09:32:09 +02:00
css-bridge.c s390x/css: realize css_create_sch 2017-05-19 12:29:01 +02:00
css.c s390x/css: catch section mismatch on load 2017-06-06 10:16:46 +02:00
event-facility.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
ipl.c shutdown: Add source information to SHUTDOWN and RESET 2017-05-23 13:28:17 +02:00
ipl.h hw/s390x/ipl: enable LOADPARM in IPIB for a boot device 2017-05-02 15:08:54 +02:00
s390-ccw.c s390x/css: ccw translation infrastructure 2017-05-19 12:29:01 +02:00
s390-pci-bus.c memory: tune last param of iommu_ops.translate() 2017-05-25 21:25:27 +03:00
s390-pci-bus.h s390x: use enum for adapter type and standardize its naming 2017-04-21 09:32:09 +02:00
s390-pci-inst.c memory: tune last param of iommu_ops.translate() 2017-05-25 21:25:27 +03:00
s390-pci-inst.h s390x/pci: make S390PCIIOMMU inherit Object 2017-01-20 09:48:09 +01:00
s390-skeys-kvm.c s390: Clean up includes 2016-01-29 15:07:22 +00:00
s390-skeys.c s390: use FILE instead of QEMUFile for creating text file 2016-05-26 11:31:05 +05:30
s390-virtio-ccw.c s390x/css: realize css_create_sch 2017-05-19 12:29:01 +02:00
s390-virtio-hcall.c s390: Clean up includes 2016-01-29 15:07:22 +00:00
s390-virtio.c s390x/ipl: Extend S390IPLState to support network boot 2017-02-28 12:04:48 +01:00
s390-virtio.h s390x/ipl: Extend S390IPLState to support network boot 2017-02-28 12:04:48 +01:00
sclp.c trivial patches for 2017-05-10 2017-05-10 12:31:19 -04:00
sclpcpu.c s390: Clean up includes 2016-01-29 15:07:22 +00:00
sclpquiesce.c Use #include "..." for our own headers, <...> for others 2016-07-12 16:19:16 +02:00
trace-events trace-events: fix first line comment in trace-events 2016-08-12 10:36:01 +01:00
virtio-ccw.c s390x/css: catch section mismatch on load 2017-06-06 10:16:46 +02:00
virtio-ccw.h virtio-ccw: add virtio-crypto-ccw device 2017-02-24 10:15:18 +01:00