[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 073/136] exec: cleanup qemu_minrampagesize()/qemu_maxrampagesize()
From: |
Paolo Bonzini |
Subject: |
[PULL 073/136] exec: cleanup qemu_minrampagesize()/qemu_maxrampagesize() |
Date: |
Tue, 25 Feb 2020 12:50:03 +0100 |
From: Igor Mammedov <address@hidden>
Since all RAM is backed by hostmem backends, drop
global -mem-path invariant and simplify code.
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: David Gibson <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-Id: <address@hidden>
---
exec.c | 49 ++++---------------------------------------------
1 file changed, 4 insertions(+), 45 deletions(-)
diff --git a/exec.c b/exec.c
index 8e9cc3b..d85a868 100644
--- a/exec.c
+++ b/exec.c
@@ -1667,59 +1667,18 @@ static int find_max_backend_pagesize(Object *obj, void
*opaque)
long qemu_minrampagesize(void)
{
long hpsize = LONG_MAX;
- long mainrampagesize;
- Object *memdev_root;
- MachineState *ms = MACHINE(qdev_get_machine());
-
- mainrampagesize = qemu_mempath_getpagesize(mem_path);
-
- /* it's possible we have memory-backend objects with
- * hugepage-backed RAM. these may get mapped into system
- * address space via -numa parameters or memory hotplug
- * hooks. we want to take these into account, but we
- * also want to make sure these supported hugepage
- * sizes are applicable across the entire range of memory
- * we may boot from, so we take the min across all
- * backends, and assume normal pages in cases where a
- * backend isn't backed by hugepages.
- */
- memdev_root = object_resolve_path("/objects", NULL);
- if (memdev_root) {
- object_child_foreach(memdev_root, find_min_backend_pagesize, &hpsize);
- }
- if (hpsize == LONG_MAX) {
- /* No additional memory regions found ==> Report main RAM page size */
- return mainrampagesize;
- }
-
- /* If NUMA is disabled or the NUMA nodes are not backed with a
- * memory-backend, then there is at least one node using "normal" RAM,
- * so if its page size is smaller we have got to report that size instead.
- */
- if (hpsize > mainrampagesize &&
- (ms->numa_state == NULL ||
- ms->numa_state->num_nodes == 0 ||
- ms->numa_state->nodes[0].node_memdev == NULL)) {
- static bool warned;
- if (!warned) {
- error_report("Huge page support disabled (n/a for main memory).");
- warned = true;
- }
- return mainrampagesize;
- }
+ Object *memdev_root = object_resolve_path("/objects", NULL);
+ object_child_foreach(memdev_root, find_min_backend_pagesize, &hpsize);
return hpsize;
}
long qemu_maxrampagesize(void)
{
- long pagesize = qemu_mempath_getpagesize(mem_path);
+ long pagesize = 0;
Object *memdev_root = object_resolve_path("/objects", NULL);
- if (memdev_root) {
- object_child_foreach(memdev_root, find_max_backend_pagesize,
- &pagesize);
- }
+ object_child_foreach(memdev_root, find_max_backend_pagesize, &pagesize);
return pagesize;
}
#else
--
1.8.3.1
- [PULL 069/136] sparc/leon3: use memdev for RAM, (continued)
- [PULL 069/136] sparc/leon3: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 076/136] hostmem: introduce "prealloc-threads" property, Paolo Bonzini, 2020/02/25
- [PULL 078/136] tests/numa-test: make top level args dynamic and g_autofree(cli) cleanups, Paolo Bonzini, 2020/02/25
- [PULL 074/136] exec: drop bogus mem_path from qemu_ram_alloc_from_fd(), Paolo Bonzini, 2020/02/25
- [PULL 068/136] ppc/virtex_ml507: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 075/136] make mem_path local variable, Paolo Bonzini, 2020/02/25
- [PULL 081/136] hw: Remove unnecessary cast when calling dma_memory_read(), Paolo Bonzini, 2020/02/25
- [PULL 083/136] exec: Let flatview API take void pointer arguments, Paolo Bonzini, 2020/02/25
- [PULL 085/136] hw/net: Avoid casting non-const pointer, use address_space_write(), Paolo Bonzini, 2020/02/25
- [PULL 077/136] hostmem: fix strict bind policy, Paolo Bonzini, 2020/02/25
- [PULL 073/136] exec: cleanup qemu_minrampagesize()/qemu_maxrampagesize(),
Paolo Bonzini <=
- [PULL 079/136] tests:numa-test: use explicit memdev to specify node RAM, Paolo Bonzini, 2020/02/25
- [PULL 070/136] sparc/sun4m: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 072/136] remove no longer used memory_region_allocate_system_memory(), Paolo Bonzini, 2020/02/25
- [PULL 080/136] scripts/git.orderfile: Display Cocci scripts before code modifications, Paolo Bonzini, 2020/02/25
- [PULL 082/136] exec: Rename ram_ptr variable, Paolo Bonzini, 2020/02/25
- [PULL 084/136] exec: Let the address_space API use void pointer arguments, Paolo Bonzini, 2020/02/25
- [PULL 087/136] exec: Let the cpu_[physical]_memory API use void pointer arguments, Paolo Bonzini, 2020/02/25
- [PULL 089/136] hw/ide/internal: Remove unused DMARestartFunc typedef, Paolo Bonzini, 2020/02/25
- [PULL 086/136] Remove unnecessary cast when using the address_space API, Paolo Bonzini, 2020/02/25
- [PULL 088/136] Remove unnecessary cast when using the cpu_[physical]_memory API, Paolo Bonzini, 2020/02/25