From 3259c6dcd9e45be5e2f43a782d32a417864c4fd8 Mon Sep 17 00:00:00 2001 From: Sai Harshini Nimmala Date: Fri, 2 Feb 2024 18:15:12 -0800 Subject: [PATCH] ANDROID: cpufreq: Add a restricted vendor hook for freq transition A restricted vendor hook for cpufreq transition. The hook is invoked per policy after changing the policy->cur and passes policy as an argument. This reverts commit 171ace325c6c567f26e39f2874b700f09a24bd3a which is a revert of the original change. Hence, this brings back the original change. Bug: 181889516 Change-Id: I6f89850779fdd63e178e227c293f42b7f66fd78d Signed-off-by: Pavankumar Kondeti Signed-off-by: Sai Harshini Nimmala (cherry picked from commit 8820ccfe91a92c919231239363fca724f0776ffc) --- drivers/android/vendor_hooks.c | 1 + drivers/cpufreq/cpufreq.c | 2 ++ include/trace/hooks/cpufreq.h | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index a167640073bf..94e0fa73bc90 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -85,6 +85,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ptype_head); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_allow_domain_state); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_enter); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_exit); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpufreq_transition); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_balance_anon_file_reclaim); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_show_max_freq); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_avc_insert); diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 4e7a763283fb..97c3fc20f1a0 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -397,6 +397,7 @@ static void cpufreq_notify_transition(struct cpufreq_policy *policy, cpufreq_stats_record_transition(policy, freqs->new); cpufreq_times_record_transition(policy, freqs->new); policy->cur = freqs->new; + trace_android_rvh_cpufreq_transition(policy); } } @@ -2195,6 +2196,7 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, arch_set_freq_scale(policy->related_cpus, freq, arch_scale_freq_ref(policy->cpu)); cpufreq_stats_record_transition(policy, freq); + trace_android_rvh_cpufreq_transition(policy); if (trace_cpu_frequency_enabled()) { for_each_cpu(cpu, policy->cpus) diff --git a/include/trace/hooks/cpufreq.h b/include/trace/hooks/cpufreq.h index aef236faefa2..1a36ea75392d 100644 --- a/include/trace/hooks/cpufreq.h +++ b/include/trace/hooks/cpufreq.h @@ -39,6 +39,10 @@ DECLARE_HOOK(android_vh_cpufreq_target, unsigned int old_target_freq), TP_ARGS(policy, target_freq, old_target_freq)); +DECLARE_RESTRICTED_HOOK(android_rvh_cpufreq_transition, + TP_PROTO(struct cpufreq_policy *policy), + TP_ARGS(policy), 1); + #endif /* _TRACE_HOOK_CPUFREQ_H */ /* This part must be outside protection */ #include