[mcgrof-next:20211116-sysctl-cleanups-v4 3/35] kernel/hung_task.c:69:8: error: redefinition of 'sysctl_hung_task_timeout_secs'

From: kernel test robot
Date: Mon Nov 22 2021 - 18:40:17 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20211116-sysctl-cleanups-v4
head: 5347239461f25fc50aa761923245b9ec4a4aafec
commit: e854631643628749ab037f54ca9c26d69ffabb3e [3/35] hung_task: Move hung_task sysctl interface to hung_task.c
config: x86_64-randconfig-a003-20211116 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4c2cf3a314d9131b1b288e7c8ab0c75ac1b2be1d)
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=e854631643628749ab037f54ca9c26d69ffabb3e
git remote add mcgrof-next https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20211116-sysctl-cleanups-v4
git checkout e854631643628749ab037f54ca9c26d69ffabb3e
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 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: redefinition of 'sysctl_hung_task_timeout_secs'
enum { sysctl_hung_task_timeout_secs = 0 };
^
kernel/hung_task.c:45:29: note: previous definition is here
unsigned long __read_mostly sysctl_hung_task_timeout_secs = CONFIG_DEFAULT_HUNG_TASK_TIMEOUT;
^
>> kernel/hung_task.c:144:7: error: use of undeclared identifier 'sysctl_hung_task_all_cpu_backtrace'
if (sysctl_hung_task_all_cpu_backtrace)
^
2 errors generated.


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