David Hildenbrand <da...@redhat.com> wrote: > ram_block_discard_range() cannot possibly do the right thing in > MAP_PRIVATE file mappings in the general case. > > To achieve the documented semantics, we also have to punch a hole into > the file, possibly messing with other MAP_PRIVATE/MAP_SHARED mappings > of such a file. > > For example, using VM templating -- see commit b17fbbe55cba ("migration: > allow private destination ram with x-ignore-shared") -- in combination with > any mechanism that relies on discarding of RAM is problematic. This > includes: > * Postcopy live migration > * virtio-balloon inflation/deflation or free-page-reporting > * virtio-mem > > So at least warn that there is something possibly dangerous is going on > when using ram_block_discard_range() in these cases. > > Acked-by: Peter Xu <pet...@redhat.com> > Tested-by: Mario Casquero <mcasq...@redhat.com> > Signed-off-by: David Hildenbrand <da...@redhat.com>
Reviewed-by: Juan Quintela <quint...@redhat.com> (at least we give a warning) But I wonder if we can do better and test that: * Postcopy live migration We can check if we are on postcopy, or put a marker so we know that postcopy can have problems when started. * virtio-balloon inflation/deflation or free-page-reporting We can check if we have ever used virtio-balloon. * virtio-mem We can check if we have used virtio-men I am just wondering if that is even possible? Thanks, Juan.