ANDROID: hung_task: Add vendor hook for hung task detect
Add vendor hook for hung task detect, so we can decide which threads need to check, avoiding false alarms. Bug: 188684133 Change-Id: I5d7dfeb071cbfda8121134c38a458202aaa3a8c6 Signed-off-by: Huang Yiwei <hyiwei@codeaurora.org> [xuewen: minor conflicts fixups] Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <trace/hooks/timer.h>
|
||||
#include <trace/hooks/fpsimd.h>
|
||||
#include <trace/hooks/dtask.h>
|
||||
#include <trace/hooks/hung_task.h>
|
||||
#include <trace/hooks/ftrace_dump.h>
|
||||
#include <trace/hooks/mm.h>
|
||||
#include <trace/hooks/traps.h>
|
||||
@@ -107,6 +108,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rproc_recovery_set);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_timer_calc_index);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_is_fpsimd_save);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_show_task);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterruptible_tasks);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterruptible_tasks_dn);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ftrace_format_check);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_free);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_alloc);
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM hung_task
|
||||
|
||||
#define TRACE_INCLUDE_PATH trace/hooks
|
||||
|
||||
#if !defined(_TRACE_HOOK_HUNG_TASK_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HOOK_HUNG_TASK_H
|
||||
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
|
||||
DECLARE_HOOK(android_vh_check_uninterruptible_tasks,
|
||||
TP_PROTO(struct task_struct *t, unsigned long timeout,
|
||||
bool *need_check),
|
||||
TP_ARGS(t, timeout, need_check));
|
||||
|
||||
DECLARE_HOOK(android_vh_check_uninterruptible_tasks_dn,
|
||||
TP_PROTO(void *unused),
|
||||
TP_ARGS(unused));
|
||||
|
||||
#endif /* _TRACE_HOOK_HUNG_TASK_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
+11
-5
@@ -24,6 +24,7 @@
|
||||
#include <linux/sched/sysctl.h>
|
||||
|
||||
#include <trace/events/sched.h>
|
||||
#include <trace/hooks/hung_task.h>
|
||||
|
||||
/*
|
||||
* The number of tasks checked:
|
||||
@@ -183,6 +184,7 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
|
||||
int max_count = sysctl_hung_task_check_count;
|
||||
unsigned long last_break = jiffies;
|
||||
struct task_struct *g, *t;
|
||||
bool need_check = true;
|
||||
|
||||
/*
|
||||
* If the system crashed already then all bets are off,
|
||||
@@ -207,12 +209,16 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
|
||||
* skip the TASK_KILLABLE tasks -- these can be killed
|
||||
* skip the TASK_IDLE tasks -- those are genuinely idle
|
||||
*/
|
||||
state = READ_ONCE(t->__state);
|
||||
if ((state & TASK_UNINTERRUPTIBLE) &&
|
||||
!(state & TASK_WAKEKILL) &&
|
||||
!(state & TASK_NOLOAD))
|
||||
check_hung_task(t, timeout);
|
||||
trace_android_vh_check_uninterruptible_tasks(t, timeout, &need_check);
|
||||
if (need_check) {
|
||||
state = READ_ONCE(t->__state);
|
||||
if ((state & TASK_UNINTERRUPTIBLE) &&
|
||||
!(state & TASK_WAKEKILL) &&
|
||||
!(state & TASK_NOLOAD))
|
||||
check_hung_task(t, timeout);
|
||||
}
|
||||
}
|
||||
trace_android_vh_check_uninterruptible_tasks_dn(NULL);
|
||||
unlock:
|
||||
rcu_read_unlock();
|
||||
if (hung_task_show_lock)
|
||||
|
||||
Reference in New Issue
Block a user