From 1347ec535a19feeac64db01def8d9b428f2d08fd Mon Sep 17 00:00:00 2001 From: Stephen Dickey Date: Thu, 4 Nov 2021 15:26:15 -0700 Subject: [PATCH] ANDROID: sched: add hook to rto_next_cpu Restricted vendor hook to modify the cpu selected in rto_next_cpu, which is needed for the implementation of CPU Pause. Bug: 205164003 Change-Id: I0dc675e54f7f116d538840262fbb0ba6d28246f4 Signed-off-by: Stephen Dickey Signed-off-by: Ashay Jaiswal --- include/trace/hooks/sched.h | 4 ++++ kernel/sched/rt.c | 3 +++ kernel/sched/vendor_hooks.c | 1 + 3 files changed, 8 insertions(+) diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index bb96c4776633..cf479c78297f 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -56,6 +56,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_rtmutex_prepare_setprio, TP_PROTO(struct task_struct *p, struct task_struct *pi_task), TP_ARGS(p, pi_task), 1); +DECLARE_RESTRICTED_HOOK(android_rvh_rto_next_cpu, + TP_PROTO(int rto_cpu, struct cpumask *rto_mask, int *cpu), + TP_ARGS(rto_cpu, rto_mask, cpu), 1); + DECLARE_RESTRICTED_HOOK(android_rvh_set_user_nice, TP_PROTO(struct task_struct *p, long *nice, bool *allowed), TP_ARGS(p, nice, allowed), 1); diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index fa81d23f5b01..586c87e6dc32 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -2305,6 +2305,9 @@ static int rto_next_cpu(struct root_domain *rd) /* When rto_cpu is -1 this acts like cpumask_first() */ cpu = cpumask_next(rd->rto_cpu, rd->rto_mask); + /* this will be any CPU in the rd->rto_mask, and can be a halted cpu update it */ + trace_android_rvh_rto_next_cpu(rd->rto_cpu, rd->rto_mask, &cpu); + rd->rto_cpu = cpu; if (cpu < nr_cpu_ids) diff --git a/kernel/sched/vendor_hooks.c b/kernel/sched/vendor_hooks.c index 5aacb10debf3..bec74bb1a9a3 100644 --- a/kernel/sched/vendor_hooks.c +++ b/kernel/sched/vendor_hooks.c @@ -71,3 +71,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_place_entity); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_build_perf_domains); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_cpu_capacity); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_misfit_status); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_rto_next_cpu);