ANDROID: sched: add vendor hooks for bad scheduling

Add hooks to gather data of bad scheduling and summarize it with
other information.

Bug: 177483057

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I08a7097b60dd8eebc5c0205b31c463a36f576121
This commit is contained in:
Sangmoon Kim
2021-01-19 21:16:39 +09:00
committed by Todd Kjos
parent 23f19a5f28
commit 18ebdc3746
4 changed files with 12 additions and 3 deletions

View File

@@ -144,3 +144,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_timer_calc_index);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_watchdog_timer_softlockup);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_freeze_todo);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_freeze_todo_unfrozen);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_dequeue_task_idle);

View File

@@ -215,8 +215,8 @@ DECLARE_RESTRICTED_HOOK(android_rvh_ttwu_cond,
TP_ARGS(cond), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_schedule_bug,
TP_PROTO(void *unused),
TP_ARGS(unused), 1);
TP_PROTO(struct task_struct *p),
TP_ARGS(p), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_sched_exec,
TP_PROTO(bool *cond),
@@ -238,6 +238,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_sched_balance_rt,
TP_PROTO(struct rq *rq, struct task_struct *p, int *done),
TP_ARGS(rq, p, done), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_dequeue_task_idle,
TP_PROTO(struct task_struct *p),
TP_ARGS(p), 1);
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_SCHED_H */

View File

@@ -4351,7 +4351,7 @@ static noinline void __schedule_bug(struct task_struct *prev)
if (panic_on_warn)
panic("scheduling while atomic\n");
trace_android_rvh_schedule_bug(NULL);
trace_android_rvh_schedule_bug(prev);
dump_stack();
add_taint(TAINT_WARN, LOCKDEP_STILL_OK);

View File

@@ -10,6 +10,8 @@
#include <trace/events/power.h>
#include <trace/hooks/sched.h>
/* Linker adds these: start and end of __cpuidle functions */
extern char __cpuidle_text_start[], __cpuidle_text_end[];
@@ -449,6 +451,8 @@ dequeue_task_idle(struct rq *rq, struct task_struct *p, int flags)
{
raw_spin_unlock_irq(&rq->lock);
printk(KERN_ERR "bad: scheduling from the idle thread!\n");
trace_android_rvh_dequeue_task_idle(p);
dump_stack();
raw_spin_lock_irq(&rq->lock);
}