diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index b2d018fe1a03..daa9c2bf6043 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -14,6 +14,7 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event @@ -48,3 +49,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_read_wait_finish); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_write_wait_start); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_write_wait_finish); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_show_task); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpu_idle); diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 87197319ab06..07d53d069b7c 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "cpuidle.h" @@ -228,6 +229,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, /* Take note of the planned idle state. */ sched_idle_set_state(target_state); + trace_android_vh_cpu_idle(0, index, dev->cpu); trace_cpu_idle_rcuidle(index, dev->cpu); time_start = ns_to_ktime(local_clock()); @@ -238,6 +240,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, sched_clock_idle_wakeup_event(); time_end = ns_to_ktime(local_clock()); trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); + trace_android_vh_cpu_idle(PWR_EVENT_EXIT, entered_state, dev->cpu); /* The cpu is no longer idle or about to enter idle. */ sched_idle_set_state(NULL); diff --git a/include/trace/hooks/cpuidle.h b/include/trace/hooks/cpuidle.h new file mode 100644 index 000000000000..826e98e37690 --- /dev/null +++ b/include/trace/hooks/cpuidle.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM cpuidle + +#define TRACE_INCLUDE_PATH trace/hooks + +#if !defined(_TRACE_HOOK_CPUIDLE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_CPUIDLE_H + +#include +#include + +#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS) +DECLARE_HOOK(android_vh_cpu_idle, + TP_PROTO(int event, int state, int cpu), + TP_ARGS(event, state, cpu)) +#else +#define trace_android_vh_cpu_idle(event, state, cpu) +#endif + +#endif /* _TRACE_HOOK_CPUIDLE_H */ +/* This part must be outside protection */ +#include +