Age | Commit message (Collapse) | Author | Files | Lines |
|
Add description of the project, its structure and how to run it.
List what is left to implement and what the known issues are.
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/d5e39b9f7dcef177ebc14282727447bc21e3b38f.1646055639.git.karolinadrobnik@gmail.com
|
|
Add checks for memblock_alloc_try_nid for bottom up allocation direction.
As the definition of this function is pretty close to the core
memblock_alloc_range_nid, the test cases implemented here cover most of
the code paths related to the memory allocations.
The tested scenarios are:
- Region can be allocated within the requested range (both with aligned
and misaligned boundaries)
- Region can be allocated between two already existing entries
- Not enough space between already reserved regions
- Memory at the range boundaries is reserved but there is enough space
to allocate a new region
- The memory range is too narrow but memory can be allocated before
the maximum address
- Edge cases:
+ Minimum address is below memblock_start_of_DRAM()
+ Maximum address is above memblock_end_of_DRAM()
Add test case wrappers to test both directions in the same context.
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/1c0ba11b8da5dc8f71ad45175c536fa4be720984.1646055639.git.karolinadrobnik@gmail.com
|
|
Add tests for memblock_alloc_try_nid for top down allocation direction.
As the definition of this function is pretty close to the core
memblock_alloc_range_nid, the test cases implemented here cover most of
the code paths related to the memory allocations.
The tested scenarios are:
- Region can be allocated within the requested range (both with aligned
and misaligned boundaries)
- Region can be allocated between two already existing entries
- Not enough space between already reserved regions
- Memory range is too narrow but memory can be allocated before
the maximum address
- Edge cases:
+ Minimum address is below memblock_start_of_DRAM()
+ Maximum address is above memblock_end_of_DRAM()
Add checks for both allocation directions:
- Region starts at the min_addr and ends at max_addr
- Maximum address is too close to the beginning of the available
memory
- Memory at the range boundaries is reserved but there is enough space
to allocate a new region
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/d6c282e0f9f62c15bf74c216214604764232d637.1646055639.git.karolinadrobnik@gmail.com
|
|
Add checks for memblock_alloc_from for bottom up allocation direction.
The tested scenarios are:
- Not enough space to allocate memory at the minimal address
- Minimal address parameter is smaller than the start address
of the available memory
- Minimal address parameter is too close to the end of the available
memory
Add test case wrappers to test both directions in the same context.
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/506cf5293c8a21c012b7ea87b14af07754d3e656.1646055639.git.karolinadrobnik@gmail.com
|
|
Add checks for memblock_alloc_from for default allocation direction.
The tested scenarios are:
- Not enough space to allocate memory at the minimal address
- Minimal address parameter is smaller than the start address
of the available memory
- Minimal address is too close to the available memory
Add simple memblock_alloc_from test that can be used to test both
allocation directions (minimal address is aligned or misaligned).
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/3dd645f437975fd393010b95b8faa85d2b86490a.1646055639.git.karolinadrobnik@gmail.com
|
|
Add checks for memblock_alloc for bottom up allocation direction.
The tested scenarios are:
- Region can be allocated on the first fit (with and without
region merging)
- Region can be allocated on the second fit (with and without
region merging)
Add test case wrappers to test both directions in the same context.
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/426674eee20d99dca49caf1ee0142a83dccbc98d.1646055639.git.karolinadrobnik@gmail.com
|
|
Add checks for memblock_alloc for top down allocation direction.
The tested scenarios are:
- Region can be allocated on the first fit (with and without
region merging)
- Region can be allocated on the second fit (with and without
region merging)
Add checks for both allocation directions:
- Region can be allocated between two already existing entries
- Limited memory available
- All memory is reserved
- No available memory registered with memblock
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/26ccf409b8ff0394559d38d792b2afb24b55887c.1646055639.git.karolinadrobnik@gmail.com
|
|
Allocation functions that return virtual addresses (with an exception
of _raw variant) clear the allocated memory after reserving it. This
requires valid memory ranges in memblock.memory.
Introduce memory_block variable to store memory that can be registered
with memblock data structure. Move assert.h and size.h includes to common.h
to share them between the test files.
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/dce115503c74a6936c44694b00014658a1bb6522.1646055639.git.karolinadrobnik@gmail.com
|
|
All memblock data structure fields are reset in one function. In some
test cases, it's preferred to reset memory region arrays without
modifying other values like allocation direction flag.
Extract two functions from reset_memblock, so it's possible to reset
different parts of memblock:
- reset_memblock_regions - reset region arrays and their counters
- reset_memblock_attributes - set other fields to their default values
Update checks in basic_api.c to use new definitions. Remove
reset_memblock call from memblock_initialization_check, so the true
initial values are tested.
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/5cc1ba9a0ade922dbf4ba450165b81a9ed17d4a9.1646055639.git.karolinadrobnik@gmail.com
|
|
Building memblock simulator on x86_64 with 32BIT_PHYS_ADDR_T=1
produces "cast to pointer from integer of different size" warnings.
Fix them by building the binary in 32-bit environment when using
32-bit physical addresses.
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
|
|
Add checks for removing a region from reserved memory in different
scenarios:
- The requested region matches one in the collection of reserved
memory regions
- The requested region does not exist in memblock.reserved
- The region overlaps with one of the entries: from the top (its
end address is bigger than the base of the existing region) or
from the bottom (its base address is smaller than the end address
of one of the regions)
- The region is within an already defined region
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/30af95c82754ad8029404c3b528a5ef1c05d1ed6.1643796665.git.karolinadrobnik@gmail.com
|
|
Add a simple test for NUMA-aware variant of memblock_add function.
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/e2d0e6dd264c8c169242b556f7c5b12153f3dee5.1643796665.git.karolinadrobnik@gmail.com
|
|
Add checks for removing a region from available memory in different
scenarios:
- The requested region matches one in the collection of available
memory regions
- The requested region does not exist in memblock.memory
- The region overlaps with one of the entries: from the top (its end
address is bigger than the base of the existing region) or from the
bottom (its base address is smaller than the end address of one of
the regions)
- The region is within an already defined region
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/8e6aa005407bbe1a75b75e85ac04ebb51318a52a.1643796665.git.karolinadrobnik@gmail.com
|
|
Add checks for marking a region as reserved in different scenarios:
- The region does not overlap with existing entries
- The region overlaps with one of the previous entries: from the top
(its end address is bigger than the base of the existing region) or
from the bottom (its base address is smaller than the end address of
one of the regions)
- The region is within an already defined region
- The same region is marked as reserved twice
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/cac867d2b6c17e53d9e977b5d6cd88cc4e9453b6.1643796665.git.karolinadrobnik@gmail.com
|
|
Add checks for adding a new region in different scenarios:
- The region does not overlap with existing entries
- The region overlaps with one of the previous entries: from the top
(its end address is bigger than the base of the existing region) or
from the bottom (its base address is smaller than the end address of
one of the regions)
- The region is within an already defined region
- The same region is added twice to the collection of available memory
regions
Add checks for memblock initialization to verify it sets memblock data
structures to expected values.
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/b6c26525025bccec0bf7419473d4d1293eb82b3b.1643796665.git.karolinadrobnik@gmail.com
|
|
Memblock simulator needs to be able to reset memblock data structures
between different test cases. Add a function that sets all fields to
their default values.
Add a test checking if memblock is being initialized to expected values.
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/8c185aa7e0dd68c2c7e937c9a06c90ae413e240f.1643796665.git.karolinadrobnik@gmail.com
|
|
Add basic project files, together with local stubs of required headers.
Update tools/include/slab.h to include definitions used by memblock.
Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/d296fceb023a04b316a31fbff9acf1e76ac684e4.1643796665.git.karolinadrobnik@gmail.com
|