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: 273189923

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I61da3d253bd9959c6f06e09c9a35c4b242cedafe
(cherry picked from commit 2232e3fc85534a176e7f8bdfe8c56820d10dc111)
This commit is contained in:
Sangmoon Kim 2021-01-19 21:00:35 +09:00 committed by Todd Kjos
parent 8635a09118
commit c5ea4db533
3 changed files with 31 additions and 1 deletions

View file

@ -51,6 +51,7 @@
#include <trace/hooks/hung_task.h>
#include <trace/hooks/bug.h>
#include <trace/hooks/softlockup.h>
#include <trace/hooks/power.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@ -158,3 +159,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterrupt_tasks);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterrupt_tasks_done);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_report_bug);
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,21 @@
/* 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 <trace/hooks/vendor_hooks.h>
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));
#endif /* _TRACE_HOOK_POWER_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View file

@ -20,6 +20,8 @@
#include <trace/events/power.h>
#include <linux/cpuset.h>
#include <trace/hooks/power.h>
/*
* Timeout for stopping processes
*/
@ -100,11 +102,15 @@ static int try_to_freeze_tasks(bool user_only)
if (pm_debug_messages_on) {
read_lock(&tasklist_lock);
for_each_process_thread(g, p) {
if (p != current && freezing(p) && !frozen(p))
if (p != current && 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_info("Freezing %s completed (elapsed %d.%03d seconds)\n",
what, elapsed_msecs / 1000, elapsed_msecs % 1000);