From 9bdaa3fa874dbe8b4171eeedf38d9ae294fb274d Mon Sep 17 00:00:00 2001 From: Amir Vajid Date: Tue, 20 Oct 2020 15:58:14 -0700 Subject: [PATCH] ANDROID: vendor_hooks: Add hook for jiffies updates Create a vendor hook for jiffies updates by the tick_do_timer_cpu. Bug: 148928265 Change-Id: Ia442e20d446b8ce4f2b3f2be76655e72919c76eb Signed-off-by: Amir Vajid --- drivers/android/vendor_hooks.c | 1 + include/trace/hooks/sched.h | 5 +++++ kernel/time/tick-common.c | 2 ++ kernel/time/tick-sched.c | 5 ++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 9d9c3ec5bb5a..d54a00fe2f9f 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -66,3 +66,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ipi_stop); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sysrq_crash); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dump_throttled_rt_tasks); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_printk_hotplug); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_jiffies_update); diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index 934f7df70d21..8f6cc48a50ce 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -70,11 +70,15 @@ struct sched_group; DECLARE_RESTRICTED_HOOK(android_rvh_find_busiest_group, TP_PROTO(struct sched_group *busiest, struct rq *dst_rq, int *out_balance), TP_ARGS(busiest, dst_rq, out_balance), 1); + DECLARE_HOOK(android_vh_dump_throttled_rt_tasks, TP_PROTO(int cpu, u64 clock, ktime_t rt_period, u64 rt_runtime, s64 rt_period_timer_expires), TP_ARGS(cpu, clock, rt_period, rt_runtime, rt_period_timer_expires)); +DECLARE_HOOK(android_vh_jiffies_update, + TP_PROTO(void *unused), + TP_ARGS(unused)); #else #define trace_android_rvh_select_task_rq_fair(p, prev_cpu, sd_flag, wake_flags, new_cpu) #define trace_android_rvh_select_task_rq_rt(p, prev_cpu, sd_flag, wake_flags, new_cpu) @@ -91,6 +95,7 @@ DECLARE_HOOK(android_vh_dump_throttled_rt_tasks, #define trace_android_rvh_setscheduler(p) #define trace_android_rvh_find_busiest_group(busiest, dst_rq, out_balance) #define trace_android_vh_dump_throttled_rt_tasks(cpu, clock, rt_period, rt_runtime, rt_period_timer_expires) +#define trace_android_vh_jiffies_update(unused) #endif #endif /* _TRACE_HOOK_SCHED_H */ /* This part must be outside protection */ diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 6c9c342dd0e5..5c507c62850b 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -94,6 +95,7 @@ static void tick_periodic(int cpu) write_seqcount_end(&jiffies_seq); raw_spin_unlock(&jiffies_lock); update_wall_time(); + trace_android_vh_jiffies_update(NULL); } update_process_times(user_mode(get_irq_regs())); diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 34d948d2bfa3..4de8504eba1d 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -143,8 +144,10 @@ static void tick_sched_do_timer(struct tick_sched *ts, ktime_t now) #endif /* Check, if the jiffies need an update */ - if (tick_do_timer_cpu == cpu) + if (tick_do_timer_cpu == cpu) { tick_do_update_jiffies64(now); + trace_android_vh_jiffies_update(NULL); + } if (ts->inidle) ts->got_idle_tick = 1;