aboutsummaryrefslogtreecommitdiff
path: root/include/exec
diff options
context:
space:
mode:
authorSteve Sistare <steven.sistare@oracle.com>2023-06-07 08:18:36 -0700
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2023-06-13 11:28:58 +0200
commitb0182e537e5aba38031a5009cb16d5e924342458 (patch)
tree67840f4419f12bc9de0005d2cbd0af316f2c4a3d /include/exec
parent6fe4f6c941923608027e10af5dd30f18d481f9b9 (diff)
downloadqemu-b0182e537e5aba38031a5009cb16d5e924342458.zip
qemu-b0182e537e5aba38031a5009cb16d5e924342458.tar.gz
qemu-b0182e537e5aba38031a5009cb16d5e924342458.tar.bz2
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>
Diffstat (limited to 'include/exec')
-rw-r--r--include/exec/cpu-common.h1
-rw-r--r--include/exec/memory.h3
2 files changed, 4 insertions, 0 deletions
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index e5a55ed..87dc9a7 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -93,6 +93,7 @@ void qemu_ram_set_uf_zeroable(RAMBlock *rb);
bool qemu_ram_is_migratable(RAMBlock *rb);
void qemu_ram_set_migratable(RAMBlock *rb);
void qemu_ram_unset_migratable(RAMBlock *rb);
+bool qemu_ram_is_named_file(RAMBlock *rb);
int qemu_ram_get_fd(RAMBlock *rb);
size_t qemu_ram_pagesize(RAMBlock *block);
diff --git a/include/exec/memory.h b/include/exec/memory.h
index c3661b2..47c2e02 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -232,6 +232,9 @@ typedef struct IOMMUTLBEvent {
/* RAM that isn't accessible through normal means. */
#define RAM_PROTECTED (1 << 8)
+/* RAM is an mmap-ed named file */
+#define RAM_NAMED_FILE (1 << 9)
+
static inline void iommu_notifier_init(IOMMUNotifier *n, IOMMUNotify fn,
IOMMUNotifierFlag flags,
hwaddr start, hwaddr end,