LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sourabh Jain <sourabhjain@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com, mpe@ellerman.id.au
Cc: npiggin@gmail.com, chleroy@kernel.org, ritesh.list@gmail.com,
	shivangu@linux.ibm.com, hbathini@linux.ibm.com,
	mahesh@linux.ibm.com, adityag@linux.ibm.com,
	venkat88@linux.ibm.com, sourabhjain@linux.ibm.com,
	stable@vger.kernel.org, Mahesh Kumar G <mahe657@linux.ibm.com>
Subject: [PATCH 1/1] powerpc/crash: stop watchdogs before booting kdump kernel
Date: Wed,  3 Jun 2026 12:32:17 +0530	[thread overview]
Message-ID: <20260603070217.483696-2-sourabhjain@linux.ibm.com> (raw)
In-Reply-To: <20260603070217.483696-1-sourabhjain@linux.ibm.com>

On pseries LPAR systems, watchdog timers configured from userspace
can remain active after a kernel panic. During panic triggered crash
dump capture, the crashing kernel jumps directly to the kdump kernel
without shutting down userspace services. As a result, active
watchdogs are not stopped before entering the kdump kernel.

If dump capture takes longer than the watchdog timeout, PHYP resets
the LPAR before dump collection completes, resulting in dump capture
failure.

Fix this by issuing the H_WATCHDOG hcall on the crash shutdown path
to stop all active watchdogs before booting the kdump kernel.

Fixes: 69472ffa6575 ("watchdog/pseries-wdt: initial support for H_WATCHDOG-based watchdog timers")
Reported-by: Mahesh Kumar G <mahe657@linux.ibm.com>
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
---
 arch/powerpc/kexec/crash.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/arch/powerpc/kexec/crash.c b/arch/powerpc/kexec/crash.c
index e6539f213b3d..5651523e3a70 100644
--- a/arch/powerpc/kexec/crash.c
+++ b/arch/powerpc/kexec/crash.c
@@ -28,6 +28,7 @@
 #include <asm/interrupt.h>
 #include <asm/kexec_ranges.h>
 #include <asm/crashdump-ppc64.h>
+#include <asm/hvcall.h>
 
 /*
  * The primary CPU waits a while for all secondary CPUs to enter. This is to
@@ -352,6 +353,28 @@ int crash_shutdown_unregister(crash_shutdown_t handler)
 }
 EXPORT_SYMBOL(crash_shutdown_unregister);
 
+/**
+ * stop_watchdogs - Stop active watchdogs before entering kdump kernel
+ * On pseries LPAR systems, watchdogs configured from userspace remain
+ * active after a kernel panic because userspace services are not shut
+ * down on the kdump crash path. If a watchdog expires while the kdump
+ * kernel is collecting the dump, PHYP resets the LPAR and dump capture
+ * fails
+ *
+ *   0x200UL : watchdog stop operation
+ *   -1      : watchdog number, disable all watchdogs
+ */
+static void stop_watchdogs(void)
+{
+	if (firmware_has_feature(FW_FEATURE_LPAR)) {
+		int rc;
+
+		rc = plpar_hcall_norets_notrace(H_WATCHDOG, 0x200UL, -1);
+		if (rc != H_SUCCESS && rc != H_NOOP)
+			pr_warn("crash: failed to stop watchdogs\n");
+	}
+}
+
 void default_machine_crash_shutdown(struct pt_regs *regs)
 {
 	volatile unsigned int i;
@@ -360,6 +383,8 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
 	if (TRAP(regs) == INTERRUPT_SYSTEM_RESET)
 		is_via_system_reset = 1;
 
+	stop_watchdogs();
+
 	if (IS_ENABLED(CONFIG_SMP))
 		crash_smp_send_stop();
 	else
-- 
2.52.0



      reply	other threads:[~2026-06-03  7:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03  7:02 [PATCH 0/1] powerpc/crash: protect kdump from active watchdogs Sourabh Jain
2026-06-03  7:02 ` Sourabh Jain [this message]

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=20260603070217.483696-2-sourabhjain@linux.ibm.com \
    --to=sourabhjain@linux.ibm.com \
    --cc=adityag@linux.ibm.com \
    --cc=chleroy@kernel.org \
    --cc=hbathini@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mahe657@linux.ibm.com \
    --cc=mahesh@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=ritesh.list@gmail.com \
    --cc=shivangu@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    --cc=venkat88@linux.ibm.com \
    /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