ANDROID: vendor_hooks: Add hooks for frequency optimization
These hooks will do the following works:
a) Record the number of times when target_freq being clamped
b) Record the number of times when target_freq is greater than policy->cur
c) Make corresponding optimization strategies in different hooks
d) change the value of target_freq for some scenarios
Bug: 205906618
Bug: 206896672
Change-Id: I8eba66fd0c6d36393ca39045cf228b659834e0ae
Signed-off-by: Liujie Xie <xieliujie@oppo.com>
Signed-off-by: vincent.wang <vincent.wang@unisoc.com>
(cherry picked from commit 7e2fbdaeab)
(cherry picked from commit cf551f380a3c47894accfffc2c8b3d4547a60f9a)
This commit is contained in:
@@ -108,6 +108,9 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gic_v3_affinity_init);
|
|||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_suspend_epoch_val);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_suspend_epoch_val);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_resume_epoch_val);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_resume_epoch_val);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_freq_table_limits);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_freq_table_limits);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpufreq_resolve_freq);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpufreq_fast_switch);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpufreq_target);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_newidle_balance);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_newidle_balance);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_nohz_balancer_kick);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_nohz_balancer_kick);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_rebalance_domains);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_rebalance_domains);
|
||||||
|
|||||||
@@ -532,8 +532,10 @@ static unsigned int __resolve_freq(struct cpufreq_policy *policy,
|
|||||||
unsigned int target_freq, unsigned int relation)
|
unsigned int target_freq, unsigned int relation)
|
||||||
{
|
{
|
||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
|
unsigned int old_target_freq = target_freq;
|
||||||
|
|
||||||
target_freq = clamp_val(target_freq, policy->min, policy->max);
|
target_freq = clamp_val(target_freq, policy->min, policy->max);
|
||||||
|
trace_android_vh_cpufreq_resolve_freq(policy, &target_freq, old_target_freq);
|
||||||
|
|
||||||
if (!cpufreq_driver->target_index)
|
if (!cpufreq_driver->target_index)
|
||||||
return target_freq;
|
return target_freq;
|
||||||
@@ -2099,9 +2101,11 @@ unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
|
|||||||
unsigned int target_freq)
|
unsigned int target_freq)
|
||||||
{
|
{
|
||||||
unsigned int freq;
|
unsigned int freq;
|
||||||
|
unsigned int old_target_freq = target_freq;
|
||||||
int cpu;
|
int cpu;
|
||||||
|
|
||||||
target_freq = clamp_val(target_freq, policy->min, policy->max);
|
target_freq = clamp_val(target_freq, policy->min, policy->max);
|
||||||
|
trace_android_vh_cpufreq_fast_switch(policy, &target_freq, old_target_freq);
|
||||||
freq = cpufreq_driver->fast_switch(policy, target_freq);
|
freq = cpufreq_driver->fast_switch(policy, target_freq);
|
||||||
|
|
||||||
if (!freq)
|
if (!freq)
|
||||||
@@ -2259,6 +2263,8 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
|
|||||||
|
|
||||||
target_freq = __resolve_freq(policy, target_freq, relation);
|
target_freq = __resolve_freq(policy, target_freq, relation);
|
||||||
|
|
||||||
|
trace_android_vh_cpufreq_target(policy, &target_freq, old_target_freq);
|
||||||
|
|
||||||
pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n",
|
pr_debug("target for CPU %u: %u kHz, relation %u, requested %u kHz\n",
|
||||||
policy->cpu, target_freq, relation, old_target_freq);
|
policy->cpu, target_freq, relation, old_target_freq);
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,21 @@ DECLARE_RESTRICTED_HOOK(android_rvh_cpufreq_transition,
|
|||||||
TP_PROTO(struct cpufreq_policy *policy),
|
TP_PROTO(struct cpufreq_policy *policy),
|
||||||
TP_ARGS(policy), 1);
|
TP_ARGS(policy), 1);
|
||||||
|
|
||||||
|
DECLARE_HOOK(android_vh_cpufreq_resolve_freq,
|
||||||
|
TP_PROTO(struct cpufreq_policy *policy, unsigned int *target_freq,
|
||||||
|
unsigned int old_target_freq),
|
||||||
|
TP_ARGS(policy, target_freq, old_target_freq));
|
||||||
|
|
||||||
|
DECLARE_HOOK(android_vh_cpufreq_fast_switch,
|
||||||
|
TP_PROTO(struct cpufreq_policy *policy, unsigned int *target_freq,
|
||||||
|
unsigned int old_target_freq),
|
||||||
|
TP_ARGS(policy, target_freq, old_target_freq));
|
||||||
|
|
||||||
|
DECLARE_HOOK(android_vh_cpufreq_target,
|
||||||
|
TP_PROTO(struct cpufreq_policy *policy, unsigned int *target_freq,
|
||||||
|
unsigned int old_target_freq),
|
||||||
|
TP_ARGS(policy, target_freq, old_target_freq));
|
||||||
|
|
||||||
#endif /* _TRACE_HOOK_CPUFREQ_H */
|
#endif /* _TRACE_HOOK_CPUFREQ_H */
|
||||||
/* This part must be outside protection */
|
/* This part must be outside protection */
|
||||||
#include <trace/define_trace.h>
|
#include <trace/define_trace.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user