[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 4/7] numa: Introduce and use ram_block_notify_remap()
From: |
“William Roche |
Subject: |
[PATCH v4 4/7] numa: Introduce and use ram_block_notify_remap() |
Date: |
Sat, 14 Dec 2024 13:45:52 +0000 |
From: David Hildenbrand <david@redhat.com>
Notify registered listeners about the remap at the end of
qemu_ram_remap() so e.g., a memory backend can re-apply its
settings correctly.
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: William Roche <william.roche@oracle.com>
---
hw/core/numa.c | 11 +++++++++++
include/exec/ramlist.h | 3 +++
system/physmem.c | 1 +
3 files changed, 15 insertions(+)
diff --git a/hw/core/numa.c b/hw/core/numa.c
index 1b5f44baea..4ca67db483 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -895,3 +895,14 @@ void ram_block_notify_resize(void *host, size_t old_size,
size_t new_size)
}
}
}
+
+void ram_block_notify_remap(void *host, size_t offset, size_t size)
+{
+ RAMBlockNotifier *notifier;
+
+ QLIST_FOREACH(notifier, &ram_list.ramblock_notifiers, next) {
+ if (notifier->ram_block_remapped) {
+ notifier->ram_block_remapped(notifier, host, offset, size);
+ }
+ }
+}
diff --git a/include/exec/ramlist.h b/include/exec/ramlist.h
index d9cfe530be..c1dc785a57 100644
--- a/include/exec/ramlist.h
+++ b/include/exec/ramlist.h
@@ -72,6 +72,8 @@ struct RAMBlockNotifier {
size_t max_size);
void (*ram_block_resized)(RAMBlockNotifier *n, void *host, size_t old_size,
size_t new_size);
+ void (*ram_block_remapped)(RAMBlockNotifier *n, void *host, size_t offset,
+ size_t size);
QLIST_ENTRY(RAMBlockNotifier) next;
};
@@ -80,6 +82,7 @@ void ram_block_notifier_remove(RAMBlockNotifier *n);
void ram_block_notify_add(void *host, size_t size, size_t max_size);
void ram_block_notify_remove(void *host, size_t size, size_t max_size);
void ram_block_notify_resize(void *host, size_t old_size, size_t new_size);
+void ram_block_notify_remap(void *host, size_t offset, size_t size);
GString *ram_block_format(void);
diff --git a/system/physmem.c b/system/physmem.c
index b228a692f8..9fc74a5699 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -2244,6 +2244,7 @@ void qemu_ram_remap(ram_addr_t addr)
}
memory_try_enable_merging(vaddr, page_size);
qemu_ram_setup_dump(vaddr, page_size);
+ ram_block_notify_remap(block->host, offset, page_size);
}
break;
--
2.43.5
- [PATCH v4 0/7] Poisoned memory recovery on reboot, “William Roche, 2024/12/14
- [PATCH v4 1/7] hwpoison_page_list and qemu_ram_remap are based on pages, “William Roche, 2024/12/14
- [PATCH v4 5/7] hostmem: Factor out applying settings, “William Roche, 2024/12/14
- [PATCH v4 3/7] accel/kvm: Report the loss of a large memory page, “William Roche, 2024/12/14
- [PATCH v4 7/7] system/physmem: Memory settings applied on remap notification, “William Roche, 2024/12/14
- [PATCH v4 2/7] system/physmem: poisoned memory discard on reboot, “William Roche, 2024/12/14
- [PATCH v4 4/7] numa: Introduce and use ram_block_notify_remap(),
“William Roche <=
- [PATCH v4 6/7] hostmem: Handle remapping of RAM, “William Roche, 2024/12/14