ANDROID: power: add vendor hooks for try_to_freeze fail
Add hooks to gather data of unfrozen tasks and summarize it with other information. It helps the bootloader produce the summary information when kernel panic or watchdog reset occurs. It can be obtained through Ramdump, etc., and this information can be used to quickly classify and respond to problems. Bug: 326888644 Bug: 386310634 Change-Id: I61da3d253bd9959c6f06e09c9a35c4b242cedafe Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com> (cherry picked from commit 7614c52ba2fac548d99cfd7863302c34441a9f3b)
This commit is contained in:
committed by
T.J. Mercier
parent
ca2d053a94
commit
1475729178
@@ -53,6 +53,7 @@
|
||||
#include <trace/hooks/logbuf.h>
|
||||
#include <trace/hooks/regmap.h>
|
||||
#include <trace/hooks/softlockup.h>
|
||||
#include <trace/hooks/power.h>
|
||||
|
||||
/*
|
||||
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
||||
@@ -195,3 +196,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_slab_folio_alloced);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kmalloc_large_alloced);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ctl_dirty_rate);
|
||||
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);
|
||||
|
||||
21
include/trace/hooks/power.h
Normal file
21
include/trace/hooks/power.h
Normal 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>
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <trace/events/power.h>
|
||||
#include <linux/cpuset.h>
|
||||
|
||||
#include <trace/hooks/power.h>
|
||||
|
||||
/*
|
||||
* Timeout for stopping processes
|
||||
*/
|
||||
@@ -98,11 +100,15 @@ static int try_to_freeze_tasks(bool user_only)
|
||||
if (!wakeup || 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);
|
||||
|
||||
Reference in New Issue
Block a user