| 3b394dff | 18-Mar-2025 |
Wei Yang <richard.weiyang@gmail.com> |
memblock tests: add test for memblock_set_node
Add a test to check memblock_set_node() behavior.
And create a corner case in which the memblock.reserved array is doubled during memblock_set_node().
memblock tests: add test for memblock_set_node
Add a test to check memblock_set_node() behavior.
And create a corner case in which the memblock.reserved array is doubled during memblock_set_node(). And finally make sure all regions in memblock.reserved are with valid node id.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com> CC: Mike Rapoport <rppt@kernel.org> CC: Yajun Deng <yajun.deng@linux.dev> Link: https://lore.kernel.org/r/20250318071948.23854-4-richard.weiyang@gmail.com Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
show more ...
|
| 8ac13bc7 | 06-Aug-2024 |
Wei Yang <richard.weiyang@gmail.com> |
memblock test: fix implicit declaration of function 'isspace'
Commit 1e4c64b71c9b ("mm/memblock: Add "reserve_mem" to reserved named memory at boot up") introduce usage of isspace().
Let's include
memblock test: fix implicit declaration of function 'isspace'
Commit 1e4c64b71c9b ("mm/memblock: Add "reserve_mem" to reserved named memory at boot up") introduce usage of isspace().
Let's include <linux/ctype.h> in kernel.h to fix this.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Link: https://lore.kernel.org/r/20240806010319.29194-4-richard.weiyang@gmail.com Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
show more ...
|
| a88cde57 | 06-Aug-2024 |
Wei Yang <richard.weiyang@gmail.com> |
memblock test: fix implicit declaration of function 'memparse'
Commit 1e4c64b71c9b ("mm/memblock: Add "reserve_mem" to reserved named memory at boot up") introduce the usage of memparse(), which is
memblock test: fix implicit declaration of function 'memparse'
Commit 1e4c64b71c9b ("mm/memblock: Add "reserve_mem" to reserved named memory at boot up") introduce the usage of memparse(), which is not defined in memblock test.
Add the definition and link it to fix the build.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Link: https://lore.kernel.org/r/20240806010319.29194-3-richard.weiyang@gmail.com Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
show more ...
|
| e2ae9cf3 | 12-Jul-2024 |
Wei Yang <richard.weiyang@gmail.com> |
tools/testing: abstract two init.h into common include directory
Currently we have two test suits define its own init.h. This is a little redundant.
Let's create a init.h in common include director
tools/testing: abstract two init.h into common include directory
Currently we have two test suits define its own init.h. This is a little redundant.
Let's create a init.h in common include directory and merge these two into it.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com> CC: Mike Rapoport <rppt@kernel.org> CC: Liam R. Howlett <Liam.Howlett@oracle.com> Link: https://lore.kernel.org/r/20240712035138.24674-3-richard.weiyang@gmail.com Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
show more ...
|
| d68c0817 | 12-Jul-2024 |
Wei Yang <richard.weiyang@gmail.com> |
memblock tests: include export.h in linkage.h as kernel dose
In kernel code, linkage.h includes export.h. Let's sync with kernel.
This is a preparation for move init.h in common include directory.
memblock tests: include export.h in linkage.h as kernel dose
In kernel code, linkage.h includes export.h. Let's sync with kernel.
This is a preparation for move init.h in common include directory.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com> CC: Mike Rapoport <rppt@kernel.org> Link: https://lore.kernel.org/r/20240712035138.24674-2-richard.weiyang@gmail.com Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
show more ...
|
| 1a879671 | 07-May-2024 |
Wei Yang <richard.weiyang@gmail.com> |
memblock tests: add memblock_overlaps_region_checks
Add a test case for memblock_overlaps_region().
Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Link: https://lore.kernel.org/r/2024050707583
memblock tests: add memblock_overlaps_region_checks
Add a test case for memblock_overlaps_region().
Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Link: https://lore.kernel.org/r/20240507075833.6346-5-richard.weiyang@gmail.com Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
show more ...
|
| f6df89c3 | 07-May-2024 |
Wei Yang <richard.weiyang@gmail.com> |
memblock tests: add memblock_reserve_many_may_conflict_check()
This may trigger the case fixed by commit 48c3b583bbdd ("mm/memblock: fix overlapping allocation when doubling reserved array").
This
memblock tests: add memblock_reserve_many_may_conflict_check()
This may trigger the case fixed by commit 48c3b583bbdd ("mm/memblock: fix overlapping allocation when doubling reserved array").
This is done by adding the 129th reserve region into memblock.memory. If memblock_double_array() use this reserve region as new array, it fails.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Link: https://lore.kernel.org/r/20240507075833.6346-3-richard.weiyang@gmail.com Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
show more ...
|
| 3d316519 | 07-May-2024 |
Wei Yang <richard.weiyang@gmail.com> |
memblock tests: add memblock_reserve_all_locations_check()
Instead of adding 129th memory block at the last position, let's try all possible position.
Signed-off-by: Wei Yang <richard.weiyang@gmail
memblock tests: add memblock_reserve_all_locations_check()
Instead of adding 129th memory block at the last position, let's try all possible position.
Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Link: https://lore.kernel.org/r/20240507075833.6346-2-richard.weiyang@gmail.com Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
show more ...
|
| 55122e01 | 14-Sep-2023 |
Mike Rapoport (IBM) <rppt@kernel.org> |
memblock tests: fix warning ‘struct seq_file’ declared inside parameter list
Building memblock tests produces the following warning:
cc -I. -I../../include -Wall -O2 -fsanitize=address -fsanitize=u
memblock tests: fix warning ‘struct seq_file’ declared inside parameter list
Building memblock tests produces the following warning:
cc -I. -I../../include -Wall -O2 -fsanitize=address -fsanitize=undefined -D CONFIG_PHYS_ADDR_T_64BIT -c -o main.o main.c In file included from tests/common.h:9, from tests/basic_api.h:5, from main.c:2: ./linux/memblock.h:601:50: warning: ‘struct seq_file’ declared inside parameter list will not be visible outside of this definition or declaration 601 | static inline void memtest_report_meminfo(struct seq_file *m) { } | ^~~~~~~~
Add declaration of 'struct seq_file' to tools/include/linux/seq_file.h to fix it.
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
show more ...
|
| 115d9d77 | 06-Jan-2023 |
Aaron Thompson <dev@aaront.org> |
mm: Always release pages to the buddy allocator in memblock_free_late().
If CONFIG_DEFERRED_STRUCT_PAGE_INIT is enabled, memblock_free_pages() only releases pages to the buddy allocator if they are
mm: Always release pages to the buddy allocator in memblock_free_late().
If CONFIG_DEFERRED_STRUCT_PAGE_INIT is enabled, memblock_free_pages() only releases pages to the buddy allocator if they are not in the deferred range. This is correct for free pages (as defined by for_each_free_mem_pfn_range_in_zone()) because free pages in the deferred range will be initialized and released as part of the deferred init process. memblock_free_pages() is called by memblock_free_late(), which is used to free reserved ranges after memblock_free_all() has run. All pages in reserved ranges have been initialized at that point, and accordingly, those pages are not touched by the deferred init process. This means that currently, if the pages that memblock_free_late() intends to release are in the deferred range, they will never be released to the buddy allocator. They will forever be reserved.
In addition, memblock_free_pages() calls kmsan_memblock_free_pages(), which is also correct for free pages but is not correct for reserved pages. KMSAN metadata for reserved pages is initialized by kmsan_init_shadow(), which runs shortly before memblock_free_all().
For both of these reasons, memblock_free_pages() should only be called for free pages, and memblock_free_late() should call __free_pages_core() directly instead.
One case where this issue can occur in the wild is EFI boot on x86_64. The x86 EFI code reserves all EFI boot services memory ranges via memblock_reserve() and frees them later via memblock_free_late() (efi_reserve_boot_services() and efi_free_boot_services(), respectively). If any of those ranges happens to fall within the deferred init range, the pages will not be released and that memory will be unavailable.
For example, on an Amazon EC2 t3.micro VM (1 GB) booting via EFI:
v6.2-rc2: # grep -E 'Node|spanned|present|managed' /proc/zoneinfo Node 0, zone DMA spanned 4095 present 3999 managed 3840 Node 0, zone DMA32 spanned 246652 present 245868 managed 178867
v6.2-rc2 + patch: # grep -E 'Node|spanned|present|managed' /proc/zoneinfo Node 0, zone DMA spanned 4095 present 3999 managed 3840 Node 0, zone DMA32 spanned 246652 present 245868 managed 222816 # +43,949 pages
Fixes: 3a80a7fa7989 ("mm: meminit: initialise a subset of struct pages if CONFIG_DEFERRED_STRUCT_PAGE_INIT is set") Signed-off-by: Aaron Thompson <dev@aaront.org> Link: https://lore.kernel.org/r/01010185892de53e-e379acfb-7044-4b24-b30a-e2657c1ba989-000000@us-west-2.amazonses.com Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
show more ...
|
| 80c2fe02 | 07-Nov-2022 |
Rebecca Mckeever <remckee0@gmail.com> |
memblock tests: remove completed TODO item
Remove completed item from TODO list.
Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com> Signed-off-by
memblock tests: remove completed TODO item
Remove completed item from TODO list.
Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Link: https://lore.kernel.org/r/f2263abe45613b28f1583fbf04a4bffcf735bcf6.1667802195.git.remckee0@gmail.com
show more ...
|
| 62bdc990 | 07-Nov-2022 |
Rebecca Mckeever <remckee0@gmail.com> |
memblock tests: add generic NUMA tests for memblock_alloc_exact_nid_raw
Add tests for memblock_alloc_exact_nid_raw() where the simulated physical memory is set up with multiple NUMA nodes. Additiona
memblock tests: add generic NUMA tests for memblock_alloc_exact_nid_raw
Add tests for memblock_alloc_exact_nid_raw() where the simulated physical memory is set up with multiple NUMA nodes. Additionally, all but one of these tests set nid != NUMA_NO_NODE. All tests are run for both top-down and bottom-up allocation directions.
The tested scenarios are:
Range unrestricted: - region cannot be allocated: + there are no previously reserved regions, but requested node is too small + the requested node is fully reserved + the requested node is partially reserved and does not have enough space + none of the nodes have enough memory to allocate the region
Range restricted: - region can be allocated in the specific node requested without dropping min_addr: + the range fully overlaps with the node, and there are adjacent reserved regions - region cannot be allocated: + range partially overlaps with two different nodes, where the second node is the requested node + range overlaps with multiple nodes along node boundaries, and the requested node starts after max_addr + nid is set to NUMA_NO_NODE and the total range can fit the region, but the range is split between two nodes and everything else is reserved
Acked-by: David Hildenbrand <david@redhat.com> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Link: https://lore.kernel.org/r/51b14da46e6591428df3aefc5acc7dca9341a541.1667802195.git.remckee0@gmail.com
show more ...
|