[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 14/15] numa: Introduce ram_block_notifiers_support_resize()
From: |
David Hildenbrand |
Subject: |
[PATCH v4 14/15] numa: Introduce ram_block_notifiers_support_resize() |
Date: |
Thu, 5 Mar 2020 15:29:44 +0100 |
We want to actually use resizeable allocations in resizeable ram blocks
(IOW, make everything between used_length and max_length inaccessible) -
however, not all ram block notifiers can support that.
Introduce a way to detect if any registered notifier does not
support resizes - ram_block_notifiers_support_resize() - which we can later
use to fallback to legacy handling if a registered notifier (esp., SEV and
HAX) does not support actual resizes.
Reviewed-by: Peter Xu <address@hidden>
Cc: Richard Henderson <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: "Dr. David Alan Gilbert" <address@hidden>
Cc: Eduardo Habkost <address@hidden>
Cc: Marcel Apfelbaum <address@hidden>
Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Igor Mammedov <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
hw/core/numa.c | 12 ++++++++++++
include/exec/ramlist.h | 1 +
2 files changed, 13 insertions(+)
diff --git a/hw/core/numa.c b/hw/core/numa.c
index 37ce175e13..1d5288c22c 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -914,3 +914,15 @@ void ram_block_notify_resize(void *host, size_t old_size,
size_t new_size)
}
}
}
+
+bool ram_block_notifiers_support_resize(void)
+{
+ RAMBlockNotifier *notifier;
+
+ QLIST_FOREACH(notifier, &ram_list.ramblock_notifiers, next) {
+ if (!notifier->ram_block_resized) {
+ return false;
+ }
+ }
+ return true;
+}
diff --git a/include/exec/ramlist.h b/include/exec/ramlist.h
index 293c0ddabe..ac5811be96 100644
--- a/include/exec/ramlist.h
+++ b/include/exec/ramlist.h
@@ -79,6 +79,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);
+bool ram_block_notifiers_support_resize(void);
void ram_block_dump(Monitor *mon);
--
2.24.1
- [PATCH v4 10/15] util/mmap-alloc: Prepare for resizeable mmaps, (continued)
- [PATCH v4 10/15] util/mmap-alloc: Prepare for resizeable mmaps, David Hildenbrand, 2020/03/05
- [PATCH v4 11/15] util/mmap-alloc: Implement resizeable mmaps, David Hildenbrand, 2020/03/05
- [PATCH v4 07/15] util/mmap-alloc: Factor out calculation of the pagesize for the guard page, David Hildenbrand, 2020/03/05
- [PATCH v4 13/15] util: oslib: Resizeable anonymous allocations under POSIX, David Hildenbrand, 2020/03/05
- [PATCH v4 12/15] util: vfio-helpers: Implement ram_block_resized(), David Hildenbrand, 2020/03/05
- [PATCH v4 14/15] numa: Introduce ram_block_notifiers_support_resize(),
David Hildenbrand <=
- [PATCH v4 15/15] exec: Ram blocks with resizeable anonymous allocations under POSIX, David Hildenbrand, 2020/03/05