Skip to contentSkip to conversation

Fix kdump when using hpwdt

PATCH In review Bernhard Walle 2 participants 3 messages Nov 23, 2008 – Nov 25, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix kdump when using hpwdt

When the "hpwdt" module is loaded (even if the /dev/watchdog device is not opened), then kdump does not work. The panic kernel either does not start at all or crash in various places.

The problem is that hpwdt_pretimeout is registered with register_die_notifier() with the highest possible priority. Because it returns NOTIFY_STOP, the crash_nmi_callback which is also registered with register_die_notifier() is never executed. This causes the shutdown of other CPUs to fail.

Reverting the order is no option: The crash_nmi_callback executes HLT and so never returns normally. Because of that, it must be executed as last notifier, which currently is done.

So, that patch returns NOTIFY_OK to keep the crash_nmi_callback executed.

Cc Wim Van Sebroeck <[email protected]>
Cc Thomas Mingarelli <[email protected]>
Cc Vivek Goyal <[email protected]>
---
 drivers/watchdog/hpwdt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/watchdog/hpwdt.c +1 -1
index a3765e0..21fe202 100644
@@ -482,7 +482,7 @@ static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason,
 			"Management Log for details.\n");
 	}
 
-	return NOTIFY_STOP;
+	return NOTIFY_OK;
 }
 
 /*
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 9 lines · Bernhard Walle

When the "hpwdt" module is loaded (even if the /dev/watchdog device is not opened), then kdump does not work. The panic kernel either does not start at all or crash in various places.

The problem is that hpwdt_pretimeout is registered with register_die_notifier() with the highest possible priority. Because it returns NOTIFY_STOP, the crash_nmi_callback which is also registered with register_die_notifier() is never executed. This causes the shutdown of other CPUs to fail.

Quoted 5 lines

Reverting the order is no option: The crash_nmi_callback executes HLT and so never returns normally. Because of that, it must be executed as last notifier, which currently is done.

So, that patch returns NOTIFY_OK to keep the crash_nmi_callback executed.

Hi Bernhard,

Why does this handler need to run after a crash? IOW, even if kdump NMI handler halts the cpu, and this handler never gets a chance to run, is that an issue.

I am getting back to previous discussion of dropping the priority of this hpwdt. You mentioned that dropping priority will not work as kdump handler hlts the cpus. But my point is that kdump handler is registered dynamically only after a system crash. Does hpwdt need to run then?

Above patch as such should fix the kdump issue (assuming the handler of this driver will always return back), but I don't understand why does it need to run after a crash?

Thanks
Vivek

Quoted 25 lines
Cc Wim Van Sebroeck <[email protected]>
Cc Thomas Mingarelli <[email protected]>
Cc Vivek Goyal <[email protected]>
---
 drivers/watchdog/hpwdt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/watchdog/hpwdt.c +1 -1
index a3765e0..21fe202 100644
@@ -482,7 +482,7 @@ static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason,
 			"Management Log for details.\n");
 	}
 
-	return NOTIFY_STOP;
+	return NOTIFY_OK;
 }
 
 /*
Signature · 1 line
1.6.0.2
#2 lore raw
Quoted 15 lines · Vivek Goyal
Quoted 13 lines · Bernhard Walle

When the "hpwdt" module is loaded (even if the /dev/watchdog device is not opened), then kdump does not work. The panic kernel either does not start at all or crash in various places.

The problem is that hpwdt_pretimeout is registered with register_die_notifier() with the highest possible priority. Because it returns NOTIFY_STOP, the crash_nmi_callback which is also registered with register_die_notifier() is never executed. This causes the shutdown of other CPUs to fail.

Reverting the order is no option: The crash_nmi_callback executes HLT and so never returns normally. Because of that, it must be executed as last notifier, which currently is done.

Quoted 7 lines
Quoted 1 line

So, that patch returns NOTIFY_OK to keep the crash_nmi_callback executed.

Hi Bernhard,

Why does this handler need to run after a crash? IOW, even if kdump NMI handler halts the cpu, and this handler never gets a chance to run, is that an issue.

Hi Vivek,

Because otherwise the crashkernel receives NMIs and crashes ... it just doesn't work. The watchdog guys should be able to provide technical details here.

Regards,
Bernhard