mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00: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 <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
This commit is contained in:
committed by
Guenter Roeck
parent
b583ce8541
commit
bd26ae0caa
+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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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