diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 97e9414bb44e..7dc7311c9896 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -44,11 +44,13 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event * associated with them) to allow external modules to probe them. */ +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_arch_set_freq_scale); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_is_fpsimd_save); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_transaction_init); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_set_priority); diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 1ef327b402a9..2cdade8aa933 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -25,6 +25,7 @@ #undef CREATE_TRACE_POINTS #include +#include static DEFINE_PER_CPU(struct scale_freq_data __rcu *, sft_data); static struct cpumask scale_freq_counters_mask; @@ -149,6 +150,8 @@ void topology_set_freq_scale(const struct cpumask *cpus, unsigned long cur_freq, scale = (cur_freq << SCHED_CAPACITY_SHIFT) / max_freq; + trace_android_vh_arch_set_freq_scale(cpus, cur_freq, max_freq, &scale); + for_each_cpu(i, cpus) per_cpu(arch_freq_scale, i) = scale; } diff --git a/include/trace/hooks/topology.h b/include/trace/hooks/topology.h new file mode 100644 index 000000000000..d2673d4379c1 --- /dev/null +++ b/include/trace/hooks/topology.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM topology + +#define TRACE_INCLUDE_PATH trace/hooks + +#if !defined(_TRACE_HOOK_TOPOLOGY_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_TOPOLOGY_H + +#include + +struct cpumask; + +#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS) + +DECLARE_HOOK(android_vh_arch_set_freq_scale, + TP_PROTO(const struct cpumask *cpus, unsigned long freq, unsigned long max, + unsigned long *scale), + TP_ARGS(cpus, freq, max, scale)); + +#else + +#define trace_android_vh_arch_set_freq_scale(cpus, freq, max, scale) + +#endif + +#endif /* _TRACE_HOOK_TOPOLOGY_H */ +/* This part must be outside protection */ +#include