Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [akpm-mm:mm-unstable 327/327] arch/arm64/include/asm/percpu.h:261:1: sparse: sparse: cast truncates bits from constant value (ffffffffffffd8f0 becomes f0)
@ 2026-11-21 12:34 kernel test robot
  2026-11-23  3:48 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2026-11-21 12:34 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: oe-kbuild-all, David Hildenbrand, Andrew Morton,
	Linux Memory Management List, mm-commits, David Rientjes

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/20261121133112.48w1QOqw-lkp@intel.com/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/20261121133112.48w1QOqw-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261121133112.48w1QOqw-lkp@intel.com/

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 <catalin.marinas@arm.com>
:::::: CC: Will Deacon <will@kernel.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


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

* Re: [akpm-mm:mm-unstable 327/327] arch/arm64/include/asm/percpu.h:261:1: sparse: sparse: cast truncates bits from constant value (ffffffffffffd8f0 becomes f0)
  2026-11-21 12:34 [akpm-mm:mm-unstable 327/327] arch/arm64/include/asm/percpu.h:261:1: sparse: sparse: cast truncates bits from constant value (ffffffffffffd8f0 becomes f0) kernel test robot
@ 2026-11-23  3:48 ` Andrew Morton
  2026-11-23 17:04   ` David Rientjes
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2026-11-23  3:48 UTC (permalink / raw)
  To: kernel test robot
  Cc: Christoph Lameter, oe-kbuild-all, David Hildenbrand,
	Linux Memory Management List, mm-commits, David Rientjes

On Sat, 21 Nov 2026 13:34:45 +0100 kernel test robot <lkp@intel.com> 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/20261121133112.48w1QOqw-lkp@intel.com/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/20261121133112.48w1QOqw-lkp@intel.com/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 <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/20261121133112.48w1QOqw-lkp@intel.com/
> 
> 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)

Thanks.  sparse is being a bit silly here.  Using a variable instead of
a constant silences it.


From: Andrew Morton <akpm@linux-foundation.org>
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.

Link: https://lore.kernel.org/r/21183f5b-2697-cbe6-6370-dbd27c5e2b60@google.com
Fixes: 7d1a16abe4cc ("mm: vmstat_kunit: add synthetic benchmark for mm stats")
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/20261121133112.48w1QOqw-lkp@intel.com/
Cc: Christoph Lameter <cl@gentwo.org>
Cc: David Rientjes <rientjes@google.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Sarthak Sharma <sarthak.sharma@arm.com>

 mm/tests/vmstat_kunit.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/tests/vmstat_kunit.c~mm-vmstat_kunit-add-synthetic-benchmark-for-mm-stats-fix
+++ a/mm/tests/vmstat_kunit.c
@@ -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);
_



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

* Re: [akpm-mm:mm-unstable 327/327] arch/arm64/include/asm/percpu.h:261:1: sparse: sparse: cast truncates bits from constant value (ffffffffffffd8f0 becomes f0)
  2026-11-23  3:48 ` Andrew Morton
@ 2026-11-23 17:04   ` David Rientjes
  0 siblings, 0 replies; 3+ messages in thread
From: David Rientjes @ 2026-11-23 17:04 UTC (permalink / raw)
  To: Andrew Morton
  Cc: kernel test robot, Christoph Lameter, oe-kbuild-all,
	David Hildenbrand, Linux Memory Management List, mm-commits

On Sun, 22 Nov 2026, Andrew Morton wrote:

> On Sat, 21 Nov 2026 13:34:45 +0100 kernel test robot <lkp@intel.com> 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/20261121133112.48w1QOqw-lkp@intel.com/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/20261121133112.48w1QOqw-lkp@intel.com/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 <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/20261121133112.48w1QOqw-lkp@intel.com/
> > 
> > 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)
> 
> 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!

> 
> From: Andrew Morton <akpm@linux-foundation.org>
> 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.
> 
> Link: https://lore.kernel.org/r/21183f5b-2697-cbe6-6370-dbd27c5e2b60@google.com
> Fixes: 7d1a16abe4cc ("mm: vmstat_kunit: add synthetic benchmark for mm stats")
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/20261121133112.48w1QOqw-lkp@intel.com/
> Cc: Christoph Lameter <cl@gentwo.org>
> Cc: David Rientjes <rientjes@google.com>
> Cc: David Hildenbrand <david@kernel.org>
> Cc: Liam R. Howlett <liam@infradead.org>
> Cc: Vlastimil Babka <vbabka@kernel.org>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Sarthak Sharma <sarthak.sharma@arm.com>
> 
>  mm/tests/vmstat_kunit.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- a/mm/tests/vmstat_kunit.c~mm-vmstat_kunit-add-synthetic-benchmark-for-mm-stats-fix
> +++ a/mm/tests/vmstat_kunit.c
> @@ -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);
> _
> 
> 


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

end of thread, other threads:[~2026-11-23 17:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-21 12:34 [akpm-mm:mm-unstable 327/327] arch/arm64/include/asm/percpu.h:261:1: sparse: sparse: cast truncates bits from constant value (ffffffffffffd8f0 becomes f0) kernel test robot
2026-11-23  3:48 ` Andrew Morton
2026-11-23 17:04   ` David Rientjes

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