s390/sclp: temporarily fix unassignment/reassignment of memory subregions
commit732bdd383ee06be2655b1a849a628ff03b0000b8
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Sat, 13 Jun 2015 06:46:54 +0000 (13 08:46 +0200)
committerCornelia Huck <cornelia.huck@de.ibm.com>
Mon, 7 Sep 2015 14:10:43 +0000 (7 16:10 +0200)
tree0326fc4a3804a1904b5f9f387e81c1d1733ae208
parent35925a7a73e7df4118cb11667095bd2d8fc4e091
s390/sclp: temporarily fix unassignment/reassignment of memory subregions

Commit 374f2981d1f1 ("memory: protect current_map by RCU") broke
unassignment of standby memory on s390x. Looks like that the new
parallelism allows races with our (semi broken) memory hotplug code. The
flatview_unref() can now be executed after our unparenting. Therefore
memory_region_unref() tries to unreference the MemoryRegion itself instead
of the parent.

In theory, MemoryRegions are now bound to separate devices that control
their lifetime. We don't have this yet, so we really want to control their
lifetime manually.

This patch fixes it temporarily, until we have a proper rework. The only
drawback is that they won't pop up in "info qom-tree", but that's better
than qemu crashes.

We have to release the reference to a memory region after a
memory_region_find, as it automatically takes a reference. As we're now
able to reassign memory, the MemoryRegion is in fact deleted (otherwise
vmstate_register_ram() would complain).

Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
hw/s390x/sclp.c