Path: blob/master/tools/testing/memblock/tests/alloc_api.c
26299 views
// SPDX-License-Identifier: GPL-2.0-or-later1#include "alloc_api.h"23static int alloc_test_flags = TEST_F_NONE;45static inline const char * const get_memblock_alloc_name(int flags)6{7if (flags & TEST_F_RAW)8return "memblock_alloc_raw";9return "memblock_alloc";10}1112static inline void *run_memblock_alloc(phys_addr_t size, phys_addr_t align)13{14if (alloc_test_flags & TEST_F_RAW)15return memblock_alloc_raw(size, align);16return memblock_alloc(size, align);17}1819/*20* A simple test that tries to allocate a small memory region.21* Expect to allocate an aligned region near the end of the available memory.22*/23static int alloc_top_down_simple_check(void)24{25struct memblock_region *rgn = &memblock.reserved.regions[0];26void *allocated_ptr = NULL;27phys_addr_t size = SZ_2;28phys_addr_t expected_start;2930PREFIX_PUSH();31setup_memblock();3233expected_start = memblock_end_of_DRAM() - SMP_CACHE_BYTES;3435allocated_ptr = run_memblock_alloc(size, SMP_CACHE_BYTES);3637ASSERT_NE(allocated_ptr, NULL);38assert_mem_content(allocated_ptr, size, alloc_test_flags);3940ASSERT_EQ(rgn->size, size);41ASSERT_EQ(rgn->base, expected_start);4243ASSERT_EQ(memblock.reserved.cnt, 1);44ASSERT_EQ(memblock.reserved.total_size, size);4546test_pass_pop();4748return 0;49}5051/*52* A test that tries to allocate memory next to a reserved region that starts at53* the misaligned address. Expect to create two separate entries, with the new54* entry aligned to the provided alignment:55*56* +57* | +--------+ +--------|58* | | rgn2 | | rgn1 |59* +------------+--------+---------+--------+60* ^61* |62* Aligned address boundary63*64* The allocation direction is top-down and region arrays are sorted from lower65* to higher addresses, so the new region will be the first entry in66* memory.reserved array. The previously reserved region does not get modified.67* Region counter and total size get updated.68*/69static int alloc_top_down_disjoint_check(void)70{71/* After allocation, this will point to the "old" region */72struct memblock_region *rgn1 = &memblock.reserved.regions[1];73struct memblock_region *rgn2 = &memblock.reserved.regions[0];74struct region r1;75void *allocated_ptr = NULL;76phys_addr_t r2_size = SZ_16;77/* Use custom alignment */78phys_addr_t alignment = SMP_CACHE_BYTES * 2;79phys_addr_t total_size;80phys_addr_t expected_start;8182PREFIX_PUSH();83setup_memblock();8485r1.base = memblock_end_of_DRAM() - SZ_2;86r1.size = SZ_2;8788total_size = r1.size + r2_size;89expected_start = memblock_end_of_DRAM() - alignment;9091memblock_reserve(r1.base, r1.size);9293allocated_ptr = run_memblock_alloc(r2_size, alignment);9495ASSERT_NE(allocated_ptr, NULL);96assert_mem_content(allocated_ptr, r2_size, alloc_test_flags);9798ASSERT_EQ(rgn1->size, r1.size);99ASSERT_EQ(rgn1->base, r1.base);100101ASSERT_EQ(rgn2->size, r2_size);102ASSERT_EQ(rgn2->base, expected_start);103104ASSERT_EQ(memblock.reserved.cnt, 2);105ASSERT_EQ(memblock.reserved.total_size, total_size);106107test_pass_pop();108109return 0;110}111112/*113* A test that tries to allocate memory when there is enough space at the end114* of the previously reserved block (i.e. first fit):115*116* | +--------+--------------|117* | | r1 | r2 |118* +--------------+--------+--------------+119*120* Expect a merge of both regions. Only the region size gets updated.121*/122static int alloc_top_down_before_check(void)123{124struct memblock_region *rgn = &memblock.reserved.regions[0];125void *allocated_ptr = NULL;126/*127* The first region ends at the aligned address to test region merging128*/129phys_addr_t r1_size = SMP_CACHE_BYTES;130phys_addr_t r2_size = SZ_512;131phys_addr_t total_size = r1_size + r2_size;132133PREFIX_PUSH();134setup_memblock();135136memblock_reserve_kern(memblock_end_of_DRAM() - total_size, r1_size);137138allocated_ptr = run_memblock_alloc(r2_size, SMP_CACHE_BYTES);139140ASSERT_NE(allocated_ptr, NULL);141assert_mem_content(allocated_ptr, r2_size, alloc_test_flags);142143ASSERT_EQ(rgn->size, total_size);144ASSERT_EQ(rgn->base, memblock_end_of_DRAM() - total_size);145146ASSERT_EQ(memblock.reserved.cnt, 1);147ASSERT_EQ(memblock.reserved.total_size, total_size);148149test_pass_pop();150151return 0;152}153154/*155* A test that tries to allocate memory when there is not enough space at the156* end of the previously reserved block (i.e. second fit):157*158* | +-----------+------+ |159* | | r2 | r1 | |160* +------------+-----------+------+-----+161*162* Expect a merge of both regions. Both the base address and size of the region163* get updated.164*/165static int alloc_top_down_after_check(void)166{167struct memblock_region *rgn = &memblock.reserved.regions[0];168struct region r1;169void *allocated_ptr = NULL;170phys_addr_t r2_size = SZ_512;171phys_addr_t total_size;172173PREFIX_PUSH();174setup_memblock();175176/*177* The first region starts at the aligned address to test region merging178*/179r1.base = memblock_end_of_DRAM() - SMP_CACHE_BYTES;180r1.size = SZ_8;181182total_size = r1.size + r2_size;183184memblock_reserve_kern(r1.base, r1.size);185186allocated_ptr = run_memblock_alloc(r2_size, SMP_CACHE_BYTES);187188ASSERT_NE(allocated_ptr, NULL);189assert_mem_content(allocated_ptr, r2_size, alloc_test_flags);190191ASSERT_EQ(rgn->size, total_size);192ASSERT_EQ(rgn->base, r1.base - r2_size);193194ASSERT_EQ(memblock.reserved.cnt, 1);195ASSERT_EQ(memblock.reserved.total_size, total_size);196197test_pass_pop();198199return 0;200}201202/*203* A test that tries to allocate memory when there are two reserved regions with204* a gap too small to fit the new region:205*206* | +--------+----------+ +------|207* | | r3 | r2 | | r1 |208* +-------+--------+----------+---+------+209*210* Expect to allocate a region before the one that starts at the lower address,211* and merge them into one. The region counter and total size fields get212* updated.213*/214static int alloc_top_down_second_fit_check(void)215{216struct memblock_region *rgn = &memblock.reserved.regions[0];217struct region r1, r2;218void *allocated_ptr = NULL;219phys_addr_t r3_size = SZ_1K;220phys_addr_t total_size;221222PREFIX_PUSH();223setup_memblock();224225r1.base = memblock_end_of_DRAM() - SZ_512;226r1.size = SZ_512;227228r2.base = r1.base - SZ_512;229r2.size = SZ_256;230231total_size = r1.size + r2.size + r3_size;232233memblock_reserve_kern(r1.base, r1.size);234memblock_reserve_kern(r2.base, r2.size);235236allocated_ptr = run_memblock_alloc(r3_size, SMP_CACHE_BYTES);237238ASSERT_NE(allocated_ptr, NULL);239assert_mem_content(allocated_ptr, r3_size, alloc_test_flags);240241ASSERT_EQ(rgn->size, r2.size + r3_size);242ASSERT_EQ(rgn->base, r2.base - r3_size);243244ASSERT_EQ(memblock.reserved.cnt, 2);245ASSERT_EQ(memblock.reserved.total_size, total_size);246247test_pass_pop();248249return 0;250}251252/*253* A test that tries to allocate memory when there are two reserved regions with254* a gap big enough to accommodate the new region:255*256* | +--------+--------+--------+ |257* | | r2 | r3 | r1 | |258* +-----+--------+--------+--------+-----+259*260* Expect to merge all of them, creating one big entry in memblock.reserved261* array. The region counter and total size fields get updated.262*/263static int alloc_in_between_generic_check(void)264{265struct memblock_region *rgn = &memblock.reserved.regions[0];266struct region r1, r2;267void *allocated_ptr = NULL;268phys_addr_t gap_size = SMP_CACHE_BYTES;269phys_addr_t r3_size = SZ_64;270/*271* Calculate regions size so there's just enough space for the new entry272*/273phys_addr_t rgn_size = (MEM_SIZE - (2 * gap_size + r3_size)) / 2;274phys_addr_t total_size;275276PREFIX_PUSH();277setup_memblock();278279r1.size = rgn_size;280r1.base = memblock_end_of_DRAM() - (gap_size + rgn_size);281282r2.size = rgn_size;283r2.base = memblock_start_of_DRAM() + gap_size;284285total_size = r1.size + r2.size + r3_size;286287memblock_reserve_kern(r1.base, r1.size);288memblock_reserve_kern(r2.base, r2.size);289290allocated_ptr = run_memblock_alloc(r3_size, SMP_CACHE_BYTES);291292ASSERT_NE(allocated_ptr, NULL);293assert_mem_content(allocated_ptr, r3_size, alloc_test_flags);294295ASSERT_EQ(rgn->size, total_size);296ASSERT_EQ(rgn->base, r1.base - r2.size - r3_size);297298ASSERT_EQ(memblock.reserved.cnt, 1);299ASSERT_EQ(memblock.reserved.total_size, total_size);300301test_pass_pop();302303return 0;304}305306/*307* A test that tries to allocate memory when the memory is filled with reserved308* regions with memory gaps too small to fit the new region:309*310* +-------+311* | new |312* +--+----+313* | +-----+ +-----+ +-----+ |314* | | res | | res | | res | |315* +----+-----+----+-----+----+-----+----+316*317* Expect no allocation to happen.318*/319static int alloc_small_gaps_generic_check(void)320{321void *allocated_ptr = NULL;322phys_addr_t region_size = SZ_1K;323phys_addr_t gap_size = SZ_256;324phys_addr_t region_end;325326PREFIX_PUSH();327setup_memblock();328329region_end = memblock_start_of_DRAM();330331while (region_end < memblock_end_of_DRAM()) {332memblock_reserve(region_end + gap_size, region_size);333region_end += gap_size + region_size;334}335336allocated_ptr = run_memblock_alloc(region_size, SMP_CACHE_BYTES);337338ASSERT_EQ(allocated_ptr, NULL);339340test_pass_pop();341342return 0;343}344345/*346* A test that tries to allocate memory when all memory is reserved.347* Expect no allocation to happen.348*/349static int alloc_all_reserved_generic_check(void)350{351void *allocated_ptr = NULL;352353PREFIX_PUSH();354setup_memblock();355356/* Simulate full memory */357memblock_reserve(memblock_start_of_DRAM(), MEM_SIZE);358359allocated_ptr = run_memblock_alloc(SZ_256, SMP_CACHE_BYTES);360361ASSERT_EQ(allocated_ptr, NULL);362363test_pass_pop();364365return 0;366}367368/*369* A test that tries to allocate memory when the memory is almost full,370* with not enough space left for the new region:371*372* +-------+373* | new |374* +-------+375* |-----------------------------+ |376* | reserved | |377* +-----------------------------+---+378*379* Expect no allocation to happen.380*/381static int alloc_no_space_generic_check(void)382{383void *allocated_ptr = NULL;384phys_addr_t available_size = SZ_256;385phys_addr_t reserved_size = MEM_SIZE - available_size;386387PREFIX_PUSH();388setup_memblock();389390/* Simulate almost-full memory */391memblock_reserve(memblock_start_of_DRAM(), reserved_size);392393allocated_ptr = run_memblock_alloc(SZ_1K, SMP_CACHE_BYTES);394395ASSERT_EQ(allocated_ptr, NULL);396397test_pass_pop();398399return 0;400}401402/*403* A test that tries to allocate memory when the memory is almost full,404* but there is just enough space left:405*406* |---------------------------+---------|407* | reserved | new |408* +---------------------------+---------+409*410* Expect to allocate memory and merge all the regions. The total size field411* gets updated.412*/413static int alloc_limited_space_generic_check(void)414{415struct memblock_region *rgn = &memblock.reserved.regions[0];416void *allocated_ptr = NULL;417phys_addr_t available_size = SZ_256;418phys_addr_t reserved_size = MEM_SIZE - available_size;419420PREFIX_PUSH();421setup_memblock();422423/* Simulate almost-full memory */424memblock_reserve_kern(memblock_start_of_DRAM(), reserved_size);425426allocated_ptr = run_memblock_alloc(available_size, SMP_CACHE_BYTES);427428ASSERT_NE(allocated_ptr, NULL);429assert_mem_content(allocated_ptr, available_size, alloc_test_flags);430431ASSERT_EQ(rgn->size, MEM_SIZE);432ASSERT_EQ(rgn->base, memblock_start_of_DRAM());433434ASSERT_EQ(memblock.reserved.cnt, 1);435ASSERT_EQ(memblock.reserved.total_size, MEM_SIZE);436437test_pass_pop();438439return 0;440}441442/*443* A test that tries to allocate memory when there is no available memory444* registered (i.e. memblock.memory has only a dummy entry).445* Expect no allocation to happen.446*/447static int alloc_no_memory_generic_check(void)448{449struct memblock_region *rgn = &memblock.reserved.regions[0];450void *allocated_ptr = NULL;451452PREFIX_PUSH();453454reset_memblock_regions();455456allocated_ptr = run_memblock_alloc(SZ_1K, SMP_CACHE_BYTES);457458ASSERT_EQ(allocated_ptr, NULL);459ASSERT_EQ(rgn->size, 0);460ASSERT_EQ(rgn->base, 0);461ASSERT_EQ(memblock.reserved.total_size, 0);462463test_pass_pop();464465return 0;466}467468/*469* A test that tries to allocate a region that is larger than the total size of470* available memory (memblock.memory):471*472* +-----------------------------------+473* | new |474* +-----------------------------------+475* | |476* | |477* +---------------------------------+478*479* Expect no allocation to happen.480*/481static int alloc_too_large_generic_check(void)482{483struct memblock_region *rgn = &memblock.reserved.regions[0];484void *allocated_ptr = NULL;485486PREFIX_PUSH();487setup_memblock();488489allocated_ptr = run_memblock_alloc(MEM_SIZE + SZ_2, SMP_CACHE_BYTES);490491ASSERT_EQ(allocated_ptr, NULL);492ASSERT_EQ(rgn->size, 0);493ASSERT_EQ(rgn->base, 0);494ASSERT_EQ(memblock.reserved.total_size, 0);495496test_pass_pop();497498return 0;499}500501/*502* A simple test that tries to allocate a small memory region.503* Expect to allocate an aligned region at the beginning of the available504* memory.505*/506static int alloc_bottom_up_simple_check(void)507{508struct memblock_region *rgn = &memblock.reserved.regions[0];509void *allocated_ptr = NULL;510511PREFIX_PUSH();512setup_memblock();513514allocated_ptr = run_memblock_alloc(SZ_2, SMP_CACHE_BYTES);515516ASSERT_NE(allocated_ptr, NULL);517assert_mem_content(allocated_ptr, SZ_2, alloc_test_flags);518519ASSERT_EQ(rgn->size, SZ_2);520ASSERT_EQ(rgn->base, memblock_start_of_DRAM());521522ASSERT_EQ(memblock.reserved.cnt, 1);523ASSERT_EQ(memblock.reserved.total_size, SZ_2);524525test_pass_pop();526527return 0;528}529530/*531* A test that tries to allocate memory next to a reserved region that starts at532* the misaligned address. Expect to create two separate entries, with the new533* entry aligned to the provided alignment:534*535* +536* | +----------+ +----------+ |537* | | rgn1 | | rgn2 | |538* +----+----------+---+----------+-----+539* ^540* |541* Aligned address boundary542*543* The allocation direction is bottom-up, so the new region will be the second544* entry in memory.reserved array. The previously reserved region does not get545* modified. Region counter and total size get updated.546*/547static int alloc_bottom_up_disjoint_check(void)548{549struct memblock_region *rgn1 = &memblock.reserved.regions[0];550struct memblock_region *rgn2 = &memblock.reserved.regions[1];551struct region r1;552void *allocated_ptr = NULL;553phys_addr_t r2_size = SZ_16;554/* Use custom alignment */555phys_addr_t alignment = SMP_CACHE_BYTES * 2;556phys_addr_t total_size;557phys_addr_t expected_start;558559PREFIX_PUSH();560setup_memblock();561562r1.base = memblock_start_of_DRAM() + SZ_2;563r1.size = SZ_2;564565total_size = r1.size + r2_size;566expected_start = memblock_start_of_DRAM() + alignment;567568memblock_reserve(r1.base, r1.size);569570allocated_ptr = run_memblock_alloc(r2_size, alignment);571572ASSERT_NE(allocated_ptr, NULL);573assert_mem_content(allocated_ptr, r2_size, alloc_test_flags);574575ASSERT_EQ(rgn1->size, r1.size);576ASSERT_EQ(rgn1->base, r1.base);577578ASSERT_EQ(rgn2->size, r2_size);579ASSERT_EQ(rgn2->base, expected_start);580581ASSERT_EQ(memblock.reserved.cnt, 2);582ASSERT_EQ(memblock.reserved.total_size, total_size);583584test_pass_pop();585586return 0;587}588589/*590* A test that tries to allocate memory when there is enough space at591* the beginning of the previously reserved block (i.e. first fit):592*593* |------------------+--------+ |594* | r1 | r2 | |595* +------------------+--------+---------+596*597* Expect a merge of both regions. Only the region size gets updated.598*/599static int alloc_bottom_up_before_check(void)600{601struct memblock_region *rgn = &memblock.reserved.regions[0];602void *allocated_ptr = NULL;603phys_addr_t r1_size = SZ_512;604phys_addr_t r2_size = SZ_128;605phys_addr_t total_size = r1_size + r2_size;606607PREFIX_PUSH();608setup_memblock();609610memblock_reserve_kern(memblock_start_of_DRAM() + r1_size, r2_size);611612allocated_ptr = run_memblock_alloc(r1_size, SMP_CACHE_BYTES);613614ASSERT_NE(allocated_ptr, NULL);615assert_mem_content(allocated_ptr, r1_size, alloc_test_flags);616617ASSERT_EQ(rgn->size, total_size);618ASSERT_EQ(rgn->base, memblock_start_of_DRAM());619620ASSERT_EQ(memblock.reserved.cnt, 1);621ASSERT_EQ(memblock.reserved.total_size, total_size);622623test_pass_pop();624625return 0;626}627628/*629* A test that tries to allocate memory when there is not enough space at630* the beginning of the previously reserved block (i.e. second fit):631*632* | +--------+--------------+ |633* | | r1 | r2 | |634* +----+--------+--------------+---------+635*636* Expect a merge of both regions. Only the region size gets updated.637*/638static int alloc_bottom_up_after_check(void)639{640struct memblock_region *rgn = &memblock.reserved.regions[0];641struct region r1;642void *allocated_ptr = NULL;643phys_addr_t r2_size = SZ_512;644phys_addr_t total_size;645646PREFIX_PUSH();647setup_memblock();648649/*650* The first region starts at the aligned address to test region merging651*/652r1.base = memblock_start_of_DRAM() + SMP_CACHE_BYTES;653r1.size = SZ_64;654655total_size = r1.size + r2_size;656657memblock_reserve_kern(r1.base, r1.size);658659allocated_ptr = run_memblock_alloc(r2_size, SMP_CACHE_BYTES);660661ASSERT_NE(allocated_ptr, NULL);662assert_mem_content(allocated_ptr, r2_size, alloc_test_flags);663664ASSERT_EQ(rgn->size, total_size);665ASSERT_EQ(rgn->base, r1.base);666667ASSERT_EQ(memblock.reserved.cnt, 1);668ASSERT_EQ(memblock.reserved.total_size, total_size);669670test_pass_pop();671672return 0;673}674675/*676* A test that tries to allocate memory when there are two reserved regions, the677* first one starting at the beginning of the available memory, with a gap too678* small to fit the new region:679*680* |------------+ +--------+--------+ |681* | r1 | | r2 | r3 | |682* +------------+-----+--------+--------+--+683*684* Expect to allocate after the second region, which starts at the higher685* address, and merge them into one. The region counter and total size fields686* get updated.687*/688static int alloc_bottom_up_second_fit_check(void)689{690struct memblock_region *rgn = &memblock.reserved.regions[1];691struct region r1, r2;692void *allocated_ptr = NULL;693phys_addr_t r3_size = SZ_1K;694phys_addr_t total_size;695696PREFIX_PUSH();697setup_memblock();698699r1.base = memblock_start_of_DRAM();700r1.size = SZ_512;701702r2.base = r1.base + r1.size + SZ_512;703r2.size = SZ_256;704705total_size = r1.size + r2.size + r3_size;706707memblock_reserve_kern(r1.base, r1.size);708memblock_reserve_kern(r2.base, r2.size);709710allocated_ptr = run_memblock_alloc(r3_size, SMP_CACHE_BYTES);711712ASSERT_NE(allocated_ptr, NULL);713assert_mem_content(allocated_ptr, r3_size, alloc_test_flags);714715ASSERT_EQ(rgn->size, r2.size + r3_size);716ASSERT_EQ(rgn->base, r2.base);717718ASSERT_EQ(memblock.reserved.cnt, 2);719ASSERT_EQ(memblock.reserved.total_size, total_size);720721test_pass_pop();722723return 0;724}725726/* Test case wrappers */727static int alloc_simple_check(void)728{729test_print("\tRunning %s...\n", __func__);730memblock_set_bottom_up(false);731alloc_top_down_simple_check();732memblock_set_bottom_up(true);733alloc_bottom_up_simple_check();734735return 0;736}737738static int alloc_disjoint_check(void)739{740test_print("\tRunning %s...\n", __func__);741memblock_set_bottom_up(false);742alloc_top_down_disjoint_check();743memblock_set_bottom_up(true);744alloc_bottom_up_disjoint_check();745746return 0;747}748749static int alloc_before_check(void)750{751test_print("\tRunning %s...\n", __func__);752memblock_set_bottom_up(false);753alloc_top_down_before_check();754memblock_set_bottom_up(true);755alloc_bottom_up_before_check();756757return 0;758}759760static int alloc_after_check(void)761{762test_print("\tRunning %s...\n", __func__);763memblock_set_bottom_up(false);764alloc_top_down_after_check();765memblock_set_bottom_up(true);766alloc_bottom_up_after_check();767768return 0;769}770771static int alloc_in_between_check(void)772{773test_print("\tRunning %s...\n", __func__);774run_top_down(alloc_in_between_generic_check);775run_bottom_up(alloc_in_between_generic_check);776777return 0;778}779780static int alloc_second_fit_check(void)781{782test_print("\tRunning %s...\n", __func__);783memblock_set_bottom_up(false);784alloc_top_down_second_fit_check();785memblock_set_bottom_up(true);786alloc_bottom_up_second_fit_check();787788return 0;789}790791static int alloc_small_gaps_check(void)792{793test_print("\tRunning %s...\n", __func__);794run_top_down(alloc_small_gaps_generic_check);795run_bottom_up(alloc_small_gaps_generic_check);796797return 0;798}799800static int alloc_all_reserved_check(void)801{802test_print("\tRunning %s...\n", __func__);803run_top_down(alloc_all_reserved_generic_check);804run_bottom_up(alloc_all_reserved_generic_check);805806return 0;807}808809static int alloc_no_space_check(void)810{811test_print("\tRunning %s...\n", __func__);812run_top_down(alloc_no_space_generic_check);813run_bottom_up(alloc_no_space_generic_check);814815return 0;816}817818static int alloc_limited_space_check(void)819{820test_print("\tRunning %s...\n", __func__);821run_top_down(alloc_limited_space_generic_check);822run_bottom_up(alloc_limited_space_generic_check);823824return 0;825}826827static int alloc_no_memory_check(void)828{829test_print("\tRunning %s...\n", __func__);830run_top_down(alloc_no_memory_generic_check);831run_bottom_up(alloc_no_memory_generic_check);832833return 0;834}835836static int alloc_too_large_check(void)837{838test_print("\tRunning %s...\n", __func__);839run_top_down(alloc_too_large_generic_check);840run_bottom_up(alloc_too_large_generic_check);841842return 0;843}844845static int memblock_alloc_checks_internal(int flags)846{847const char *func = get_memblock_alloc_name(flags);848849alloc_test_flags = flags;850prefix_reset();851prefix_push(func);852test_print("Running %s tests...\n", func);853854reset_memblock_attributes();855dummy_physical_memory_init();856857alloc_simple_check();858alloc_disjoint_check();859alloc_before_check();860alloc_after_check();861alloc_second_fit_check();862alloc_small_gaps_check();863alloc_in_between_check();864alloc_all_reserved_check();865alloc_no_space_check();866alloc_limited_space_check();867alloc_no_memory_check();868alloc_too_large_check();869870dummy_physical_memory_cleanup();871872prefix_pop();873874return 0;875}876877int memblock_alloc_checks(void)878{879memblock_alloc_checks_internal(TEST_F_NONE);880memblock_alloc_checks_internal(TEST_F_RAW);881882return 0;883}884885886