Hi Jiri, I love your patch! Yet something to improve: [auto build test ERROR on akpm-mm/mm-everything] url: https://github.com/intel-lab-lkp/linux/commits/Jiri-Kosina/mm-slab-Annotate-kmem_cache_node-list_lock-as-raw/20221021-225037 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/nycvar.YFH.7.76.2210211643330.29912%40cbobk.fhfr.pm patch subject: [PATCH] mm/slab: Annotate kmem_cache_node->list_lock as raw config: riscv-randconfig-r023-20221019 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/709b8ca6934319e9e8e0519baa3ac2bb4f634451 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Jiri-Kosina/mm-slab-Annotate-kmem_cache_node-list_lock-as-raw/20221021-225037 git checkout 709b8ca6934319e9e8e0519baa3ac2bb4f634451 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/riscv/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/riscv/include/asm/io.h:136: include/asm-generic/io.h:751:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] insw(addr, buffer, count); ^~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/include/asm/io.h:105:53: note: expanded from macro 'insw' #define insw(addr, buffer, count) __insw(PCI_IOBASE + (addr), buffer, count) ~~~~~~~~~~ ^ In file included from mm/slub.c:14: In file included from include/linux/swap.h:9: In file included from include/linux/memcontrol.h:13: In file included from include/linux/cgroup.h:26: In file included from include/linux/kernel_stat.h:9: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/riscv/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/riscv/include/asm/io.h:136: include/asm-generic/io.h:759:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] insl(addr, buffer, count); ^~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/include/asm/io.h:106:53: note: expanded from macro 'insl' #define insl(addr, buffer, count) __insl(PCI_IOBASE + (addr), buffer, count) ~~~~~~~~~~ ^ In file included from mm/slub.c:14: In file included from include/linux/swap.h:9: In file included from include/linux/memcontrol.h:13: In file included from include/linux/cgroup.h:26: In file included from include/linux/kernel_stat.h:9: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/riscv/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/riscv/include/asm/io.h:136: include/asm-generic/io.h:768:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] outsb(addr, buffer, count); ^~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/include/asm/io.h:118:55: note: expanded from macro 'outsb' #define outsb(addr, buffer, count) __outsb(PCI_IOBASE + (addr), buffer, count) ~~~~~~~~~~ ^ In file included from mm/slub.c:14: In file included from include/linux/swap.h:9: In file included from include/linux/memcontrol.h:13: In file included from include/linux/cgroup.h:26: In file included from include/linux/kernel_stat.h:9: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/riscv/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/riscv/include/asm/io.h:136: include/asm-generic/io.h:777:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] outsw(addr, buffer, count); ^~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/include/asm/io.h:119:55: note: expanded from macro 'outsw' #define outsw(addr, buffer, count) __outsw(PCI_IOBASE + (addr), buffer, count) ~~~~~~~~~~ ^ In file included from mm/slub.c:14: In file included from include/linux/swap.h:9: In file included from include/linux/memcontrol.h:13: In file included from include/linux/cgroup.h:26: In file included from include/linux/kernel_stat.h:9: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/riscv/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/riscv/include/asm/io.h:136: include/asm-generic/io.h:786:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] outsl(addr, buffer, count); ^~~~~~~~~~~~~~~~~~~~~~~~~~ arch/riscv/include/asm/io.h:120:55: note: expanded from macro 'outsl' #define outsl(addr, buffer, count) __outsl(PCI_IOBASE + (addr), buffer, count) ~~~~~~~~~~ ^ In file included from mm/slub.c:14: In file included from include/linux/swap.h:9: In file included from include/linux/memcontrol.h:13: In file included from include/linux/cgroup.h:26: In file included from include/linux/kernel_stat.h:9: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/riscv/include/generated/asm/hardirq.h:1: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/riscv/include/asm/io.h:136: include/asm-generic/io.h:1134:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port; ~~~~~~~~~~ ^ >> mm/slub.c:2124:20: error: incompatible pointer types passing 'raw_spinlock_t *' (aka 'struct raw_spinlock *') to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Werror,-Wincompatible-pointer-types] spin_lock_irqsave(&n->list_lock, flags); ^~~~~~~~~~~~~ include/linux/spinlock.h:380:39: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ ^~~~ include/linux/spinlock.h:243:34: note: expanded from macro 'raw_spin_lock_irqsave' flags = _raw_spin_lock_irqsave(lock); \ ^~~~ include/linux/spinlock.h:323:67: note: passing argument to parameter 'lock' here static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) ^ mm/slub.c:2132:25: error: incompatible pointer types passing 'raw_spinlock_t *' (aka 'struct raw_spinlock *') to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Werror,-Wincompatible-pointer-types] spin_unlock_irqrestore(&n->list_lock, flags); ^~~~~~~~~~~~~ include/linux/spinlock.h:403:64: note: passing argument to parameter 'lock' here static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) ^ mm/slub.c:2210:20: error: incompatible pointer types passing 'raw_spinlock_t *' (aka 'struct raw_spinlock *') to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Werror,-Wincompatible-pointer-types] spin_lock_irqsave(&n->list_lock, flags); ^~~~~~~~~~~~~ include/linux/spinlock.h:380:39: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ ^~~~ include/linux/spinlock.h:243:34: note: expanded from macro 'raw_spin_lock_irqsave' flags = _raw_spin_lock_irqsave(lock); \ ^~~~ include/linux/spinlock.h:323:67: note: passing argument to parameter 'lock' here static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) ^ mm/slub.c:2247:25: error: incompatible pointer types passing 'raw_spinlock_t *' (aka 'struct raw_spinlock *') to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Werror,-Wincompatible-pointer-types] spin_unlock_irqrestore(&n->list_lock, flags); ^~~~~~~~~~~~~ include/linux/spinlock.h:403:64: note: passing argument to parameter 'lock' here static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) ^ mm/slub.c:2199:15: warning: variable 'partial_slabs' set but not used [-Wunused-but-set-variable] unsigned int partial_slabs = 0; ^ mm/slub.c:2489:21: error: incompatible pointer types passing 'raw_spinlock_t *' (aka 'struct raw_spinlock *') to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Werror,-Wincompatible-pointer-types] spin_lock_irqsave(&n->list_lock, flags); ^~~~~~~~~~~~~ include/linux/spinlock.h:380:39: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ ^~~~ include/linux/spinlock.h:243:34: note: expanded from macro 'raw_spin_lock_irqsave' flags = _raw_spin_lock_irqsave(lock); \ ^~~~ include/linux/spinlock.h:323:67: note: passing argument to parameter 'lock' here static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) ^ mm/slub.c:2497:21: error: incompatible pointer types passing 'raw_spinlock_t *' (aka 'struct raw_spinlock *') to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Werror,-Wincompatible-pointer-types] spin_lock_irqsave(&n->list_lock, flags); ^~~~~~~~~~~~~ include/linux/spinlock.h:380:39: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ ^~~~ include/linux/spinlock.h:243:34: note: expanded from macro 'raw_spin_lock_irqsave' flags = _raw_spin_lock_irqsave(lock); \ ^~~~ include/linux/spinlock.h:323:67: note: passing argument to parameter 'lock' here static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) ^ mm/slub.c:2508:27: error: incompatible pointer types passing 'raw_spinlock_t *' (aka 'struct raw_spinlock *') to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Werror,-Wincompatible-pointer-types] spin_unlock_irqrestore(&n->list_lock, flags); ^~~~~~~~~~~~~ include/linux/spinlock.h:403:64: note: passing argument to parameter 'lock' here static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) ^ mm/slub.c:2515:26: error: incompatible pointer types passing 'raw_spinlock_t *' (aka 'struct raw_spinlock *') to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Werror,-Wincompatible-pointer-types] spin_unlock_irqrestore(&n->list_lock, flags); ^~~~~~~~~~~~~ include/linux/spinlock.h:403:64: note: passing argument to parameter 'lock' here static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) ^ mm/slub.c:2523:26: error: incompatible pointer types passing 'raw_spinlock_t *' (aka 'struct raw_spinlock *') to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Werror,-Wincompatible-pointer-types] spin_unlock_irqrestore(&n->list_lock, flags); ^~~~~~~~~~~~~ include/linux/spinlock.h:403:64: note: passing argument to parameter 'lock' here static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) ^ mm/slub.c:2847:20: error: incompatible pointer types passing 'raw_spinlock_t *' (aka 'struct raw_spinlock *') to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Werror,-Wincompatible-pointer-types] spin_lock_irqsave(&n->list_lock, flags); ^~~~~~~~~~~~~ include/linux/spinlock.h:380:39: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ ^~~~ include/linux/spinlock.h:243:34: note: expanded from macro 'raw_spin_lock_irqsave' flags = _raw_spin_lock_irqsave(lock); \ ^~~~ include/linux/spinlock.h:323:67: note: passing argument to parameter 'lock' here static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) ^ mm/slub.c:2926:25: error: incompatible pointer types passing 'raw_spinlock_t *' (aka 'struct raw_spinlock *') to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Werror,-Wincompatible-pointer-types] spin_unlock_irqrestore(&n->list_lock, flags); ^~~~~~~~~~~~~ include/linux/spinlock.h:403:64: note: passing argument to parameter 'lock' here static __always_inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags) ^ mm/slub.c:2946:20: error: incompatible pointer types passing 'raw_spinlock_t *' (aka 'struct raw_spinlock *') to parameter of type 'spinlock_t *' (aka 'struct spinlock *') [-Werror,-Wincompatible-pointer-types] spin_lock_irqsave(&n->list_lock, flags); vim +2124 mm/slub.c c7323a5ad07863 Vlastimil Babka 2022-08-23 2097 c7323a5ad07863 Vlastimil Babka 2022-08-23 2098 /* c7323a5ad07863 Vlastimil Babka 2022-08-23 2099 * Called only for kmem_cache_debug() caches to allocate from a freshly c7323a5ad07863 Vlastimil Babka 2022-08-23 2100 * allocated slab. Allocate a single object instead of whole freelist c7323a5ad07863 Vlastimil Babka 2022-08-23 2101 * and put the slab to the partial (or full) list. c7323a5ad07863 Vlastimil Babka 2022-08-23 2102 */ c7323a5ad07863 Vlastimil Babka 2022-08-23 2103 static void *alloc_single_from_new_slab(struct kmem_cache *s, 6edf2576a6cc46 Feng Tang 2022-09-13 2104 struct slab *slab, int orig_size) c7323a5ad07863 Vlastimil Babka 2022-08-23 2105 { c7323a5ad07863 Vlastimil Babka 2022-08-23 2106 int nid = slab_nid(slab); c7323a5ad07863 Vlastimil Babka 2022-08-23 2107 struct kmem_cache_node *n = get_node(s, nid); c7323a5ad07863 Vlastimil Babka 2022-08-23 2108 unsigned long flags; c7323a5ad07863 Vlastimil Babka 2022-08-23 2109 void *object; c7323a5ad07863 Vlastimil Babka 2022-08-23 2110 c7323a5ad07863 Vlastimil Babka 2022-08-23 2111 c7323a5ad07863 Vlastimil Babka 2022-08-23 2112 object = slab->freelist; c7323a5ad07863 Vlastimil Babka 2022-08-23 2113 slab->freelist = get_freepointer(s, object); c7323a5ad07863 Vlastimil Babka 2022-08-23 2114 slab->inuse = 1; c7323a5ad07863 Vlastimil Babka 2022-08-23 2115 6edf2576a6cc46 Feng Tang 2022-09-13 2116 if (!alloc_debug_processing(s, slab, object, orig_size)) c7323a5ad07863 Vlastimil Babka 2022-08-23 2117 /* c7323a5ad07863 Vlastimil Babka 2022-08-23 2118 * It's not really expected that this would fail on a c7323a5ad07863 Vlastimil Babka 2022-08-23 2119 * freshly allocated slab, but a concurrent memory c7323a5ad07863 Vlastimil Babka 2022-08-23 2120 * corruption in theory could cause that. c7323a5ad07863 Vlastimil Babka 2022-08-23 2121 */ c7323a5ad07863 Vlastimil Babka 2022-08-23 2122 return NULL; c7323a5ad07863 Vlastimil Babka 2022-08-23 2123 c7323a5ad07863 Vlastimil Babka 2022-08-23 @2124 spin_lock_irqsave(&n->list_lock, flags); c7323a5ad07863 Vlastimil Babka 2022-08-23 2125 c7323a5ad07863 Vlastimil Babka 2022-08-23 2126 if (slab->inuse == slab->objects) c7323a5ad07863 Vlastimil Babka 2022-08-23 2127 add_full(s, n, slab); c7323a5ad07863 Vlastimil Babka 2022-08-23 2128 else c7323a5ad07863 Vlastimil Babka 2022-08-23 2129 add_partial(n, slab, DEACTIVATE_TO_HEAD); c7323a5ad07863 Vlastimil Babka 2022-08-23 2130 c7323a5ad07863 Vlastimil Babka 2022-08-23 2131 inc_slabs_node(s, nid, slab->objects); c7323a5ad07863 Vlastimil Babka 2022-08-23 2132 spin_unlock_irqrestore(&n->list_lock, flags); c7323a5ad07863 Vlastimil Babka 2022-08-23 2133 c7323a5ad07863 Vlastimil Babka 2022-08-23 2134 return object; c7323a5ad07863 Vlastimil Babka 2022-08-23 2135 } c7323a5ad07863 Vlastimil Babka 2022-08-23 2136 -- 0-DAY CI Kernel Test Service https://01.org/lkp