qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 6/7] hostmem: Handle remapping of RAM


From: William Roche
Subject: Re: [PATCH v4 6/7] hostmem: Handle remapping of RAM
Date: Fri, 10 Jan 2025 21:57:07 +0100
User-agent: Mozilla Thunderbird

On 1/8/25 22:51, David Hildenbrand wrote:
On 14.12.24 14:45, “William Roche wrote:
From: David Hildenbrand <david@redhat.com>

Let's register a RAM block notifier and react on remap notifications.
Simply re-apply the settings. Exit if something goes wrong.

Note: qemu_ram_remap() will not remap when RAM_PREALLOC is set. Could be
that hostmem is still missing to update that flag ...

I think we can drop this comment, I was probably confused when writing that :)

Note deleted from the commit message



Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: William Roche <william.roche@oracle.com>
---
  backends/hostmem.c       | 34 ++++++++++++++++++++++++++++++++++
  include/sysemu/hostmem.h |  1 +
  2 files changed, 35 insertions(+)

diff --git a/backends/hostmem.c b/backends/hostmem.c
index bf85d716e5..863f6da11d 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -361,11 +361,37 @@ static void host_memory_backend_set_prealloc_threads(Object *obj, Visitor *v,
      backend->prealloc_threads = value;
  }
+static void host_memory_backend_ram_remapped(RAMBlockNotifier *n, void *host,
+                                             size_t offset, size_t size)
+{
+    HostMemoryBackend *backend = container_of(n, HostMemoryBackend,
+                                              ram_notifier);
+    Error *err = NULL;
+
+    if (!host_memory_backend_mr_inited(backend) ||
+        memory_region_get_ram_ptr(&backend->mr) != host) {
+        return;
+    }

I think this should work, yes.

Good :)
I'm just leaving this unchanged.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]