ANDROID: power: add vendor hooks for try_to_freeze fail

Add hooks to gather data of unfrozen tasks and summarize it
with other information.

Bug: 177483057

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I6f3ed7320e828a8dd1e7ae5d4449420085a75b17
This commit is contained in:
Sangmoon Kim
2021-01-19 21:00:35 +09:00
committed by Todd Kjos
parent b127af3af9
commit 23f19a5f28
3 changed files with 37 additions and 1 deletions

View File

@@ -33,6 +33,7 @@
#include <trace/hooks/bug.h>
#include <trace/hooks/timer.h>
#include <trace/hooks/softlockup.h>
#include <trace/hooks/power.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -141,3 +142,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpu_down);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_balance_rt);
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);

View File

@@ -0,0 +1,27 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM power
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_POWER_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
/*
* Following tracepoints are not exported in tracefs and provide a
* mechanism for vendor modules to hook and extend functionality
*/
struct task_struct;
DECLARE_HOOK(android_vh_try_to_freeze_todo,
TP_PROTO(unsigned int todo, unsigned int elapsed_msecs, bool wq_busy),
TP_ARGS(todo, elapsed_msecs, wq_busy));
DECLARE_HOOK(android_vh_try_to_freeze_todo_unfrozen,
TP_PROTO(struct task_struct *p),
TP_ARGS(p));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_POWER_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View File

@@ -23,6 +23,8 @@
#include <trace/events/power.h>
#include <linux/cpuset.h>
#include <trace/hooks/power.h>
/*
* Timeout for stopping processes
*/
@@ -103,11 +105,15 @@ static int try_to_freeze_tasks(bool user_only)
read_lock(&tasklist_lock);
for_each_process_thread(g, p) {
if (p != current && !freezer_should_skip(p)
&& freezing(p) && !frozen(p))
&& freezing(p) && !frozen(p)) {
sched_show_task(p);
trace_android_vh_try_to_freeze_todo_unfrozen(p);
}
}
read_unlock(&tasklist_lock);
}
trace_android_vh_try_to_freeze_todo(todo, elapsed_msecs, wq_busy);
} else {
pr_cont("(elapsed %d.%03d seconds) ", elapsed_msecs / 1000,
elapsed_msecs % 1000);