[Skiboot] [PATCH v2 03/13] test/mem_region: fix incorrect ibm, os-reserve region length

Stewart Smith stewart at linux.vnet.ibm.com
Thu Aug 24 12:09:30 AEST 2017


We were reserving all of memory up to the heap, which is fine
*unless* the system libc chooses to allocate something in that
block of memory that we use, which means we have overlapping
regions and general pain.

This should fix failing unit tests on some systems (e.g. Debian)

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 core/test/run-mem_region_release_unused.c         | 2 +-
 core/test/run-mem_region_release_unused_noalloc.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

---
Changes since v1:
- allocate something for os_reserve region in core/test/run-mem_region_release_unused_noalloc.c
  as we do test how many regions we end up with at the end.

diff --git a/core/test/run-mem_region_release_unused.c b/core/test/run-mem_region_release_unused.c
index 886585b296cc..712f98ab1985 100644
--- a/core/test/run-mem_region_release_unused.c
+++ b/core/test/run-mem_region_release_unused.c
@@ -113,7 +113,7 @@ int main(void)
 	/* Use malloc for the heap, so valgrind can find issues. */
 	skiboot_heap.start = (unsigned long)malloc(TEST_HEAP_SIZE);
 	skiboot_heap.len = TEST_HEAP_SIZE;
-	skiboot_os_reserve.len = skiboot_heap.start;
+	skiboot_os_reserve.len = 0;
 
 	dt_root = dt_new_root("");
 	dt_add_property_cells(dt_root, "#address-cells", 2);
diff --git a/core/test/run-mem_region_release_unused_noalloc.c b/core/test/run-mem_region_release_unused_noalloc.c
index 2a9f641148ff..2e80975ff67b 100644
--- a/core/test/run-mem_region_release_unused_noalloc.c
+++ b/core/test/run-mem_region_release_unused_noalloc.c
@@ -112,7 +112,8 @@ int main(void)
 	/* Use malloc for the heap, so valgrind can find issues. */
 	skiboot_heap.start = (unsigned long)malloc(TEST_HEAP_SIZE);
 	skiboot_heap.len = TEST_HEAP_SIZE;
-	skiboot_os_reserve.len = skiboot_heap.start;
+	skiboot_os_reserve.start = (unsigned long)malloc(1024);
+	skiboot_os_reserve.len = 1024;
 
 	dt_root = dt_new_root("");
 	dt_add_property_cells(dt_root, "#address-cells", 2);
@@ -164,5 +165,6 @@ int main(void)
 
 	dt_free(dt_root);
 	free((void *)(long)skiboot_heap.start);
+	free((void *)(long)skiboot_os_reserve.start);
 	return 0;
 }
-- 
2.13.5



More information about the Skiboot mailing list