aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/memblock/tests/common.h
diff options
context:
space:
mode:
authorShaoqin Huang <shaoqin.huang@intel.com>2022-10-11 14:21:20 +0800
committerMike Rapoport <rppt@linux.ibm.com>2022-10-31 10:15:00 +0200
commit085bdaa6eb1476ec054164bdc4001bc3916ff5cb (patch)
treecd8e197921ba412b48332db6d418818446ba8015 /tools/testing/memblock/tests/common.h
parent30a0b95b1335e12efef89dd78518ed3e4a71a763 (diff)
memblock test: Add test to memblock_add() 129th region
Add 129th region into the memblock, and this will trigger the memblock_double_array() function, this needs valid memory regions. So using dummy_physical_memory_init() to allocate a large enough memory region, and split it into a large enough memory which can be choosed by memblock_double_array(), and the left memory will be split into small memory region, and add them into the memblock. It make sure the memblock_double_array() will always choose the valid memory region that is allocated by the dummy_physical_memory_init(). So memblock_double_array() must success. Another thing should be done is to restore the memory.regions after memblock_double_array(), due to now the memory.regions is pointing to a memory region allocated by dummy_physical_memory_init(). And it will affect the subsequent tests if we don't restore the memory region. So simply record the origin region, and restore it after the test. Signed-off-by: Shaoqin Huang <shaoqin.huang@intel.com> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Link: https://lore.kernel.org/r/20221011062128.49359-2-shaoqin.huang@intel.com
Diffstat (limited to 'tools/testing/memblock/tests/common.h')
-rw-r--r--tools/testing/memblock/tests/common.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/testing/memblock/tests/common.h b/tools/testing/memblock/tests/common.h
index d6bbbe63bfc3..cc82b85151b6 100644
--- a/tools/testing/memblock/tests/common.h
+++ b/tools/testing/memblock/tests/common.h
@@ -10,9 +10,12 @@
#include <linux/printk.h>
#include <../selftests/kselftest.h>
-#define MEM_SIZE SZ_16K
+#define MEM_SIZE SZ_32K
#define NUMA_NODES 8
+#define INIT_MEMBLOCK_REGIONS 128
+#define INIT_MEMBLOCK_RESERVED_REGIONS INIT_MEMBLOCK_REGIONS
+
enum test_flags {
/* No special request. */
TEST_F_NONE = 0x0,
@@ -124,6 +127,7 @@ void setup_memblock(void);
void setup_numa_memblock(const unsigned int node_fracs[]);
void dummy_physical_memory_init(void);
void dummy_physical_memory_cleanup(void);
+phys_addr_t dummy_physical_memory_base(void);
void parse_args(int argc, char **argv);
void test_fail(void);