]> git.ipfire.org Git - thirdparty/qemu.git/commit
s390x/css: reassign subchannel if schid is changed after migration
authorDong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Thu, 16 Feb 2017 05:27:33 +0000 (06:27 +0100)
committerCornelia Huck <cornelia.huck@de.ibm.com>
Mon, 20 Mar 2017 08:22:57 +0000 (09:22 +0100)
commit3c788ebc6f6eef5ac6e9cb4a28c578abcf08247d
treeaf1f4c5fe4887df5ea0902aaeb5ede9901ede87b
parentebedf0f9cd46b617df331eecc857c379d574ac62
s390x/css: reassign subchannel if schid is changed after migration

The subchannel is a means to access a device. While the device number is
assigned by the administrator, the subchannel number is assigned by
the channel subsystem in an ascending order on cold and hot plug.
When doing unplug and replug operations, the same device may end up on
a different subchannel; for example

- We start with a device fe.1.2222, which ends up at subchannel
  fe.1.0000.
- Now we detach the device, attach a device fe.1.3333 (which would get
  the now-free subchannel fe.1.0000), re-attach fe.1.2222 (which ends
  up at subchannel fe.1.0001) and detach fe.1.3333.
- We now have the same device (fe.1.2222) available to the guest; it
  just shows up on a different subchannel.

In such a case, the subchannel numbers are different from what a
QEMU would create during cold plug when parsing the command line.

As this would cause a guest visible change on migration, we do restore
the source system's value of the subchannel number on load.

So we are now fine from the guest perspective. From the host
perspective this will cause an inconsistent state in our internal data
structures, though.

For example, the subchannel 0 might not be at array position 0. This will
lead to problems when we continue doing hot (un/re) plug operations.

Let's fix this by cleaning up our internal data structures.

Reported-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
hw/s390x/css.c