diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 147223cf061a..322cbdab2cb4 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -9,6 +9,7 @@ #define CREATE_TRACE_POINTS #include #include +#include #include #include #include @@ -133,3 +134,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_allow_domain_state); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_report_bug); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_em_cpu_energy); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpu_up); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpu_down); diff --git a/include/trace/hooks/cpu.h b/include/trace/hooks/cpu.h new file mode 100644 index 000000000000..eccab9e57fd9 --- /dev/null +++ b/include/trace/hooks/cpu.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM cpu +#define TRACE_INCLUDE_PATH trace/hooks +#if !defined(_TRACE_HOOK_CPU_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_CPU_H +#include +#include +/* + * Following tracepoints are not exported in tracefs and provide a + * mechanism for vendor modules to hook and extend functionality + */ +DECLARE_HOOK(android_vh_cpu_up, + TP_PROTO(void *unused), + TP_ARGS(unused)); + +DECLARE_HOOK(android_vh_cpu_down, + TP_PROTO(void *unused), + TP_ARGS(unused)); + +#endif /* _TRACE_HOOK_CPU_H */ +/* This part must be outside protection */ +#include diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 9790421eb325..c97065eda7fa 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -3261,6 +3261,7 @@ void cpuset_wait_for_hotplug(void) { flush_work(&cpuset_hotplug_work); } +EXPORT_SYMBOL_GPL(cpuset_wait_for_hotplug); /* * Keep top_cpuset.mems_allowed tracking node_states[N_MEMORY]. diff --git a/kernel/cpu.c b/kernel/cpu.c index 98087a6fd37f..1cbbbfdeae83 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -41,6 +41,7 @@ #undef CREATE_TRACE_POINTS #include +#include #include "smpboot.h" @@ -1070,6 +1071,8 @@ static int cpu_down(unsigned int cpu, enum cpuhp_state target) { int err; + trace_android_vh_cpu_down(NULL); + cpu_maps_update_begin(); err = cpu_down_maps_locked(cpu, target); cpu_maps_update_done(); @@ -1499,6 +1502,8 @@ static int cpu_up(unsigned int cpu, enum cpuhp_state target) return -EINVAL; } + trace_android_vh_cpu_up(NULL); + /* * CPU hotplug operations consists of many steps and each step * calls a callback of core kernel subsystem. CPU hotplug-in