Re: [linux-next:master 9966/13055] kernel/watchdog.c:74:22: warning: unused variable 'hardlockup_si_mask'

Feng Tang
2025-12-03T14:59:05Z

Hi,

Thanks for the reporting!

On Wed, Dec 03, 2025 at 09:05:30AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head: 47b7b5e32bb7264b51b89186043e1ada4090b558
> commit: a9af76a78760717361cccc884dc649e30db61c8b [9966/13055] watchdog: add sys_info sysctls to dump sys info on system lockup
> config: powerpc64-randconfig-002-20251203 (https://download.01.org/0day-ci/archive/20251203/202512030920.NFKtekA7-lkp@intel.com/config)
> compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 734a912d0f025559fcf76bde9aaaeb0383c1625a)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251203/202512030920.NFKtekA7-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202512030920.NFKtekA7-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> kernel/watchdog.c:74:22: warning: unused variable 'hardlockup_si_mask' [-Wunused-variable]
> 74 | static unsigned long hardlockup_si_mask;
> | ^~~~~~~~~~~~~~~~~~
> 1 warning generated.

I can't reproduce it right now as I'm on travel and only have ARM server
to use. (The reproducer need a powerpc64 machine, or have a x86 machine
to use your reproducer script).

Could you help to test the below patch? thank!

- Feng

---
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 1f59b950c475..5e5ac82a01f3 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -66,13 +66,6 @@ int __read_mostly sysctl_hardlockup_all_cpu_backtrace;
unsigned int __read_mostly hardlockup_panic =
IS_ENABLED(CONFIG_BOOTPARAM_HARDLOCKUP_PANIC);

-/*
- * bitmasks to control what kinds of system info to be printed when
- * hard lockup is detected, it could be task, memory, lock etc.
- * Refer include/linux/sys_info.h for detailed bit definition.
- */
-static unsigned long hardlockup_si_mask;
-
#ifdef CONFIG_SYSFS

static unsigned int hardlockup_count;
@@ -141,6 +134,13 @@ static DEFINE_PER_CPU(bool, watchdog_hardlockup_warned);
static DEFINE_PER_CPU(bool, watchdog_hardlockup_touched);
static unsigned long hard_lockup_nmi_warn;

+/*
+ * bitmasks to control what kinds of system info to be printed when
+ * hard lockup is detected, it could be task, memory, lock etc.
+ * Refer include/linux/sys_info.h for detailed bit definition.
+ */
+static unsigned long hardlockup_si_mask;
+
notrace void arch_touch_nmi_watchdog(void)
{
/*
@@ -1250,6 +1250,7 @@ static const struct ctl_table watchdog_sysctls[] = {
.extra1 = SYSCTL_ZERO,
.extra2 = SYSCTL_ONE,
},
+#ifdef CONFIG_HARDLOCKUP_DETECTOR_COUNTS_HRTIMER
{
.procname = "hardlockup_sys_info",
.data = &hardlockup_si_mask,
@@ -1257,6 +1258,7 @@ static const struct ctl_table watchdog_sysctls[] = {
.mode = 0644,
.proc_handler = sysctl_sys_info_handler,
},
+#endif
#ifdef CONFIG_SMP
{
.procname = "hardlockup_all_cpu_backtrace",