Skip to contentSkip to conversation

lib/alloc_tag.c:815:25: sparse: sparse: cast removes address space '__rcu' of expression

PATCH kernel test robot 2 participants 2 messages Mar 29 – Mar 31 Memory management

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
head:   df2267b6380964f1305128001f05bc043ddf1f37
commit: 8bee7b4b574f880ff2c7491212e2ef01cd82f2fd [193/194] mm/alloc_tag: clear codetag for pages allocated before page_ext initialization
config: openrisc-randconfig-r121-20260329 (https://download.01.org/0day-ci/archive/20260329/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 10.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260329/[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 >>)

>> lib/alloc_tag.c:815:25: sparse: sparse: cast removes address space '__rcu' of expression
>> lib/alloc_tag.c:815:25: sparse: sparse: incompatible types in comparison expression (different address spaces):

lib/alloc_tag.c:815:25: sparse: void ( [noderef] __rcu * )( ... )
lib/alloc_tag.c:815:25: sparse: void ( * )( ... )
lib/alloc_tag.c:828:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
lib/alloc_tag.c:828:9: sparse: void ( [noderef] __rcu * )( ... )
lib/alloc_tag.c:828:9: sparse: void ( * )( ... )

vim +/__rcu +815 lib/alloc_tag.c

802
803 typedef void (*alloc_tag_add_func)(unsigned long pfn);
804 static alloc_tag_add_func __rcu alloc_tag_add_early_pfn_ptr __refdata =
805 __alloc_tag_add_early_pfn;
806
807 void alloc_tag_add_early_pfn(unsigned long pfn)
808 {
809 alloc_tag_add_func alloc_tag_add;
810
811 if (static_key_enabled(&mem_profiling_compressed))
812 return;
813
814 rcu_read_lock();

 > 815		alloc_tag_add = rcu_dereference(alloc_tag_add_early_pfn_ptr);

816 if (alloc_tag_add)
817 alloc_tag_add(pfn);
818 rcu_read_unlock();
819 }
820

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw

Hi

Quoted 37 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
head:   df2267b6380964f1305128001f05bc043ddf1f37
commit: 8bee7b4b574f880ff2c7491212e2ef01cd82f2fd [193/194] mm/alloc_tag: clear codetag for pages allocated before page_ext initialization
config: openrisc-randconfig-r121-20260329 (https://download.01.org/0day-ci/archive/20260329/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 10.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260329/[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 >>)

Quoted 2 lines
Quoted 2 lines

lib/alloc_tag.c:815:25: sparse: sparse: cast removes address space '__rcu' of expression lib/alloc_tag.c:815:25: sparse: sparse: incompatible types in comparison expression (different address spaces):

    lib/alloc_tag.c:815:25: sparse:    void ( [noderef] __rcu * )( ... )
    lib/alloc_tag.c:815:25: sparse:    void ( * )( ... )
    lib/alloc_tag.c:828:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
    lib/alloc_tag.c:828:9: sparse:    void ( [noderef] __rcu * )( ... )
    lib/alloc_tag.c:828:9: sparse:    void ( * )( ... )

vim +/__rcu +815 lib/alloc_tag.c

    802	
    803	typedef void (*alloc_tag_add_func)(unsigned long pfn);
    804	static alloc_tag_add_func __rcu alloc_tag_add_early_pfn_ptr __refdata =
    805			__alloc_tag_add_early_pfn;
    806	
    807	void alloc_tag_add_early_pfn(unsigned long pfn)
    808	{
    809		alloc_tag_add_func alloc_tag_add;
    810	
    811		if (static_key_enabled(&mem_profiling_compressed))
    812			return;
    813	
    814		rcu_read_lock();
Quoted 7 lines
Quoted 1 line

815 alloc_tag_add = rcu_dereference(alloc_tag_add_early_pfn_ptr);

    816		if (alloc_tag_add)
    817			alloc_tag_add(pfn);
    818		rcu_read_unlock();
    819	}
    820	

Thanks.

The v4 patch I've just posted has fixed the issue. Thanks for your report.

Thanks

Hao