qemu/softmmu
David Hildenbrand 1d44ff586f softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping
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 b17fbbe55c ("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.

Message-ID: <20230706075612.67404-2-david@redhat.com>
Acked-by: Peter Xu <peterx@redhat.com>
Tested-by: Mario Casquero <mcasquer@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
2023-07-12 09:25:37 +02:00
..
arch_init.c
balloon.c
bootdevice.c
cpu-throttle.c
cpu-timers.c
cpus.c atomics: eliminate mb_read/mb_set 2023-06-06 09:42:14 +02:00
datadir.c
device_tree.c
dirtylimit.c Use new created qemu_target_pages_to_MiB() 2023-05-15 10:33:04 +02:00
dma-helpers.c
globals.c accel/tcg: Use one_insn_per_tb global instead of old singlestep global 2023-05-02 15:47:40 +01:00
icount.c icount: don't adjust virtual time backwards after warp 2023-06-27 09:00:13 +02:00
ioport.c softmmu/ioport.c: make MemoryRegionPortioList owner of portio_list MemoryRegions 2023-05-25 10:18:33 +02:00
main.c
memory.c hostmem-file: add offset option 2023-05-23 16:47:03 +02:00
memory_mapping.c
meson.build meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
physmem.c softmmu/physmem: Warn with ram_block_discard_range() on MAP_PRIVATE file mapping 2023-07-12 09:25:37 +02:00
qdev-monitor.c bulk: Remove pointless QOM casts 2023-06-05 20:48:34 +02:00
qemu-seccomp.c
qtest.c softmmu: Make qtest.c target independent 2023-04-20 11:25:32 +02:00
rtc.c
runstate-action.c
runstate-hmp-cmds.c hmp: Add 'one-insn-per-tb' command equivalent to 'singlestep' 2023-05-02 15:47:40 +01:00
runstate.c qemu_cleanup: begin drained section after vm_shutdown() 2023-07-07 12:49:22 +02:00
timers-state.h
tpm-hmp-cmds.c
tpm.c
trace-events
trace.h
vl.c softmmu/vl.c: Disable default NIC if it has not been compiled into the binary 2023-05-22 09:39:15 +02:00
watchpoint.c softmmu: Restore use of CPU watchpoint for all accelerators 2023-03-28 15:24:06 -07:00