diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 645c2ec8626f..7372a3154837 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -302,6 +303,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_freeze_todo); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_freeze_todo_unfrozen); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_die_kernel_fault); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_sp_pc_abort); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_event); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_group); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_dma_buf_stats_teardown); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dpm_wait_start); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dpm_wait_finish); diff --git a/include/trace/hooks/psi.h b/include/trace/hooks/psi.h new file mode 100644 index 000000000000..91a008655031 --- /dev/null +++ b/include/trace/hooks/psi.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM psi + +#define TRACE_INCLUDE_PATH trace/hooks + +#if !defined(_TRACE_HOOK_PSI_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_PSI_H + +#include + +struct psi_trigger; +struct psi_group; +DECLARE_HOOK(android_vh_psi_event, + TP_PROTO(struct psi_trigger *t), + TP_ARGS(t)); + +DECLARE_HOOK(android_vh_psi_group, + TP_PROTO(struct psi_group *group), + TP_ARGS(group)); + +#endif /* _TRACE_HOOK_PSI_H */ + +/* This part must be outside protection */ +#include diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 84dad1511d1e..1d3be71b1cb1 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -136,6 +136,7 @@ * cost-wise, yet way more sensitive and accurate than periodic * sampling of the aggregate task states would be. */ +#include static int psi_bug __read_mostly; @@ -487,6 +488,8 @@ static void update_triggers(struct psi_group *group, u64 now, if (now < t->last_event_time + t->win.size) continue; + trace_android_vh_psi_event(t); + /* Generate an event */ if (cmpxchg(&t->event, 0, 1) == 0) { if (t->of) @@ -498,6 +501,8 @@ static void update_triggers(struct psi_group *group, u64 now, /* Reset threshold breach flag once event got generated */ t->pending_event = false; } + + trace_android_vh_psi_group(group); } static u64 update_averages(struct psi_group *group, u64 now)