DAMON development mailing list
 help / color / mirror / Atom feed
* [PATCH] mm/damon/paddr: avoid truncation warning in high-address KUnit test
@ 2026-11-17 17:04 Aveline Noir
  2026-11-17 17:19 ` sashiko-bot
  2026-11-18  1:32 ` SJ Park
  0 siblings, 2 replies; 3+ messages in thread
From: Aveline Noir @ 2026-11-17 17:04 UTC (permalink / raw)
  To: SJ Park, Andrew Morton
  Cc: damon, David Hildenbrand, Justin Stitt, lienze, linux-kernel,
	Linux Memory Management List, kernel test robot, llvm, mm-commits,
	Bill Wendling, Nathan Chancellor, Nick Desaulniers, oe-kbuild-all,
	rdunlap, sashiko-bot, sashiko-reviews

Hi SJ, Andrew,

The kernel test robot caught this issue in my earlier addr_unit KUnit
patch. Feel free to fold this fix into that patch.

Thanks,
Aveline Noir

-- >8 --
When phys_addr_t is 32-bit, Sparse warns about truncating the u64 address
passed to damon_pa_core_addr() in damon_test_pa_addr_over_4g().  The
runtime kunit_skip() does not prevent Sparse from checking that
conversion.

Compile the high-address assertions only with CONFIG_PHYS_ADDR_T_64BIT,
and keep the test skipped otherwise.

Fixes: 7a983cc1b573 ("mm/damon/paddr: add KUnit tests for addr_unit conversion")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/20261117170155.fEdeuuhm-lkp@intel.com/
Signed-off-by: Aveline Noir <jm5905938@gmail.com>
---
The reported warning is gone with the original i386 config, Clang 22.1.8
and Sparse v0.6.5-rc1-21-g84ec0658. All executed DAMON KUnit tests passed
on x86_64 and i386 with and without PAE; the high-address case skips
without PAE.
---
 mm/damon/tests/paddr-kunit.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mm/damon/tests/paddr-kunit.h b/mm/damon/tests/paddr-kunit.h
index 9839cc233071..2b11f0e67a12 100644
--- a/mm/damon/tests/paddr-kunit.h
+++ b/mm/damon/tests/paddr-kunit.h
@@ -26,15 +26,16 @@ static void damon_test_pa_core_addr(struct kunit *test)
 
 static void damon_test_pa_addr_over_4g(struct kunit *test)
 {
+#ifdef CONFIG_PHYS_ADDR_T_64BIT
 	unsigned long addr = 0xffffffffUL;
 	unsigned long addr_unit = 0x1000;
 	u64 pa = 0xffffffff000ULL;
 
-	if (!IS_ENABLED(CONFIG_PHYS_ADDR_T_64BIT))
-		kunit_skip(test, "phys_addr_t is 32-bit");
-
 	KUNIT_EXPECT_EQ(test, damon_pa_phys_addr(addr, addr_unit), pa);
 	KUNIT_EXPECT_EQ(test, damon_pa_core_addr(pa, addr_unit), addr);
+#else
+	kunit_skip(test, "phys_addr_t is 32-bit");
+#endif
 }
 
 static struct kunit_case damon_paddr_test_cases[] = {

---
base-commit: 7a983cc1b57309a875a9e07a934c9944bf3d088d
change-id: 20261118-fix-damon-paddr-sparse-20261118-fb08902768d7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/damon/paddr: avoid truncation warning in high-address KUnit test
  2026-11-17 17:04 [PATCH] mm/damon/paddr: avoid truncation warning in high-address KUnit test Aveline Noir
@ 2026-11-17 17:19 ` sashiko-bot
  2026-11-18  1:32 ` SJ Park
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-17 17:19 UTC (permalink / raw)
  To: Aveline Noir; +Cc: damon

> Hi SJ, Andrew,
> 
> The kernel test robot caught this issue in my earlier addr_unit KUnit
> patch. Feel free to fold this fix into that patch.
> 
> Thanks,
> Aveline Noir
> 
> -- >8 --
> When phys_addr_t is 32-bit, Sparse warns about truncating the u64 address
> passed to damon_pa_core_addr() in damon_test_pa_addr_over_4g().  The
> runtime kunit_skip() does not prevent Sparse from checking that
> conversion.
> 
> Compile the high-address assertions only with CONFIG_PHYS_ADDR_T_64BIT,
> and keep the test skipped otherwise.
> 
> Fixes: 7a983cc1b573 ("mm/damon/paddr: add KUnit tests for addr_unit conversion")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/20261117170155.fEdeuuhm-lkp@intel.com/
> Signed-off-by: Aveline Noir <jm5905938@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118-fix-damon-paddr-sparse-20261118-v1-1-3a0e943406d5@gmail.com?part=1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm/damon/paddr: avoid truncation warning in high-address KUnit test
  2026-11-17 17:04 [PATCH] mm/damon/paddr: avoid truncation warning in high-address KUnit test Aveline Noir
  2026-11-17 17:19 ` sashiko-bot
@ 2026-11-18  1:32 ` SJ Park
  1 sibling, 0 replies; 3+ messages in thread
From: SJ Park @ 2026-11-18  1:32 UTC (permalink / raw)
  To: Aveline Noir
  Cc: SJ Park, Andrew Morton, damon, David Hildenbrand, Justin Stitt,
	lienze, linux-kernel, Linux Memory Management List,
	kernel test robot, llvm, mm-commits, Bill Wendling,
	Nathan Chancellor, Nick Desaulniers, oe-kbuild-all, rdunlap,
	sashiko-bot, sashiko-reviews

Hi Aveline,

On Wed, 18 Nov 2026 04:04:33 +1100 Aveline Noir <jm5905938@gmail.com> wrote:

> Hi SJ, Andrew,
> 
> The kernel test robot caught this issue in my earlier addr_unit KUnit
> patch. Feel free to fold this fix into that patch.

I will ping Andrew again on Thursday, if Andrew doesn't add this fixup to
mm.git by the time.


Thanks,
SJ

[...]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-18  1:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 17:04 [PATCH] mm/damon/paddr: avoid truncation warning in high-address KUnit test Aveline Noir
2026-11-17 17:19 ` sashiko-bot
2026-11-18  1:32 ` SJ Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox