linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kernel test robot <lkp@intel.com>,
	Feng Tang <feng.tang@linux.alibaba.com>,
	llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [linux-next:master 9966/13055] kernel/watchdog.c:74:22: warning: unused variable 'hardlockup_si_mask'
Date: Thu, 4 Dec 2025 14:38:42 +0100	[thread overview]
Message-ID: <aTGO4iLrQnd4l6fO@pathway.suse.cz> (raw)
In-Reply-To: <20251203144453.be34d189c5e6668ce2da06b3@linux-foundation.org>

On Wed 2025-12-03 14:44:53, Andrew Morton wrote:
> On Wed, 3 Dec 2025 09:05:30 +0800 kernel test robot <lkp@intel.com> 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'm testing the appended patch but it needs checking please.
> 
> The comment for hardlockup_si_mask says
> 
>  * bitmask 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.
> 
> but the variable depends on "COUNTS_HRTIMER".  The comment doesn't
> mention hrtimers and I don't see why it should.  Not sure what's going
> on here.

Good point! It took me some time to understand it.

So, powerpc implements its own watchog, see arch/powerpc/kernel/watchdog.c.
The watchdog is supported only by some powerpc platforms, see the
   following line in arch/powerpc/Kconfig:

	select HAVE_HARDLOCKUP_DETECTOR_ARCH	if PPC_BOOK3S_64 && SMP

As a result, the test system could have the following in the config,
see https://download.01.org/0day-ci/archive/20251203/202512030920.NFKtekA7-lkp@intel.com/config

	CONFIG_HARDLOCKUP_DETECTOR=y
	# CONFIG_HARDLOCKUP_DETECTOR_PERF is not set
	# CONFIG_HARDLOCKUP_DETECTOR_BUDDY is not set
	CONFIG_HARDLOCKUP_DETECTOR_ARCH=y

And "COUNTS_HRTIMER" is not defined.


> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: kernel/watchdog.c: fix unused var warning
> Date: Wed Dec  3 02:34:40 PM PST 2025
> 
> >> kernel/watchdog.c:74:22: warning: unused variable 'hardlockup_si_mask' [-Wunused-variable]
>       74 | static unsigned long hardlockup_si_mask;
>          |                      ^~~~~~~~~~~~~~~~~~
>    1 warning generated.
> 
> Fixes: a9af76a78760 ("watchdog: add sys_info sysctls to dump sys info on system lockup")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202512030920.NFKtekA7-lkp@intel.com/
> Link: https://lkml.kernel.org/r/202512030920.NFKtekA7-lkp@intel.com
> Cc: Feng Tang <feng.tang@linux.alibaba.com>
> Cc: Petr Mladek <pmladek@suse.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  kernel/watchdog.c |   16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> --- a/kernel/watchdog.c~kernel-watchdogc-fix-unused-var-warning
> +++ a/kernel/watchdog.c
> @@ -66,13 +66,6 @@ int __read_mostly sysctl_hardlockup_all_
>  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;
> @@ -135,6 +128,13 @@ __setup("nmi_watchdog=", hardlockup_pani
>  
>  #if defined(CONFIG_HARDLOCKUP_DETECTOR_COUNTS_HRTIMER)
>  
> +/*
> + * bitmask 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;
> +
>  static DEFINE_PER_CPU(atomic_t, hrtimer_interrupts);
>  static DEFINE_PER_CPU(int, hrtimer_interrupts_saved);
>  static DEFINE_PER_CPU(bool, watchdog_hardlockup_warned);
> @@ -1250,6 +1250,7 @@ static const struct ctl_table watchdog_s
>  		.extra1		= SYSCTL_ZERO,
>  		.extra2		= SYSCTL_ONE,
>  	},
> +#if defined(CONFIG_HARDLOCKUP_DETECTOR_COUNTS_HRTIMER)
>  	{
>  		.procname	= "hardlockup_sys_info",
>  		.data		= &hardlockup_si_mask,
> @@ -1257,6 +1258,7 @@ static const struct ctl_table watchdog_s
>  		.mode		= 0644,
>  		.proc_handler	= sysctl_sys_info_handler,
>  	},
> +#endif
>  #ifdef CONFIG_SMP
>  	{
>  		.procname	= "hardlockup_all_cpu_backtrace",
> _

This patch makes some sense because the arch-specific watchdog does
not support the sys_info interface. And it is better than nothing.
definitely.

A better solution would be export the variable and handle it
in arch/powerpc/kernel/watchdog.c.

It seems that powerpc is the only architecture which could define
HAVE_HARDLOCKUP_DETECTOR_ARCH.

Feng, would you have time to look at it?

Best Regards,
Petr


  reply	other threads:[~2025-12-04 13:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-03  1:05 kernel test robot
2025-12-03 14:58 ` Feng Tang
2025-12-03 22:44 ` Andrew Morton
2025-12-04 13:38   ` Petr Mladek [this message]
2025-12-04 14:12     ` Feng Tang
2025-12-04 13:57   ` Feng Tang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aTGO4iLrQnd4l6fO@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=feng.tang@linux.alibaba.com \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox