[tip:WIP.core/stacktrace 4/32] kernel/stacktrace.c:99:1: error: redefinition of 'save_stack_trace_tsk_reliable'

From: kbuild test robot
Date: Tue Apr 16 2019 - 06:15:50 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.core/stacktrace
head: 9fe290aca53f59fd24187841dd4a8ff41ade91bd
commit: 714f46ba649b163e80d3dd89e83b92f4ba5ac6af [4/32] stacktrace: Provide helpers for common stack trace operations
config: sparc64-defconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 714f46ba649b163e80d3dd89e83b92f4ba5ac6af
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=sparc64

All errors (new ones prefixed by >>):

In file included from include/linux/page_ext.h:6:0,
from include/linux/mm.h:24,
from include/linux/kallsyms.h:12,
from kernel/stacktrace.c:11:
include/linux/stacktrace.h:62:19: error: static declaration of 'save_stack_trace_tsk_reliable' follows non-static declaration
static inline int save_stack_trace_tsk_reliable(struct task_struct *tsk,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/stacktrace.h:39:12: note: previous declaration of 'save_stack_trace_tsk_reliable' was here
extern int save_stack_trace_tsk_reliable(struct task_struct *tsk,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel/stacktrace.c:99:1: error: redefinition of 'save_stack_trace_tsk_reliable'
save_stack_trace_tsk_reliable(struct task_struct *tsk,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/page_ext.h:6:0,
from include/linux/mm.h:24,
from include/linux/kallsyms.h:12,
from kernel/stacktrace.c:11:
include/linux/stacktrace.h:62:19: note: previous definition of 'save_stack_trace_tsk_reliable' was here
static inline int save_stack_trace_tsk_reliable(struct task_struct *tsk,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/save_stack_trace_tsk_reliable +99 kernel/stacktrace.c

8637c0990 Ingo Molnar 2006-07-03 @11 #include <linux/kallsyms.h>
8637c0990 Ingo Molnar 2006-07-03 12 #include <linux/stacktrace.h>
8637c0990 Ingo Molnar 2006-07-03 13
714f46ba6 Thomas Gleixner 2019-04-09 14 /**
714f46ba6 Thomas Gleixner 2019-04-09 15 * stack_trace_print - Print the entries in the stack trace
714f46ba6 Thomas Gleixner 2019-04-09 16 * @entries: Pointer to storage array
714f46ba6 Thomas Gleixner 2019-04-09 17 * @nr_entries: Number of entries in the storage array
714f46ba6 Thomas Gleixner 2019-04-09 18 * @spaces: Number of leading spaces to print
714f46ba6 Thomas Gleixner 2019-04-09 19 */
714f46ba6 Thomas Gleixner 2019-04-09 20 void stack_trace_print(unsigned long *entries, unsigned int nr_entries,
714f46ba6 Thomas Gleixner 2019-04-09 21 int spaces)
8637c0990 Ingo Molnar 2006-07-03 22 {
714f46ba6 Thomas Gleixner 2019-04-09 23 unsigned int i;
8637c0990 Ingo Molnar 2006-07-03 24
714f46ba6 Thomas Gleixner 2019-04-09 25 if (WARN_ON(!entries))
bfeeeeb99 Johannes Berg 2008-05-12 26 return;
bfeeeeb99 Johannes Berg 2008-05-12 27
714f46ba6 Thomas Gleixner 2019-04-09 28 for (i = 0; i < nr_entries; i++)
714f46ba6 Thomas Gleixner 2019-04-09 29 printk("%*c%pS\n", 1 + spaces, ' ', (void *)entries[i]);
714f46ba6 Thomas Gleixner 2019-04-09 30 }
714f46ba6 Thomas Gleixner 2019-04-09 31 EXPORT_SYMBOL_GPL(stack_trace_print);
714f46ba6 Thomas Gleixner 2019-04-09 32
714f46ba6 Thomas Gleixner 2019-04-09 33 void print_stack_trace(struct stack_trace *trace, int spaces)
714f46ba6 Thomas Gleixner 2019-04-09 34 {
714f46ba6 Thomas Gleixner 2019-04-09 35 stack_trace_print(trace->entries, trace->nr_entries, spaces);
8637c0990 Ingo Molnar 2006-07-03 36 }
8594698eb Ingo Molnar 2008-06-27 37 EXPORT_SYMBOL_GPL(print_stack_trace);
8637c0990 Ingo Molnar 2006-07-03 38
714f46ba6 Thomas Gleixner 2019-04-09 39 /**
714f46ba6 Thomas Gleixner 2019-04-09 40 * stack_trace_snprint - Print the entries in the stack trace into a buffer
714f46ba6 Thomas Gleixner 2019-04-09 41 * @buf: Pointer to the print buffer
714f46ba6 Thomas Gleixner 2019-04-09 42 * @size: Size of the print buffer
714f46ba6 Thomas Gleixner 2019-04-09 43 * @entries: Pointer to storage array
714f46ba6 Thomas Gleixner 2019-04-09 44 * @nr_entries: Number of entries in the storage array
714f46ba6 Thomas Gleixner 2019-04-09 45 * @spaces: Number of leading spaces to print
714f46ba6 Thomas Gleixner 2019-04-09 46 */
714f46ba6 Thomas Gleixner 2019-04-09 47 int stack_trace_snprint(char *buf, size_t size, unsigned long *entries,
714f46ba6 Thomas Gleixner 2019-04-09 48 unsigned int nr_entries, int spaces)
9a92a6ce6 Joonsoo Kim 2014-12-12 49 {
714f46ba6 Thomas Gleixner 2019-04-09 50 unsigned int generated, i, total = 0;
9a92a6ce6 Joonsoo Kim 2014-12-12 51
714f46ba6 Thomas Gleixner 2019-04-09 52 if (WARN_ON(!entries))
9a92a6ce6 Joonsoo Kim 2014-12-12 53 return 0;
9a92a6ce6 Joonsoo Kim 2014-12-12 54
714f46ba6 Thomas Gleixner 2019-04-09 55 for (i = 0; i < nr_entries; i++) {
bfeda41d0 Omar Sandoval 2017-02-07 56 generated = snprintf(buf, size, "%*c%pS\n", 1 + spaces, ' ',
714f46ba6 Thomas Gleixner 2019-04-09 57 (void *)entries[i]);
9a92a6ce6 Joonsoo Kim 2014-12-12 58
9a92a6ce6 Joonsoo Kim 2014-12-12 59 total += generated;
9a92a6ce6 Joonsoo Kim 2014-12-12 60 if (generated >= size) {
9a92a6ce6 Joonsoo Kim 2014-12-12 61 buf += size;
9a92a6ce6 Joonsoo Kim 2014-12-12 62 size = 0;
9a92a6ce6 Joonsoo Kim 2014-12-12 63 } else {
9a92a6ce6 Joonsoo Kim 2014-12-12 64 buf += generated;
9a92a6ce6 Joonsoo Kim 2014-12-12 65 size -= generated;
9a92a6ce6 Joonsoo Kim 2014-12-12 66 }
9a92a6ce6 Joonsoo Kim 2014-12-12 67 }
9a92a6ce6 Joonsoo Kim 2014-12-12 68
9a92a6ce6 Joonsoo Kim 2014-12-12 69 return total;
9a92a6ce6 Joonsoo Kim 2014-12-12 70 }
714f46ba6 Thomas Gleixner 2019-04-09 71 EXPORT_SYMBOL_GPL(stack_trace_snprint);
714f46ba6 Thomas Gleixner 2019-04-09 72
714f46ba6 Thomas Gleixner 2019-04-09 73 int snprint_stack_trace(char *buf, size_t size,
714f46ba6 Thomas Gleixner 2019-04-09 74 struct stack_trace *trace, int spaces)
714f46ba6 Thomas Gleixner 2019-04-09 75 {
714f46ba6 Thomas Gleixner 2019-04-09 76 return stack_trace_snprint(buf, size, trace->entries,
714f46ba6 Thomas Gleixner 2019-04-09 77 trace->nr_entries, spaces);
714f46ba6 Thomas Gleixner 2019-04-09 78 }
9a92a6ce6 Joonsoo Kim 2014-12-12 79 EXPORT_SYMBOL_GPL(snprint_stack_trace);
9a92a6ce6 Joonsoo Kim 2014-12-12 80
9212ddb5e Ingo Molnar 2008-12-25 81 /*
af085d908 Josh Poimboeuf 2017-02-13 82 * Architectures that do not implement save_stack_trace_*()
af085d908 Josh Poimboeuf 2017-02-13 83 * get these weak aliases and once-per-bootup warnings
c624d33f6 Masami Hiramatsu 2011-06-08 84 * (whenever this facility is utilized - for example by procfs):
9212ddb5e Ingo Molnar 2008-12-25 85 */
9212ddb5e Ingo Molnar 2008-12-25 86 __weak void
9212ddb5e Ingo Molnar 2008-12-25 87 save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
9212ddb5e Ingo Molnar 2008-12-25 88 {
9212ddb5e Ingo Molnar 2008-12-25 89 WARN_ONCE(1, KERN_INFO "save_stack_trace_tsk() not implemented yet.\n");
9212ddb5e Ingo Molnar 2008-12-25 90 }
c624d33f6 Masami Hiramatsu 2011-06-08 91
c624d33f6 Masami Hiramatsu 2011-06-08 92 __weak void
c624d33f6 Masami Hiramatsu 2011-06-08 93 save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace)
c624d33f6 Masami Hiramatsu 2011-06-08 94 {
c624d33f6 Masami Hiramatsu 2011-06-08 95 WARN_ONCE(1, KERN_INFO "save_stack_trace_regs() not implemented yet.\n");
c624d33f6 Masami Hiramatsu 2011-06-08 96 }
af085d908 Josh Poimboeuf 2017-02-13 97
af085d908 Josh Poimboeuf 2017-02-13 98 __weak int
af085d908 Josh Poimboeuf 2017-02-13 @99 save_stack_trace_tsk_reliable(struct task_struct *tsk,
af085d908 Josh Poimboeuf 2017-02-13 100 struct stack_trace *trace)
af085d908 Josh Poimboeuf 2017-02-13 101 {
af085d908 Josh Poimboeuf 2017-02-13 102 WARN_ONCE(1, KERN_INFO "save_stack_tsk_reliable() not implemented yet.\n");
af085d908 Josh Poimboeuf 2017-02-13 103 return -ENOSYS;
af085d908 Josh Poimboeuf 2017-02-13 104 }
714f46ba6 Thomas Gleixner 2019-04-09 105

:::::: The code at line 99 was first introduced by commit
:::::: af085d9084b48530153f51e6cad19fd0b1a13ed7 stacktrace/x86: add function for detecting reliable stack traces

:::::: TO: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
:::::: CC: Jiri Kosina <jkosina@xxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip