[mcgrof-next:20211117-sysctl-cleanups-all-set-04 3/36] kernel/hung_task.c:69:8: error: 'sysctl_hung_task_timeout_secs' redeclared as different kind of symbol

From: kernel test robot
Date: Thu Nov 18 2021 - 06:54:57 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20211117-sysctl-cleanups-all-set-04
head: 3559bb8939dd93c96215ab179d868c5fdc167335
commit: 02c747a7684bf887656b2d3c7ea2c9e4393ee2f5 [3/36] hung_task: Move hung_task sysctl interface to hung_task.c
config: microblaze-randconfig-r036-20211118 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 11.2.0
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://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/commit/?id=02c747a7684bf887656b2d3c7ea2c9e4393ee2f5
git remote add mcgrof-next https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20211117-sysctl-cleanups-all-set-04
git checkout 02c747a7684bf887656b2d3c7ea2c9e4393ee2f5
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=microblaze SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> kernel/hung_task.c:69:8: error: 'sysctl_hung_task_timeout_secs' redeclared as different kind of symbol
69 | enum { sysctl_hung_task_timeout_secs = 0 };
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/hung_task.c:45:29: note: previous definition of 'sysctl_hung_task_timeout_secs' with type 'long unsigned int'
45 | unsigned long __read_mostly sysctl_hung_task_timeout_secs = CONFIG_DEFAULT_HUNG_TASK_TIMEOUT;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/hung_task.c: In function 'check_hung_task':
>> kernel/hung_task.c:144:21: error: 'sysctl_hung_task_all_cpu_backtrace' undeclared (first use in this function); did you mean 'sysctl_oops_all_cpu_backtrace'?
144 | if (sysctl_hung_task_all_cpu_backtrace)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| sysctl_oops_all_cpu_backtrace
kernel/hung_task.c:144:21: note: each undeclared identifier is reported only once for each function it appears in
kernel/hung_task.c: At top level:
>> kernel/hung_task.c:329:35: error: lvalue required as unary '&' operand
329 | .data = &sysctl_hung_task_timeout_secs,
| ^


vim +/sysctl_hung_task_timeout_secs +69 kernel/hung_task.c

60
61 #ifdef CONFIG_SMP
62 /*
63 * Should we dump all CPUs backtraces in a hung task event?
64 * Defaults to 0, can be changed via sysctl.
65 */
66 unsigned int __read_mostly sysctl_hung_task_all_cpu_backtrace;
67 #else
68 /* Avoid need for ifdefs elsewhere in the code */
> 69 enum { sysctl_hung_task_timeout_secs = 0 };
70 #endif /* CONFIG_SMP */
71
72 /*
73 * Should we panic (and reboot, if panic_timeout= is set) when a
74 * hung task is detected:
75 */
76 unsigned int __read_mostly sysctl_hung_task_panic =
77 CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE;
78
79 static int
80 hung_task_panic(struct notifier_block *this, unsigned long event, void *ptr)
81 {
82 did_panic = 1;
83
84 return NOTIFY_DONE;
85 }
86
87 static struct notifier_block panic_block = {
88 .notifier_call = hung_task_panic,
89 };
90
91 static void check_hung_task(struct task_struct *t, unsigned long timeout)
92 {
93 unsigned long switch_count = t->nvcsw + t->nivcsw;
94
95 /*
96 * Ensure the task is not frozen.
97 * Also, skip vfork and any other user process that freezer should skip.
98 */
99 if (unlikely(t->flags & (PF_FROZEN | PF_FREEZER_SKIP)))
100 return;
101
102 /*
103 * When a freshly created task is scheduled once, changes its state to
104 * TASK_UNINTERRUPTIBLE without having ever been switched out once, it
105 * musn't be checked.
106 */
107 if (unlikely(!switch_count))
108 return;
109
110 if (switch_count != t->last_switch_count) {
111 t->last_switch_count = switch_count;
112 t->last_switch_time = jiffies;
113 return;
114 }
115 if (time_is_after_jiffies(t->last_switch_time + timeout * HZ))
116 return;
117
118 trace_sched_process_hang(t);
119
120 if (sysctl_hung_task_panic) {
121 console_verbose();
122 hung_task_show_lock = true;
123 hung_task_call_panic = true;
124 }
125
126 /*
127 * Ok, the task did not get scheduled for more than 2 minutes,
128 * complain:
129 */
130 if (sysctl_hung_task_warnings) {
131 if (sysctl_hung_task_warnings > 0)
132 sysctl_hung_task_warnings--;
133 pr_err("INFO: task %s:%d blocked for more than %ld seconds.\n",
134 t->comm, t->pid, (jiffies - t->last_switch_time) / HZ);
135 pr_err(" %s %s %.*s\n",
136 print_tainted(), init_utsname()->release,
137 (int)strcspn(init_utsname()->version, " "),
138 init_utsname()->version);
139 pr_err("\"echo 0 > /proc/sys/kernel/hung_task_timeout_secs\""
140 " disables this message.\n");
141 sched_show_task(t);
142 hung_task_show_lock = true;
143
> 144 if (sysctl_hung_task_all_cpu_backtrace)
145 hung_task_show_all_bt = true;
146 }
147
148 touch_nmi_watchdog();
149 }
150

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip