On 04/07/2018 11:55, Peter Xu wrote: >> commit b0e56e0b63f350691b52d3e75e89bb64143fbeff >> Author: Hu Tao <hu...@cn.fujitsu.com> >> Date: Wed Apr 2 15:13:27 2014 +0800 >> >> unset RAMBlock idstr when unregister MemoryRegion >> >> Signed-off-by: Hu Tao <hu...@cn.fujitsu.com> >> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> >> >> whose commit message is a bit lacking, but >> http://lists.gnu.org/archive/html/qemu-devel/2014-04/msg00282.html helps >> more. It seems like the original bug was a reference count issue. >> >> Clearing the new migratable flag should also be unnecessary. > But even if we get rid of vmstate_unregister_ram(), the leak could > still be there? > > I'm not sure what was leaked when b0e56e0b6 was introduced, I feel > like it's the RAMBlock of the memdev. Here I think the ROM memory > region seems to be leaked as well (along with the RAMBlock inside)?
The leak would be another bug that vmstate_unregister_ram is just papering over. We need to test memory unplug with vmstate_unregister_ram removed, and fix bugs if any. Paolo