diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h index 709a55989cb0..cd660dd44e6c 100644 --- a/arch/arm/include/asm/smp.h +++ b/arch/arm/include/asm/smp.h @@ -48,6 +48,12 @@ extern void smp_init_cpus(void); */ extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int)); +/* + * Provide a function to set a callback function pointer for updating the ipi + * history. + */ +extern void set_update_ipi_history_callback(void (*fn)(int)); + /* * Called from platform specific assembly code, this is the * secondary CPU entry point. diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index bada66ef4419..bc6e5181f021 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -516,6 +516,14 @@ void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int)) __smp_cross_call = fn; } +static void (*__smp_update_ipi_history_cb)(int cpu); + +void set_update_ipi_history_callback(void (*fn)(int)) +{ + __smp_update_ipi_history_cb = fn; +} +EXPORT_SYMBOL_GPL(set_update_ipi_history_callback); + static const char *ipi_types[NR_IPI] __tracepoint_string = { #define S(x,s) [x] = s S(IPI_WAKEUP, "CPU wakeup interrupts"), @@ -708,6 +716,8 @@ void handle_IPI(int ipinr, struct pt_regs *regs) void smp_send_reschedule(int cpu) { + if (__smp_update_ipi_history_cb) + __smp_update_ipi_history_cb(cpu); smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); } diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h index f82b447bd34f..79a9aa27957e 100644 --- a/arch/arm64/include/asm/smp.h +++ b/arch/arm64/include/asm/smp.h @@ -71,6 +71,12 @@ extern void set_smp_cross_call(void (*)(const struct cpumask *, unsigned int)); extern void (*__smp_cross_call)(const struct cpumask *, unsigned int); +/* + * Provide a function to set a callback function pointer for updating the ipi + * history. + */ +extern void set_update_ipi_history_callback(void (*fn)(int)); + /* * Called from the secondary holding pen, this is the secondary CPU entry point. */ diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 3e98cb6bed65..7f2661858082 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -598,6 +598,7 @@ static void __init acpi_parse_and_init_cpus(void) #define acpi_parse_and_init_cpus(...) do { } while (0) #endif +static void (*__smp_update_ipi_history_cb)(int cpu); /* * Enumerate the possible CPU set from the device tree and build the * cpu logical map array containing MPIDR values related to logical @@ -745,6 +746,12 @@ void __init set_smp_cross_call(void (*fn)(const struct cpumask *, unsigned int)) __smp_cross_call = fn; } +void set_update_ipi_history_callback(void (*fn)(int)) +{ + __smp_update_ipi_history_cb = fn; +} +EXPORT_SYMBOL_GPL(set_update_ipi_history_callback); + static const char *ipi_types[NR_IPI] __tracepoint_string = { #define S(x,s) [x] = s S(IPI_RESCHEDULE, "Rescheduling interrupts"), @@ -925,6 +932,8 @@ void handle_IPI(int ipinr, struct pt_regs *regs) void smp_send_reschedule(int cpu) { + if (__smp_update_ipi_history_cb) + __smp_update_ipi_history_cb(cpu); smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); }