ANDROID: power: Add vendor hook for suspend

The purpose of this vendor hook is to calculating
the total resume latency for device, CPU and
console, etc. Current vendor hook only supports
individual resume latency for device, each individual
CPU, etc, but lacking of the total resume latency tracing.

Bug: 232541623
Change-Id: Idd7c999dcd822cc0f7747baa11ec200eed5f5172
Signed-off-by: Sophia Wang <yodagump@google.com>
Signed-off-by: Rick Yiu <rickyiu@google.com>
This commit is contained in:
Rick Yiu 2023-10-18 07:07:48 +00:00 committed by Treehugger Robot
parent b783e85610
commit 0947464633
3 changed files with 34 additions and 0 deletions

View File

@ -68,6 +68,7 @@
#include <trace/hooks/bl_hib.h>
#include <trace/hooks/regmap.h>
#include <trace/hooks/compaction.h>
#include <trace/hooks/suspend.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
* associated with them) to allow external modules to probe them.
@ -346,4 +347,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_compaction_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_bus_iommu_probe);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rmqueue);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_early_resume_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_get_folio);

View File

@ -0,0 +1,26 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM suspend
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_SUSPEND_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_SUSPEND_H
#include <trace/hooks/vendor_hooks.h>
DECLARE_HOOK(android_vh_resume_begin,
TP_PROTO(void *unused),
TP_ARGS(unused))
DECLARE_HOOK(android_vh_resume_end,
TP_PROTO(void *unused),
TP_ARGS(unused))
DECLARE_HOOK(android_vh_early_resume_begin,
TP_PROTO(void *unused),
TP_ARGS(unused))
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_SUSPEND_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View File

@ -31,6 +31,7 @@
#include <linux/compiler.h>
#include <linux/moduleparam.h>
#include <linux/wakeup_reason.h>
#include <trace/hooks/suspend.h>
#include "power.h"
@ -460,6 +461,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
error = suspend_ops->enter(state);
trace_suspend_resume(TPS("machine_suspend"),
state, false);
trace_android_vh_early_resume_begin(NULL);
} else if (*wakeup) {
error = -EBUSY;
}
@ -528,6 +530,7 @@ int suspend_devices_and_enter(suspend_state_t state)
} while (!error && !wakeup && platform_suspend_again(state));
Resume_devices:
trace_android_vh_resume_begin(NULL);
suspend_test_start();
dpm_resume_end(PMSG_RESUME);
suspend_test_finish("resume devices");
@ -538,6 +541,7 @@ int suspend_devices_and_enter(suspend_state_t state)
Close:
platform_resume_end(state);
pm_suspend_target_state = PM_SUSPEND_ON;
trace_android_vh_resume_end(NULL);
return error;
Recover_platform: