From nobody Sat Feb 7 06:14:33 2026 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D57D23A1E82 for ; Wed, 31 Dec 2025 08:03:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767168202; cv=none; b=m2S66jmXfog36Mt8R0x+55I1oS+tbeFknv7Cb3kHN01oricPHESrHq8xKPxcxp2dbzPmZ+iv9GNtGrKqTy61uPvvpn9PArSkHOozuKD7udxh15Qs1D8SKKkE47+YFCZycc3TDCgh7bL2RD5gCPOb6Qa8PlKNI/cGZ3klCAspqDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767168202; c=relaxed/simple; bh=/4vYIC8ukqJtU1UcgdQLi25A0YEjl5DcVEXuRdrDcDs=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=EHayiIX540jhkBmHenseiAr81XlMF66YScj2sUIDpYjJOoxS+NPH/eJjGljY/GYp7V9k2bNQB8yZanmgbjBMUmMTiFrHtm8OOPCP8I43yjHzKOVgfm5Gw6dlf6V6b8QpvJc4v1luX1XsjJ+IKAkA9UHtoqZj94CKq53QZhpFTDs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=XD/m2wrh; arc=none smtp.client-ip=115.124.30.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="XD/m2wrh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1767168190; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=AbiVUPMvFY3DppG/lug31OI/3mUsor4zmCYfn7JK0CU=; b=XD/m2wrh8p3rR6wotIdmwYYjH8mvaatKi/dxBlP2oeVf6AZ5EFoj1NEbjLpZAu9LcQe83YrH7OHXNoGXE/+mZke4fqopjg9DK1TegsPEyp01F0UY2sJmsJQe7pr/n052RGiex7vAP7Gp/2a2c5tpZ1EMznXZfQThKBVCMpLft94= Received: from localhost(mailfrom:feng.tang@linux.alibaba.com fp:SMTPD_---0Ww0Jzj1_1767168189 cluster:ay36) by smtp.aliyun-inc.com; Wed, 31 Dec 2025 16:03:09 +0800 From: Feng Tang To: Madhavan Srinivasan , Michael Ellerman , Andrew Morton , Petr Mladek , Nicholas Piggin , chleroy@kernel.org, lkp@intel.com Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Feng Tang Subject: [PATCH] powerpc/watchdog: add support for hardlockup_sys_info sysctl Date: Wed, 31 Dec 2025 16:03:09 +0800 Message-Id: <20251231080309.39642-1-feng.tang@linux.alibaba.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit a9af76a78760 ("watchdog: add sys_info sysctls to dump sys info on system lockup") adds 'hardlock_sys_info' systcl knob for general kernel watchdog to control what kinds of system debug info to be dumped on hardlockup. Add similar support in powerpc watchdog code to make the sysctl knob more general, which also fixes a compiling warning in general watchdog code reported by 0day bot. Fixes: a9af76a78760 ("watchdog: add sys_info sysctls to dump sys info on sy= stem lockup") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202512030920.NFKtekA7-lkp@int= el.com/ Suggested-by: Petr Mladek Signed-off-by: Feng Tang Reviewed-by: Petr Mladek --- Hi All, I failed to run it on a QEMU based CONFIG_PPC_BOOK3S_64 platform, though I setup the basic QEMU ppc64 env. So any test would be much appreciated! Andrew, With this patch, the fix c1c61241465d2 ("kernel/watchdog.c: fix unused var = warning) in -mm tree's 'mm-nonmm-unstable' branch could be dropped. Thanks, Feng arch/powerpc/kernel/watchdog.c | 15 ++++++++++----- include/linux/nmi.h | 1 + kernel/watchdog.c | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c index 2429cb1c7baa..764001deb060 100644 --- a/arch/powerpc/kernel/watchdog.c +++ b/arch/powerpc/kernel/watchdog.c @@ -26,6 +26,7 @@ #include #include #include +#include =20 #include #include @@ -235,7 +236,11 @@ static void watchdog_smp_panic(int cpu) pr_emerg("CPU %d TB:%lld, last SMP heartbeat TB:%lld (%lldms ago)\n", cpu, tb, last_reset, tb_to_ns(tb - last_reset) / 1000000); =20 - if (!sysctl_hardlockup_all_cpu_backtrace) { + if (sysctl_hardlockup_all_cpu_backtrace || + (hardlockup_si_mask & SYS_INFO_ALL_BT)) { + trigger_allbutcpu_cpu_backtrace(cpu); + cpumask_clear(&wd_smp_cpus_ipi); + } else { /* * Try to trigger the stuck CPUs, unless we are going to * get a backtrace on all of them anyway. @@ -244,11 +249,9 @@ static void watchdog_smp_panic(int cpu) smp_send_nmi_ipi(c, wd_lockup_ipi, 1000000); __cpumask_clear_cpu(c, &wd_smp_cpus_ipi); } - } else { - trigger_allbutcpu_cpu_backtrace(cpu); - cpumask_clear(&wd_smp_cpus_ipi); } =20 + sys_info(hardlockup_si_mask & ~SYS_INFO_ALL_BT); if (hardlockup_panic) nmi_panic(NULL, "Hard LOCKUP"); =20 @@ -415,9 +418,11 @@ DEFINE_INTERRUPT_HANDLER_NMI(soft_nmi_interrupt) =20 xchg(&__wd_nmi_output, 1); // see wd_lockup_ipi =20 - if (sysctl_hardlockup_all_cpu_backtrace) + if (sysctl_hardlockup_all_cpu_backtrace || + (hardlockup_si_mask & SYS_INFO_ALL_BT)) trigger_allbutcpu_cpu_backtrace(cpu); =20 + sys_info(hardlockup_si_mask & ~SYS_INFO_ALL_BT); if (hardlockup_panic) nmi_panic(regs, "Hard LOCKUP"); =20 diff --git a/include/linux/nmi.h b/include/linux/nmi.h index cf3c6ab408aa..207156f2143c 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -83,6 +83,7 @@ static inline void reset_hung_task_detector(void) { } #if defined(CONFIG_HARDLOCKUP_DETECTOR) extern void hardlockup_detector_disable(void); extern unsigned int hardlockup_panic; +extern unsigned long hardlockup_si_mask; #else static inline void hardlockup_detector_disable(void) {} #endif diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 0685e3a8aa0a..366122f4a0f8 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -71,7 +71,7 @@ unsigned int __read_mostly hardlockup_panic =3D * 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; +unsigned long hardlockup_si_mask; =20 #ifdef CONFIG_SYSFS =20 --=20 2.25.1