mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
exec/memory: Introduce RAM_NAMED_FILE flag
migrate_ignore_shared() is an optimization that avoids copying memory that is visible and can be mapped on the target. However, a memory-backend-ram or a memory-backend-memfd block with the RAM_SHARED flag set is not migrated when migrate_ignore_shared() is true. This is wrong, because the block has no named backing store, and its contents will be lost. To fix, ignore shared memory iff it is a named file. Define a new flag RAM_NAMED_FILE to distinguish this case. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Reviewed-by: Peter Xu <peterx@redhat.com> Message-Id: <1686151116-253260-1-git-send-email-steven.sistare@oracle.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
6fe4f6c941
commit
b0182e537e
6 changed files with 15 additions and 4 deletions
|
@ -1570,6 +1570,11 @@ void qemu_ram_unset_migratable(RAMBlock *rb)
|
|||
rb->flags &= ~RAM_MIGRATABLE;
|
||||
}
|
||||
|
||||
bool qemu_ram_is_named_file(RAMBlock *rb)
|
||||
{
|
||||
return rb->flags & RAM_NAMED_FILE;
|
||||
}
|
||||
|
||||
int qemu_ram_get_fd(RAMBlock *rb)
|
||||
{
|
||||
return rb->fd;
|
||||
|
@ -1880,7 +1885,7 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr,
|
|||
|
||||
/* Just support these ram flags by now. */
|
||||
assert((ram_flags & ~(RAM_SHARED | RAM_PMEM | RAM_NORESERVE |
|
||||
RAM_PROTECTED)) == 0);
|
||||
RAM_PROTECTED | RAM_NAMED_FILE)) == 0);
|
||||
|
||||
if (xen_enabled()) {
|
||||
error_setg(errp, "-mem-path not supported with Xen");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue