watchdog: pretimeout: Allow building dump governor as module
Subsystems (2)
cover watchdog: pretimeout: Allow building dump governor as module
All other watchdog pretimeout governors (noop, panic) can be built as loadable modules. However the "dump" pretimeout governor is restricted to built-in code because it calls trigger_all_cpu_backtrace(), which relies on arch_trigger_cpumask_backtrace(), an arch specific helper that is not exported to loadable modules.
This 2-patch series allows building the dump governor as a module (=m):
1) Export cpumask_backtrace() in lib/nmi_backtrace.c.
2) Convert CONFIG_WATCHDOG_PRETIMEOUT_GOV_DUMP from bool to tristate.
---
Mayank Rungta (2):
nmi: Export CPU backtrace APIs for loadable modules
watchdog: pretimeout: Convert dump pretimeout governor to tristate
drivers/watchdog/Kconfig | 4 ++-- include/linux/nmi.h | 10 ++++++---- lib/nmi_backtrace.c | 7 +++++++ 3 files changed, 15 insertions(+), 6 deletions(-)
---
base-commit: 3fe08b9796f36ef437ab9328e7dd1e5ff2d66603
change-id: 20260728-export-cpu-backtrace-apis-136d3b819377
Best regards,
Signature · 1 line
Mayank Rungta <[email protected]>
PATCH 1/2 nmi: Export CPU backtrace APIs for loadable modules
Currently, CPU backtrace functions cannot be called from loadable modules because the underlying helper arch_trigger_cpumask_backtrace() is not exported.
Instead of exporting arch_trigger_cpumask_backtrace() individually across every supported architecture, introduce and export a common helper, cpumask_backtrace(), in lib/nmi_backtrace.c. Update the four inline CPU backtrace macros in include/linux/nmi.h to route through this centralized helper.
--- include/linux/nmi.h | 10 ++++++---- lib/nmi_backtrace.c | 7 +++++++ 2 files changed, 13 insertions(+), 4 deletions(-)
include/linux/nmi.h +6 -4
@@ -157,27 +157,29 @@ static inline void touch_nmi_watchdog(void)* to allow calling code to fall back to some other mechanism: */ #ifdef arch_trigger_cpumask_backtrace +void cpumask_backtrace (const cpumask_t *mask,int exclude_cpu); +static inline bool trigger_all_cpu_backtrace (void ) { -arch_trigger_cpumask_backtrace (cpu_online_mask,-1 ); +cpumask_backtrace (cpu_online_mask,-1 );return true; }static inline bool trigger_allbutcpu_cpu_backtrace (int exclude_cpu) { -arch_trigger_cpumask_backtrace (cpu_online_mask, exclude_cpu); +cpumask_backtrace (cpu_online_mask, exclude_cpu);return true; }static inline bool trigger_cpumask_backtrace (struct cpumask *mask) { -arch_trigger_cpumask_backtrace (mask,-1 ); +cpumask_backtrace (mask,-1 );return true; }static inline bool trigger_single_cpu_backtrace (int cpu) { -arch_trigger_cpumask_backtrace (cpumask_of (cpu),-1 ); +cpumask_backtrace (cpumask_of (cpu),-1 );return true; }
lib/nmi_backtrace.c +7 -0
@@ -19,6 +19,7 @@#include <linux/stringify.h> #include <linux/nmi.h> #include <linux/cpu.h> +#include <linux/export.h> #include <linux/sched/debug.h> #ifdef arch_trigger_cpumask_backtrace
@@ -129,4 +130,10 @@ bool nmi_cpu_backtrace(struct pt_regs *regs) return false; }NOKPROBE_SYMBOL (nmi_cpu_backtrace); + +void cpumask_backtrace (const cpumask_t *mask,int exclude_cpu) +{ +arch_trigger_cpumask_backtrace (mask, exclude_cpu); +} +EXPORT_SYMBOL_GPL (cpumask_backtrace);#endif
Signature · 1 line
2.55.0.508.g3f0d502094-goog
Re: [PATCH 1/2] nmi: Export CPU backtrace APIs for loadable modules
Hi,
Quoted 13 lines · On Thu, Jul 30, 2026 at 3:00 PM Mayank Rungta via B4 Relay…
From: Mayank Rungta <[email protected]>
Currently, CPU backtrace functions cannot be called from loadable modules because the underlying helper
arch_trigger_cpumask_backtrace()is not exported.Instead of exporting
arch_trigger_cpumask_backtrace()individually across every supported architecture, introduce and export a common helper,cpumask_backtrace(), inlib/nmi_backtrace.c. Update the four inline CPU backtrace macros ininclude/linux/nmi.hto route through this centralized helper.
Quoted 5 lines
Signed-off-by Mayank Rungta <[email protected]>--- include/linux/nmi.h | 10 ++++++---- lib/nmi_backtrace.c | 7 +++++++ 2 files changed, 13 insertions(+), 4 deletions(-)
Guenter Roeck
maintainerRe: [PATCH 1/2] nmi: Export CPU backtrace APIs for loadable modules
In reply to Mayank RungtaQuoted 6 lines · Mayank Rungta
From: Mayank Rungta <[email protected]>
Currently, CPU backtrace functions cannot be called from loadable modules because the underlying helper
arch_trigger_cpumask_backtrace()is not exported.
Quoted 8 lines
Instead of exporting
arch_trigger_cpumask_backtrace()individually across every supported architecture, introduce and export a common helper,cpumask_backtrace(), inlib/nmi_backtrace.c. Update the four inline CPU backtrace macros ininclude/linux/nmi.hto route through this centralized helper.Signed-off-by Mayank Rungta <[email protected]>Reviewed-by Douglas Anderson <[email protected]>
Just to give an update: I'd love to apply this and the next patch of the series, but I can not do wo without formal Ack from a maintainer (I did that once and got burned for it, so it won't happen again).
I'll send an Ack to the next patch of the series, in case someone else wants to pick it up.
Guenter
Re: [PATCH 1/2] nmi: Export CPU backtrace APIs for loadable modules
In reply to Mayank RungtaQuoted 11 lines · On Thu, 30 Jul 2026 15:00:21 -0700 Mayank Rungta via B4 Relay…
From: Mayank Rungta <[email protected]>
Currently, CPU backtrace functions cannot be called from loadable modules because the underlying helper
arch_trigger_cpumask_backtrace()is not exported.Instead of exporting
arch_trigger_cpumask_backtrace()individually across every supported architecture, introduce and export a common helper,cpumask_backtrace(), inlib/nmi_backtrace.c. Update the four inline CPU backtrace macros ininclude/linux/nmi.hto route through this centralized helper.
Re: [PATCH 1/2] nmi: Export CPU backtrace APIs for loadable modules
In reply to Mayank RungtaQuoted 12 lines · Mayank Rungta
From: Mayank Rungta <[email protected]>
Currently, CPU backtrace functions cannot be called from loadable modules because the underlying helper
arch_trigger_cpumask_backtrace()is not exported.Instead of exporting
arch_trigger_cpumask_backtrace()individually across every supported architecture, introduce and export a common helper,cpumask_backtrace(), inlib/nmi_backtrace.c. Update the four inline CPU backtrace macros ininclude/linux/nmi.hto route through this centralized helper.
Quoted 3 lines
Signed-off-by Mayank Rungta <[email protected]>Reviewed-by Douglas Anderson <[email protected]>Reviewed-by Andrew Morton <[email protected]>
Applied.
Thanks,
Guenter
PATCH 2/2 watchdog: pretimeout: Convert dump pretimeout governor to tristate
In reply to Mayank RungtaCommit 645ad41da8b2 ("watchdog: pretimeout: Add "dump" pretimeout governor") added the "dump" watchdog pretimeout governor, but restricted it to built-in code because trigger_all_cpu_backtrace() was not exported to loadable modules.
Now that CPU backtrace APIs are supported for loadable kernel modules via cpumask_backtrace(), convert WATCHDOG_PRETIMEOUT_GOV_DUMP to tristate. This allows kernels to deliver the pretimeout governor as a loadable kernel module.
--- drivers/watchdog/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/Kconfig +2 -2
@@ -99,8 +99,8 @@ config WATCHDOG_PRETIMEOUT_GOV_SEL if WATCHDOG_PRETIMEOUT_GOV config WATCHDOG_PRETIMEOUT_GOV_DUMP - bool "Dump watchdog pretimeout governor" - depends on WATCHDOG_CORE=y + tristate "Dump watchdog pretimeout governor" + depends on WATCHDOG_CORE default WATCHDOG_CORE help Dump watchdog pretimeout governor, all cpu backtrace is
Signature · 1 line
2.55.0.508.g3f0d502094-goog
Re: [PATCH 2/2] watchdog: pretimeout: Convert dump pretimeout governor to tristate
Hi,
Quoted 13 lines · On Thu, Jul 30, 2026 at 3:00 PM Mayank Rungta via B4 Relay…
From: Mayank Rungta <[email protected]>
Commit
645ad41da8b2("watchdog: pretimeout: Add "dump" pretimeout governor") added the "dump" watchdog pretimeout governor, but restricted it to built-in code becausetrigger_all_cpu_backtrace()was not exported to loadable modules.Now that CPU backtrace APIs are supported for loadable kernel modules via
cpumask_backtrace(), convertWATCHDOG_PRETIMEOUT_GOV_DUMPto tristate. This allows kernels to deliver the pretimeout governor as a loadable kernel module.
Quoted 4 lines
Signed-off-by Mayank Rungta <[email protected]>--- drivers/watchdog/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Re: [PATCH 2/2] watchdog: pretimeout: Convert dump pretimeout governor to tristate
In reply to Mayank RungtaQuoted 3 lines · On Thu, Jul 30, 2026 at 03:00:22PM -0700, Mayank Rungta via B4 Relay wrote:
From: Mayank Rungta <[email protected]>
Commit
645ad41da8b2("watchdog: pretimeout: Add "dump" pretimeout
FWIW: The hash might have changed due to a rebase.
Quoted 10 lines
governor") added the "dump" watchdog pretimeout governor, but restricted it to built-in code because
trigger_all_cpu_backtrace()was not exported to loadable modules.Now that CPU backtrace APIs are supported for loadable kernel modules via
cpumask_backtrace(), convertWATCHDOG_PRETIMEOUT_GOV_DUMPto tristate. This allows kernels to deliver the pretimeout governor as a loadable kernel module.Signed-off-by Mayank Rungta <[email protected]>
Re: [PATCH 2/2] watchdog: pretimeout: Convert dump pretimeout governor to tristate
In reply to Mayank RungtaQuoted 7 lines · Mayank Rungta
From: Mayank Rungta <[email protected]>
Commit
645ad41da8b2("watchdog: pretimeout: Add "dump" pretimeout governor") added the "dump" watchdog pretimeout governor, but restricted it to built-in code becausetrigger_all_cpu_backtrace()was not exported to loadable modules.
Quoted 8 lines
Now that CPU backtrace APIs are supported for loadable kernel modules via
cpumask_backtrace(), convertWATCHDOG_PRETIMEOUT_GOV_DUMPto tristate. This allows kernels to deliver the pretimeout governor as a loadable kernel module.Signed-off-by Mayank Rungta <[email protected]>Reviewed-by Douglas Anderson <[email protected]>Reviewed-by Tzung-Bi Shih <[email protected]>
As mentioned in the other patch, I can not apply the series without Ack from a maintainer. In case someone else wants to pick it up instead:
Quoted 19 lines
--- drivers/watchdog/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/watchdog/Kconfig +2
-2@@ -99,8 +99,8 @@ config WATCHDOG_PRETIMEOUT_GOV_SEL if WATCHDOG_PRETIMEOUT_GOV config WATCHDOG_PRETIMEOUT_GOV_DUMP - bool "Dump watchdog pretimeout governor" - depends on WATCHDOG_CORE=y + tristate "Dump watchdog pretimeout governor" + depends on WATCHDOG_CORE default WATCHDOG_CORE help Dump watchdog pretimeout governor, all cpu backtrace is
Re: [PATCH 2/2] watchdog: pretimeout: Convert dump pretimeout governor to tristate
In reply to Mayank RungtaQuoted 9 lines · On Thu, 30 Jul 2026 15:00:22 -0700 Mayank Rungta via B4 Relay…
Commit
645ad41da8b2("watchdog: pretimeout: Add "dump" pretimeout governor") added the "dump" watchdog pretimeout governor, but restricted it to built-in code becausetrigger_all_cpu_backtrace()was not exported to loadable modules.Now that CPU backtrace APIs are supported for loadable kernel modules via
cpumask_backtrace(), convertWATCHDOG_PRETIMEOUT_GOV_DUMPto tristate. This allows kernels to deliver the pretimeout governor as a loadable kernel module.
Re: [PATCH 2/2] watchdog: pretimeout: Convert dump pretimeout governor to tristate
In reply to Mayank RungtaQuoted 12 lines · Mayank Rungta
From: Mayank Rungta <[email protected]>
Commit
645ad41da8b2("watchdog: pretimeout: Add "dump" pretimeout governor") added the "dump" watchdog pretimeout governor, but restricted it to built-in code becausetrigger_all_cpu_backtrace()was not exported to loadable modules.Now that CPU backtrace APIs are supported for loadable kernel modules via
cpumask_backtrace(), convertWATCHDOG_PRETIMEOUT_GOV_DUMPto tristate. This allows kernels to deliver the pretimeout governor as a loadable kernel module.
Quoted 5 lines
Signed-off-by Mayank Rungta <[email protected]>Reviewed-by Douglas Anderson <[email protected]>Reviewed-by Tzung-Bi Shih <[email protected]>Acked-by Guenter Roeck <[email protected]>Reviewed-by Andrew Morton <[email protected]>
Applied.
Thanks,
Guenter
Andrew Morton
maintainerQuoted 9 lines · On Thu, 30 Jul 2026 15:00:20 -0700 Mayank Rungta via B4 Relay…
All other watchdog pretimeout governors (noop, panic) can be built as loadable modules. However the "dump" pretimeout governor is restricted to built-in code because it calls
trigger_all_cpu_backtrace(), which relies onarch_trigger_cpumask_backtrace(), an arch specific helper that is not exported to loadable modules.This 2-patch series allows building the dump governor as a module (=m):
1) Exportcpumask_backtrace()inlib/nmi_backtrace.c.
2) ConvertCONFIG_WATCHDOG_PRETIMEOUT_GOV_DUMPfrom bool to tristate.
LGTM. Can you please redo against current mainline? The Kconfig has changed.
Quoted 9 lines · Andrew Morton
Quoted 6 lines · On Thu, 30 Jul 2026 15:00:20 -0700 Mayank Rungta via B4 Relay…
All other watchdog pretimeout governors (noop, panic) can be built as loadable modules. However the "dump" pretimeout governor is restricted to built-in code because it calls
trigger_all_cpu_backtrace(), which relies onarch_trigger_cpumask_backtrace(), an arch specific helper that is not exported to loadable modules.
Quoted 7 lines
Quoted 3 lines
This 2-patch series allows building the dump governor as a module (=m):
1) Exportcpumask_backtrace()inlib/nmi_backtrace.c.
2) ConvertCONFIG_WATCHDOG_PRETIMEOUT_GOV_DUMPfrom bool to tristate.LGTM. Can you please redo against current mainline? The
Kconfighas changed.
Thanks for the LGTM!
Regarding rebasing onto mainline (origin/master): The "dump" pretimeout governor was added recently by Tzung-Bi Shih ("watchdog:
pretimeout: Add "dump" pretimeout governor") and is currently in linux-next, so it hasn't landed in mainline tree yet.
Because of this dependency, I based this series on linux-next so that patch 2/2 ("Convert dump pretimeout governor to tristate") could apply cleanly on top of the new governor.
Please let me know what is preferred, or if you'd like me to post against a different tree!
Thanks,
Mayank
Andrew Morton
maintainerQuoted 25 lines · On Thu, 30 Jul 2026 16:39:14 -0700 Mayank Rungta <[email protected]> wrote:
Quoted 9 lines · Andrew Morton
Quoted 6 lines · On Thu, 30 Jul 2026 15:00:20 -0700 Mayank Rungta via B4 Relay…
All other watchdog pretimeout governors (noop, panic) can be built as loadable modules. However the "dump" pretimeout governor is restricted to built-in code because it calls
trigger_all_cpu_backtrace(), which relies onarch_trigger_cpumask_backtrace(), an arch specific helper that is not exported to loadable modules.Quoted 7 lines
Quoted 3 lines
This 2-patch series allows building the dump governor as a module (=m):
1) Exportcpumask_backtrace()inlib/nmi_backtrace.c.
2) ConvertCONFIG_WATCHDOG_PRETIMEOUT_GOV_DUMPfrom bool to tristate.LGTM. Can you please redo against current mainline? The
Kconfighas changed.Thanks for the LGTM!
Regarding rebasing onto mainline (origin/master): The "dump" pretimeout governor was added recently by Tzung-Bi Shih ("watchdog:
pretimeout: Add "dump" pretimeout governor") and is currently in linux-next, so it hasn't landed in mainline tree yet.
Quoted 7 lines
Because of this dependency, I based this series on linux-next so that patch 2/2 ("Convert dump pretimeout governor to tristate") could apply cleanly on top of the new governor.
Please let me know what is preferred, or if you'd like me to post against a different tree!
Oh, OK.
Guenter, can you please process this patchset?
Guenter Roeck
maintainerQuoted 31 lines · Andrew Morton
Quoted 29 lines · On Thu, 30 Jul 2026 16:39:14 -0700 Mayank Rungta <[email protected]> wrote:
Quoted 9 lines · Andrew Morton
Quoted 6 lines · On Thu, 30 Jul 2026 15:00:20 -0700 Mayank Rungta via B4 Relay…
All other watchdog pretimeout governors (noop, panic) can be built as loadable modules. However the "dump" pretimeout governor is restricted to built-in code because it calls
trigger_all_cpu_backtrace(), which relies onarch_trigger_cpumask_backtrace(), an arch specific helper that is not exported to loadable modules.Quoted 7 lines
Quoted 3 lines
This 2-patch series allows building the dump governor as a module (=m):
1) Exportcpumask_backtrace()inlib/nmi_backtrace.c.
2) ConvertCONFIG_WATCHDOG_PRETIMEOUT_GOV_DUMPfrom bool to tristate.LGTM. Can you please redo against current mainline? The
Kconfighas changed.Thanks for the LGTM!
Regarding rebasing onto mainline (origin/master): The "dump" pretimeout governor was added recently by Tzung-Bi Shih ("watchdog:
pretimeout: Add "dump" pretimeout governor") and is currently in linux-next, so it hasn't landed in mainline tree yet.Because of this dependency, I based this series on linux-next so that patch 2/2 ("Convert dump pretimeout governor to tristate") could apply cleanly on top of the new governor.
Quoted 8 lines
Quoted 3 lines
Please let me know what is preferred, or if you'd like me to post against a different tree!
Oh, OK.
Guenter, can you please process this patchset?
Sure. Assuming you'd like me to handle it through the watchdog branch, it would be great if you can send a formal Acked-by: to the first patch of the series.
Thanks,
Guenter