ANDROID: GKI: arm64: smp: Add set_update_ipi_history_callback

Provide set_update_ipi_history_callback allowing modules to register
a callback for monitoring interrupt rescheduling events.

Bug: 147267745
Bug: 152652820
Test: compile
Signed-off-by: Will McVicker <willmcvicker@google.com>
(cherry picked from commit 356d92323654c149933fa0eacaba7ab464381f8e)
[surenb: resolve merge conflicts]
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Icae6ba1f671967723667dc51f8337dbef03e89f3
This commit is contained in:
Will McVicker 2020-01-06 23:04:45 -08:00 committed by Suren Baghdasaryan
commit 8d3bea1aed
4 changed files with 31 additions and 0 deletions

View file

@ -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.

View file

@ -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);
}

View file

@ -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.
*/

View file

@ -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);
}