Re: [PATCH v2 1/2] memblock tests: model the low allocation limit within dummy memory

From: Mike Rapoport

Date: Wed Sep 09 2026 - 14:56:28 EST


Hi,

> The simulator represents physical addresses using the address of its
> allocated buffer. That buffer can lie above the default
> ARCH_LOW_ADDRESS_LIMIT, preventing meaningful memblock_alloc_low()
> tests.
>
> Use the architecture override in asm/dma.h to place the limit halfway
> through the MEM_SIZE region registered by setup_memblock(). This leaves
> registered memory on both sides of the limit. PHYS_MEM_SIZE describes
> the larger backing allocation, rather than the registered region.
> Resolve the limit after allocating the buffer. The production allocator
> is unchanged.
>
> Assisted-by: Codex:GPT-6
> Signed-off-by: Tianyi Chen <hi@xxxxxxxxx>
>
> diff --git a/tools/testing/memblock/asm/dma.h b/tools/testing/memblock/asm/dma.h
> index 13ff8e5d22ef6..6607408dcf25d 100644
> --- a/tools/testing/memblock/asm/dma.h
> +++ b/tools/testing/memblock/asm/dma.h
> @@ -2,4 +2,10 @@
> #ifndef _TOOLS_DMA_H
> #define _TOOLS_DMA_H
>
> +#include <linux/types.h>
> +
> +phys_addr_t dummy_physical_memory_low_limit(void);
> +
> +#define ARCH_LOW_ADDRESS_LIMIT dummy_physical_memory_low_limit()
> +
> #endif
> diff --git a/tools/testing/memblock/tests/common.c b/tools/testing/memblock/tests/common.c
> index 3250c8e5124b3..17b95af216b2c 100644
> --- a/tools/testing/memblock/tests/common.c
> +++ b/tools/testing/memblock/tests/common.c
> @@ -118,6 +118,12 @@ phys_addr_t dummy_physical_memory_base(void)
> return (phys_addr_t)memory_block.base;
> }
>
> +phys_addr_t dummy_physical_memory_low_limit(void)
> +{
> + /* Split the MEM_SIZE region registered by setup_memblock(), not the buffer. */

The comment should not address the review comments ;-)

It should state the universal truth, like "low limit is half of the
memory registered with setup_memblock()"

--
Sincerely yours,
Mike.