ANDROID: vendor_hooks: add hook to record reboot reason

Add hook to record the reason for calling hw_protection_shutdown

Bug: 334006616
Change-Id: I9dce8056693c96f1d5f1fab9af02a2e68ed6ab91
Signed-off-by: Dezhi Huang <huangdezhi@hihonor.com>
(cherry picked from commit 70e95a10a553c0c530694b8939d25fbb984647d0)
This commit is contained in:
Dezhi Huang
2024-04-13 19:10:15 +08:00
committed by Treehugger Robot
parent 1167ff4e85
commit 8df1379d85
3 changed files with 24 additions and 0 deletions
+2
View File
@@ -37,6 +37,7 @@
#include <trace/hooks/gic.h>
#include <trace/hooks/gic_v3.h>
#include <trace/hooks/remoteproc.h>
#include <trace/hooks/reboot.h>
#include <trace/hooks/psci.h>
#include <trace/hooks/timer.h>
#include <trace/hooks/fpsimd.h>
@@ -130,6 +131,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_balance_anon_file_reclaim);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_show_max_freq);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_slab_alloc_node);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_slab_free);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_hw_protection_shutdown);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_avc_insert);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_avc_node_delete);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_selinux_avc_node_replace);
+18
View File
@@ -0,0 +1,18 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM reboot
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_REBOOT_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_REBOOT_H
#include <trace/hooks/vendor_hooks.h>
DECLARE_RESTRICTED_HOOK(android_rvh_hw_protection_shutdown,
TP_PROTO(const char *reason),
TP_ARGS(reason), 1);
#endif /* _TRACE_HOOK_REBOOT_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
+4
View File
@@ -19,6 +19,8 @@
#include <linux/syscore_ops.h>
#include <linux/uaccess.h>
#include <trace/hooks/reboot.h>
/*
* this indicates whether you can reboot with ctrl-alt-del: the default is yes
*/
@@ -998,6 +1000,8 @@ void __hw_protection_shutdown(const char *reason, int ms_until_forced, bool shut
if (!atomic_dec_and_test(&allow_proceed))
return;
trace_android_rvh_hw_protection_shutdown(reason);
/*
* Queue a backup emergency shutdown in the event of
* orderly_poweroff failure