[PATCH 0/2] memblock tests: fix BUILD=32 address conversions

Tianyi Chen posted 2 patches 1 week, 1 day ago
tools/testing/memblock/tests/basic_api.c | 6 +++---
tools/testing/memblock/tests/common.c    | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
[PATCH 0/2] memblock tests: fix BUILD=32 address conversions
Posted by Tianyi Chen 1 week, 1 day ago
Fix two BUILD=32 failures: truncating a physical address before freeing
it, and sign-extending simulated memory addresses. Existing assertions
cover both regressions.

The runner passes with GCC in both allocation directions across 32-bit
builds, 32-bit phys_addr_t, and NUMA configurations. BUILD=32 NUMA=1 also
passes with Clang.

Tianyi Chen (2):
  memblock tests: use physical free for the maximum-address check
  memblock tests: zero-extend simulated memory addresses

 tools/testing/memblock/tests/basic_api.c | 6 +++---
 tools/testing/memblock/tests/common.c    | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)


base-commit: 5728d3523f12826a2b180c1c5738f74e33197e14
-- 
2.55.0
Re: [PATCH 0/2] memblock tests: fix BUILD=32 address conversions
Posted by Mike Rapoport 2 days, 17 hours ago
> Fix two BUILD=32 failures: truncating a physical address before freeing
> it, and sign-extending simulated memory addresses. Existing assertions
> cover both regressions.
> 
> The runner passes with GCC in both allocation directions across 32-bit
> builds, 32-bit phys_addr_t, and NUMA configurations. BUILD=32 NUMA=1 also
> passes with Clang.

Does it mean BUILD=32 without NUMA does not pass with clang?

I see a lot of warnings with gcc and BUILD=32. Do you mind fixing them
as well?

-- 
Sincerely yours,
Mike.
Re: [PATCH 0/2] memblock tests: fix BUILD=32 address conversions
Posted by Tianyi Chen 2 days, 1 hour ago
Hi Mike,

> Does it mean BUILD=32 without NUMA does not pass with clang?

No. I reran v1 with Clang 18.1.3 and BUILD=32 without NUMA: all 189
checks pass. The previous cover letter only mentioned the NUMA-enabled
configuration tested then. Sorry for the ambiguity.

> I see a lot of warnings with gcc and BUILD=32. Do you mind fixing them
> as well?

Done in v2. I reproduced them with GCC 13.3.0 and removed the remaining
physical-address-to-pointer casts, used __pa() in tools virt_to_phys(),
and initialized end_rgn to address the maybe-uninitialized warning.
The latter is a false positive; each insertion already sets the index.

The virt_to_phys() cast also sign-extended 0x80000000 to
0xffffffff80000000 with GCC BUILD=32. A separate boundary check now
passes with both compilers in 32- and 64-bit builds.

GCC and Clang each pass seven configurations with -Werror and the default
ASan/UBSan flags, including BUILD=32 with and without NUMA. Details are
in the v2 cover letter, sent as a new thread:
https://lore.kernel.org/r/20260923023126.1910311-1-hi@tychen.cc

Thanks,
Tianyi