ANDROID: Add vendor hook while registering energy model

Vendor architectures may contain CPUs running on the same clock line
which contain different capacities. Add a tracehook in this path to
allow vendor modules to skip implicit check to prevent crashes.

Bug: 206602617
Change-Id: Ica01a214689607b8d79b370c20bc9a8c44ca2117
Signed-off-by: Shaleen Agrawal <shalagra@codeaurora.org>
This commit is contained in:
Shaleen Agrawal
2021-11-16 10:57:40 -08:00
committed by Todd Kjos
parent 4c4e15448e
commit 12d9e3b85d
3 changed files with 11 additions and 0 deletions

View File

@@ -198,3 +198,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_file_open);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_bpf_syscall); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_bpf_syscall);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_ptr_locked); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_ptr_locked);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_rto_next_cpu); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_rto_next_cpu);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_em_dev_register_pd);

View File

@@ -311,6 +311,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_dequeue_task_fair,
TP_PROTO(struct rq *rq, struct task_struct *p, int flags), TP_PROTO(struct rq *rq, struct task_struct *p, int flags),
TP_ARGS(rq, p, flags), 1); TP_ARGS(rq, p, flags), 1);
DECLARE_HOOK(android_vh_em_dev_register_pd,
TP_PROTO(bool *cond),
TP_ARGS(cond));
#endif /* _TRACE_HOOK_SCHED_H */ #endif /* _TRACE_HOOK_SCHED_H */
/* This part must be outside protection */ /* This part must be outside protection */
#include <trace/define_trace.h> #include <trace/define_trace.h>

View File

@@ -15,6 +15,7 @@
#include <linux/energy_model.h> #include <linux/energy_model.h>
#include <linux/sched/topology.h> #include <linux/sched/topology.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <trace/hooks/sched.h>
/* /*
* Mutex serializing the registrations of performance domains and letting * Mutex serializing the registrations of performance domains and letting
@@ -286,6 +287,7 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
{ {
unsigned long cap, prev_cap = 0; unsigned long cap, prev_cap = 0;
int cpu, ret; int cpu, ret;
bool cond = false;
if (!dev || !nr_states || !cb) if (!dev || !nr_states || !cb)
return -EINVAL; return -EINVAL;
@@ -314,6 +316,10 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
ret = -EEXIST; ret = -EEXIST;
goto unlock; goto unlock;
} }
trace_android_vh_em_dev_register_pd(&cond);
if (cond)
continue;
/* /*
* All CPUs of a domain must have the same * All CPUs of a domain must have the same
* micro-architecture since they all share the same * micro-architecture since they all share the same