mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 12:52:29 -04:00
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. Signed-off-by: Mayank Rungta <mrungta@google.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Link: https://lore.kernel.org/r/20260730-export-cpu-backtrace-apis-v1-1-bace8e1cb817@google.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
committed by
Guenter Roeck
parent
b583ce8541
commit
bd26ae0caa
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user