diff mbox series

[kvm-unit-tests] x86: on 32-bit do not initialize memory above 2GB

Message ID 20210313073020.36984-1-namit@vmware.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] x86: on 32-bit do not initialize memory above 2GB | expand

Commit Message

Nadav Amit March 13, 2021, 7:30 a.m. UTC
From: Nadav Amit <namit@vmware.com>

taskswitch2 test fails on certain configurations with more than 2GB of
memory.

The reason is that on i386, setup_mmu() creates a hole above 2GB and
does not map that area.

Do not initialize the memory above 2GB on i386.

Signed-off-by: Nadav Amit <namit@vmware.com>
---
 lib/x86/setup.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/lib/x86/setup.c b/lib/x86/setup.c
index 7befe09..001853c 100644
--- a/lib/x86/setup.c
+++ b/lib/x86/setup.c
@@ -107,6 +107,15 @@  void setup_multiboot(struct mbi_bootinfo *bi)
 
 	u64 best_start = (uintptr_t) &edata;
 	u64 best_end = bootinfo->mem_upper * 1024ull;
+
+#ifndef __x86_64__
+	/*
+	 * On i386, setup_mmu() creates a hole above 2GB, so do not initialize
+	 * the memory above 2GB.
+	 */
+	if (best_end > 2ul << 30)
+		best_end = 2ul << 30;
+#endif
 	phys_alloc_init(best_start, best_end - best_start);
 
 	if (bootinfo->mods_count != 1)