arch/arm64/include/asm/percpu.h:261:1: sparse: sparse: cast truncates bits from constant value (ffffffffffffd8f0 becomes f0)
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable head: 7d1a16abe4cc5dccd21e3d6262e44433a5885d27 commit: 7d1a16abe4cc5dccd21e3d6262e44433a5885d27 [327/327] mm: vmstat_kunit: add synthetic benchmark for mm stats config: arm64-randconfig-r2305-20261121 (https://download.01.org/0day-ci/archive/20261121/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 15.3.0 sparse: v0.6.5-rc1-21-g84ec0658 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261121/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
mm/tests/vmstat_kunit.c: note: in included file (through include/linux/irqflags.h, include/linux/spinlock.h, include/linux/kref.h, include/kunit/test.h):
>> arch/arm64/include/asm/percpu.h:261:1: sparse: sparse: cast truncates bits from constant value (ffffffffffffd8f0 becomes f0)
vim +261 arch/arm64/include/asm/percpu.h
535fdfc5a22852 Catalin Marinas 2025-11-06 254 535fdfc5a22852 Catalin Marinas 2025-11-06 255 /* 535fdfc5a22852 Catalin Marinas 2025-11-06 256 * Use value-returning atomics for CPU-local ops as they are more likely 535fdfc5a22852 Catalin Marinas 2025-11-06 257 * to execute "near" to the CPU (e.g. in L1$). 535fdfc5a22852 Catalin Marinas 2025-11-06 258 * 535fdfc5a22852 Catalin Marinas 2025-11-06 259 * https://lore.kernel.org/r/e7d539ed-ced0-4b96-8ecd-048a5b803b85@paulmck-laptop 535fdfc5a22852 Catalin Marinas 2025-11-06 260 */ 535fdfc5a22852 Catalin Marinas 2025-11-06 @261 PERCPU_OP(add, add, ldadd) 535fdfc5a22852 Catalin Marinas 2025-11-06 262 PERCPU_OP(andnot, bic, ldclr) 535fdfc5a22852 Catalin Marinas 2025-11-06 263 PERCPU_OP(or, orr, ldset) 959bf2fd03b59f Will Deacon 2018-09-13 264 PERCPU_RET_OP(add, add, ldadd)
959bf2fd03b59f Will Deacon 2018-09-13 265
:::::: The code at line 261 was first introduced by commit
:::::: 535fdfc5a228524552ee8810c9175e877e127c27 arm64: Use load LSE atomics for the non-return per-CPU atomic operations
:::::: TO: Catalin Marinas <[email protected]> :::::: CC: Will Deacon <[email protected]>
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Andrew Morton
maintainerQuoted 8 lines · On Sat, 21 Nov 2026 13:34:45 +0100 kernel test robot <[email protected]> wrote:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable head: 7d1a16abe4cc5dccd21e3d6262e44433a5885d27 commit: 7d1a16abe4cc5dccd21e3d6262e44433a5885d27 [327/327] mm: vmstat_kunit: add synthetic benchmark for mm stats config: arm64-randconfig-r2305-20261121 (https://download.01.org/0day-ci/archive/20261121/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 15.3.0 sparse: v0.6.5-rc1-21-g84ec0658 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261121/[email protected]/reproduce)
Quoted 8 lines
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/sparse warnings: (new ones prefixed by >>)
mm/tests/vmstat_kunit.c: note: in included file (throughinclude/linux/irqflags.h,include/linux/spinlock.h,include/linux/kref.h,include/kunit/test.h):Quoted 1 line
Quoted 1 line
arch/arm64/include/asm/percpu.h:261:1: sparse: sparse: cast truncates bits from constant value (ffffffffffffd8f0becomes f0)
Thanks. sparse is being a bit silly here. Using a variable instead of a constant silences it.
From: Andrew Morton <[email protected]>
Subject: mm/vmstat_kunit: avoid sparse warning in vm event cleanup
Date: Sun, 22 Nov 2026 18:51:40 -0800
Sparse warns about -TEST_COUNT in an unreachable 1-byte arm64 per-CPU case; the actual counter is 8 bytes. Pass the completed loop count instead to silence the warning, with no behavior change.
mm/tests/vmstat_kunit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/tests/vmstat_kunit.c renamed from mm/tests/vmstat_kunit.c~mm-vmstat_kunit-add-synthetic-benchmark-for-mm-stats-fix +2 -2
@@ -107,7 +107,7 @@ static void vmstat_test_interleaved_zone/* * Test 3: count_vm_event() benchmark. -* Restores counter balance with count_vm_events(item, -TEST_COUNT). +* Restores counter balance after measurement. */ static void vmstat_test_count_vm_event (struct kunit *test) {
@@ -124,7 +124,7 @@ static void vmstat_test_count_vm_event(s time2 =get_cycles ();/* Restore balance */ -count_vm_events (SLABS_SCANNED , -TEST_COUNT ); +count_vm_events (SLABS_SCANNED , -(long )i); time = time2 - time1; avg_cycles =div_u64 (time,TEST_COUNT );
_
Quoted 15 lines · Andrew Morton
Quoted 13 lines · On Sat, 21 Nov 2026 13:34:45 +0100 kernel test robot <[email protected]> wrote:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable head: 7d1a16abe4cc5dccd21e3d6262e44433a5885d27 commit: 7d1a16abe4cc5dccd21e3d6262e44433a5885d27 [327/327] mm: vmstat_kunit: add synthetic benchmark for mm stats config: arm64-randconfig-r2305-20261121 (https://download.01.org/0day-ci/archive/20261121/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 15.3.0 sparse: v0.6.5-rc1-21-g84ec0658 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261121/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Quoted 7 lines
Quoted 3 lines
sparse warnings: (new ones prefixed by >>)
mm/tests/vmstat_kunit.c: note: in included file (throughinclude/linux/irqflags.h,include/linux/spinlock.h,include/linux/kref.h,include/kunit/test.h):Quoted 1 line
Quoted 1 line
arch/arm64/include/asm/percpu.h:261:1: sparse: sparse: cast truncates bits from constant value (ffffffffffffd8f0becomes f0)Thanks. sparse is being a bit silly here. Using a variable instead of a constant silences it.
Thanks very much for taking care of this, Andrew!
Quoted 50 lines
From: Andrew Morton <[email protected]>
Subject:mm/vmstat_kunit: avoid sparse warning in vm event cleanup
Date: Sun, 22 Nov 2026 18:51:40 -0800Sparse warns about -TEST_COUNT in an unreachable 1-byte arm64 per-CPU case; the actual counter is 8 bytes. Pass the completed loop count instead to silence the warning, with no behavior change.
Fixes 7d1a16abe4cc ("mm: vmstat_kunit: add synthetic benchmark for mm stats")Signed-off-by Andrew Morton <[email protected]>Reported-by kernel test robot <[email protected]>Cc Christoph Lameter <[email protected]>Cc David Rientjes <[email protected]>Cc David Hildenbrand <[email protected]>Cc Liam R. Howlett <[email protected]>Cc Vlastimil Babka <[email protected]>Cc Mike Rapoport <[email protected]>Cc Michal Hocko <[email protected]>Cc Mathieu Desnoyers <[email protected]>Cc Sarthak Sharma <[email protected]>mm/tests/vmstat_kunit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)mm/tests/vmstat_kunit.c renamed from mm/tests/vmstat_kunit.c~mm-vmstat_kunit-add-synthetic-benchmark-for-mm-stats-fix +2
-2@@ -107,7 +107,7 @@ static void vmstat_test_interleaved_zone/* * Test 3: count_vm_event() benchmark. -* Restores counter balance with count_vm_events(item, -TEST_COUNT). +* Restores counter balance after measurement. */ static void vmstat_test_count_vm_event (struct kunit *test) {@@ -124,7 +124,7 @@ static void vmstat_test_count_vm_event(s time2 =get_cycles ();/* Restore balance */ -count_vm_events (SLABS_SCANNED , -TEST_COUNT ); +count_vm_events (SLABS_SCANNED , -(long )i); time = time2 - time1; avg_cycles =div_u64 (time,TEST_COUNT );_