Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tianyi Chen <hi@tychen.cc>
To: Mike Rapoport <rppt@kernel.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/4] memblock tests: fix BUILD=32 address conversions and warnings
Date: Wed, 23 Sep 2026 11:31:22 +0900	[thread overview]
Message-ID: <20260923023126.1910311-1-hi@tychen.cc> (raw)

Fix the BUILD=32 physical-address truncation and sign-extension failures,
and address the remaining GCC warnings reported during review.

Changes in v2:
- Use memblock_phys_free() for all synthetic physical ranges in the basic
  API tests, not only the maximum-address check.
- Keep the dummy-memory address conversion fix unchanged.
- Use __pa() in tools virt_to_phys() to avoid a pointer-size warning and
  sign extension of 32-bit pointers with their top bit set.
- Initialize end_rgn to avoid GCC's maybe-uninitialized warning.

Clang BUILD=32 without NUMA also passes on v1 (189 checks). The earlier
cover letter only mentioned the NUMA-enabled configuration tested then.

Validated v2 with GCC 13.3.0 and Clang 18.1.3, retaining the default ASan
and UBSan flags and adding -Werror. Both compilers build without warnings
and pass ./main -v and ./main -m -v in each configuration:
- Default and NUMA=1.
- BUILD=32, with and without NUMA=1.
- 32BIT_PHYS_ADDR_T=1, with and without NUMA=1.
- BUILD=32 NUMA=1 MEMBLOCK_DEBUG=1.

Each run passes 189 checks without NUMA or 272 with NUMA, including both
allocation directions. A separate virt_to_phys() boundary check passes
with both compilers in 32- and 64-bit builds; GCC BUILD=32 failed it on
v1 for 0x80000000 due to sign extension.

v1: https://lore.kernel.org/r/20260916161105.2548281-1-hi@tychen.cc

Tianyi Chen (4):
  memblock tests: use physical addresses for region removal
  memblock tests: zero-extend simulated memory addresses
  tools: use __pa() in virt_to_phys()
  memblock: initialize the region merge end index

 mm/memblock.c                            |  2 +-
 tools/include/linux/mm.h                 |  2 +-
 tools/testing/memblock/tests/basic_api.c | 20 ++++++++++----------
 tools/testing/memblock/tests/common.c    |  6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)


base-commit: 5728d3523f12826a2b180c1c5738f74e33197e14
-- 
2.55.0



             reply	other threads:[~2026-09-23  2:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  2:31 Tianyi Chen [this message]
2026-09-23  2:31 ` [PATCH v2 1/4] memblock tests: use physical addresses for region removal Tianyi Chen
2026-09-23  2:31 ` [PATCH v2 2/4] memblock tests: zero-extend simulated memory addresses Tianyi Chen
2026-09-23  2:31 ` [PATCH v2 3/4] tools: use __pa() in virt_to_phys() Tianyi Chen
2026-09-23  2:31 ` [PATCH v2 4/4] memblock: initialize the region merge end index Tianyi Chen
2026-09-24  7:57 ` [PATCH v2 0/4] memblock tests: fix BUILD=32 address conversions and warnings Mike Rapoport

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260923023126.1910311-1-hi@tychen.cc \
    --to=hi@tychen.cc \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox