Hi Oscar, kernel test robot noticed the following build errors: [auto build test ERROR on akpm-mm/mm-everything] [also build test ERROR on linus/master v6.4-rc2 next-20230516] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Oscar-Salvador/lib-stackdepot-Add-a-refcount-field-in-stack_record/20230517-022632 base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything patch link: https://lore.kernel.org/r/20230516182537.3139-3-osalvador%40suse.de patch subject: [PATCH v5 2/3] mm, page_owner: Add page_owner_stacks file to print out only stacks and their counte config: hexagon-randconfig-r041-20230515 compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project b0fb98227c90adf2536c9ad644a74d5e92961111) 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 # https://github.com/intel-lab-lkp/linux/commit/8e924bbbd702591f6d8502cfac0bda27e1f67e1b git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Oscar-Salvador/lib-stackdepot-Add-a-refcount-field-in-stack_record/20230517-022632 git checkout 8e924bbbd702591f6d8502cfac0bda27e1f67e1b # 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=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash kernel/trace/ lib/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot | Link: https://lore.kernel.org/oe-kbuild-all/202305170804.ZRfW9CRd-lkp@intel.com/ All error/warnings (new ones prefixed by >>): In file included from lib/buildid.c:7: In file included from include/linux/pagemap.h:8: In file included from include/linux/mm.h:22: In file included from include/linux/page_ext.h:7: >> include/linux/stackdepot.h:116:26: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] void *stack_start(struct seq_file *m, loff_t *ppos); ^ include/linux/stackdepot.h:117:25: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] void *stack_next(struct seq_file *m, void *v, loff_t *ppos); ^ include/linux/stackdepot.h:118:24: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] int stack_print(struct seq_file *m, void *v); ^ In file included from lib/buildid.c:7: In file included from include/linux/pagemap.h:11: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/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/hexagon/include/asm/io.h:334: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __raw_readb(PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) ^ In file included from lib/buildid.c:7: In file included from include/linux/pagemap.h:11: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/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/hexagon/include/asm/io.h:334: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) ^ In file included from lib/buildid.c:7: In file included from include/linux/pagemap.h:11: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/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/hexagon/include/asm/io.h:334: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writeb(value, PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ 9 warnings generated. -- In file included from lib/show_mem.c:8: In file included from include/linux/mm.h:22: In file included from include/linux/page_ext.h:7: >> include/linux/stackdepot.h:116:26: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] void *stack_start(struct seq_file *m, loff_t *ppos); ^ include/linux/stackdepot.h:117:25: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] void *stack_next(struct seq_file *m, void *v, loff_t *ppos); ^ include/linux/stackdepot.h:118:24: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] int stack_print(struct seq_file *m, void *v); ^ 3 warnings generated. -- In file included from lib/stackdepot.c:21: In file included from include/linux/mm.h:22: In file included from include/linux/page_ext.h:7: >> include/linux/stackdepot.h:116:26: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] void *stack_start(struct seq_file *m, loff_t *ppos); ^ include/linux/stackdepot.h:117:25: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] void *stack_next(struct seq_file *m, void *v, loff_t *ppos); ^ include/linux/stackdepot.h:118:24: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] int stack_print(struct seq_file *m, void *v); ^ In file included from lib/stackdepot.c:30: In file included from include/linux/memblock.h:13: In file included from arch/hexagon/include/asm/dma.h:9: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __raw_readb(PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) ^ In file included from lib/stackdepot.c:30: In file included from include/linux/memblock.h:13: In file included from arch/hexagon/include/asm/dma.h:9: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) ^ In file included from lib/stackdepot.c:30: In file included from include/linux/memblock.h:13: In file included from arch/hexagon/include/asm/dma.h:9: In file included from arch/hexagon/include/asm/io.h:334: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writeb(value, PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ >> lib/stackdepot.c:491:7: error: conflicting types for 'stack_start' void *stack_start(struct seq_file *m, loff_t *ppos) ^ include/linux/stackdepot.h:116:7: note: previous declaration is here void *stack_start(struct seq_file *m, loff_t *ppos); ^ >> lib/stackdepot.c:509:7: error: conflicting types for 'stack_next' void *stack_next(struct seq_file *m, void *v, loff_t *ppos) ^ include/linux/stackdepot.h:117:7: note: previous declaration is here void *stack_next(struct seq_file *m, void *v, loff_t *ppos); ^ >> lib/stackdepot.c:538:5: error: conflicting types for 'stack_print' int stack_print(struct seq_file *m, void *v) ^ include/linux/stackdepot.h:118:5: note: previous declaration is here int stack_print(struct seq_file *m, void *v); ^ 9 warnings and 3 errors generated. -- In file included from kernel/trace/trace_irqsoff.c:13: In file included from include/linux/kallsyms.h:13: In file included from include/linux/mm.h:22: In file included from include/linux/page_ext.h:7: >> include/linux/stackdepot.h:116:26: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] void *stack_start(struct seq_file *m, loff_t *ppos); ^ include/linux/stackdepot.h:117:25: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] void *stack_next(struct seq_file *m, void *v, loff_t *ppos); ^ include/linux/stackdepot.h:118:24: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] int stack_print(struct seq_file *m, void *v); ^ In file included from kernel/trace/trace_irqsoff.c:16: In file included from include/linux/ftrace.h:10: In file included from include/linux/trace_recursion.h:5: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/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/hexagon/include/asm/io.h:334: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __raw_readb(PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) ^ In file included from kernel/trace/trace_irqsoff.c:16: In file included from include/linux/ftrace.h:10: In file included from include/linux/trace_recursion.h:5: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/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/hexagon/include/asm/io.h:334: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) ^ In file included from kernel/trace/trace_irqsoff.c:16: In file included from include/linux/ftrace.h:10: In file included from include/linux/trace_recursion.h:5: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/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/hexagon/include/asm/io.h:334: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writeb(value, PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ kernel/trace/trace_irqsoff.c:68:19: warning: unused function 'irqsoff_display_graph' [-Wunused-function] static inline int irqsoff_display_graph(struct trace_array *tr, int set) ^ 10 warnings generated. -- In file included from kernel/trace/trace_branch.c:7: In file included from include/linux/kallsyms.h:13: In file included from include/linux/mm.h:22: In file included from include/linux/page_ext.h:7: >> include/linux/stackdepot.h:116:26: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] void *stack_start(struct seq_file *m, loff_t *ppos); ^ include/linux/stackdepot.h:117:25: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] void *stack_next(struct seq_file *m, void *v, loff_t *ppos); ^ include/linux/stackdepot.h:118:24: warning: declaration of 'struct seq_file' will not be visible outside of this function [-Wvisibility] int stack_print(struct seq_file *m, void *v); ^ In file included from kernel/trace/trace_branch.c:13: In file included from include/linux/ftrace.h:10: In file included from include/linux/trace_recursion.h:5: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/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/hexagon/include/asm/io.h:334: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __raw_readb(PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) ^ In file included from kernel/trace/trace_branch.c:13: In file included from include/linux/ftrace.h:10: In file included from include/linux/trace_recursion.h:5: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/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/hexagon/include/asm/io.h:334: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) ^ In file included from kernel/trace/trace_branch.c:13: In file included from include/linux/ftrace.h:10: In file included from include/linux/trace_recursion.h:5: In file included from include/linux/interrupt.h:11: In file included from include/linux/hardirq.h:11: In file included from ./arch/hexagon/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/hexagon/include/asm/io.h:334: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writeb(value, PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); ~~~~~~~~~~ ^ kernel/trace/trace_branch.c:205:6: warning: no previous prototype for function 'ftrace_likely_update' [-Wmissing-prototypes] void ftrace_likely_update(struct ftrace_likely_data *f, int val, ^ kernel/trace/trace_branch.c:205:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void ftrace_likely_update(struct ftrace_likely_data *f, int val, ^ static 10 warnings generated. vim +/stack_start +491 lib/stackdepot.c 489 490 #ifdef CONFIG_PAGE_OWNER > 491 void *stack_start(struct seq_file *m, loff_t *ppos) 492 { 493 unsigned long *table = m->private; 494 struct stack_record **stacks, *stack; 495 496 /* First time */ 497 if (*ppos == 0) 498 *table = 0; 499 500 if (*ppos == -1UL) 501 return NULL; 502 503 stacks = &stack_table[*table]; 504 stack = (struct stack_record *)stacks; 505 506 return stack; 507 } 508 > 509 void *stack_next(struct seq_file *m, void *v, loff_t *ppos) 510 { 511 unsigned long *table = m->private; 512 unsigned long nr_table = *table; 513 struct stack_record *next = NULL, *stack = v, **stacks; 514 unsigned long stack_table_entries = stack_hash_mask + 1; 515 516 if (!stack) { 517 new_table: 518 /* New table */ 519 nr_table++; 520 if (nr_table >= stack_table_entries) 521 goto out; 522 stacks = &stack_table[nr_table]; 523 stack = (struct stack_record *)stacks; 524 next = stack; 525 } else { 526 next = stack->next; 527 } 528 529 if (!next) 530 goto new_table; 531 532 out: 533 *table = nr_table; 534 *ppos = (nr_table >= stack_table_entries) ? -1UL : *ppos + 1; 535 return next; 536 } 537 > 538 int stack_print(struct seq_file *m, void *v) 539 { 540 char *buf; 541 int ret = 0; 542 struct stack_record *stack = v; 543 544 if (!stack->size || stack->size < 0 || 545 stack->size > PAGE_SIZE || stack->handle.valid != 1 || 546 refcount_read(&stack->count) < 1) 547 return 0; 548 549 buf = kzalloc(PAGE_SIZE, GFP_KERNEL); 550 ret += stack_trace_snprint(buf, PAGE_SIZE, stack->entries, stack->size, 0); 551 scnprintf(buf + ret, PAGE_SIZE - ret, "stack count: %d\n\n", 552 refcount_read(&stack->count)); 553 seq_printf(m, buf); 554 seq_puts(m, "\n\n"); 555 kfree(buf); 556 557 return 0; 558 } 559 #endif 560 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests