ANDROID: PM / Domains: add vendor_hook to disallow domain idle state

In order to debug critical domain and device power issues, it may be
necessary to disallow certain idle states at runtime. Enable a vendor
hook to check if a domain idle state is allowed for powering down the
domain.

Bug: 175718935
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
Change-Id: I403c0c7d272439fb338bbf54a346861559385047
This commit is contained in:
Lina Iyer
2021-01-12 10:26:57 -07:00
committed by Todd Kjos
parent bdc24c6aec
commit 35e4214e99
3 changed files with 36 additions and 0 deletions

View File

@@ -28,6 +28,7 @@
#include <trace/hooks/mm.h>
#include <trace/hooks/preemptirq.h>
#include <trace/hooks/ftrace_dump.h>
#include <trace/hooks/pm_domain.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -126,3 +127,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ftrace_oops_exit);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ftrace_size_check);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ftrace_format_check);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ftrace_dump_buffer);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_allow_domain_state);

View File

@@ -12,6 +12,8 @@
#include <linux/cpumask.h>
#include <linux/ktime.h>
#include <trace/hooks/pm_domain.h>
static int dev_update_qos_constraint(struct device *dev, void *data)
{
s64 *constraint_ns_p = data;
@@ -174,6 +176,11 @@ static bool __default_power_down_ok(struct dev_pm_domain *pd,
struct pm_domain_data *pdd;
s64 min_off_time_ns;
s64 off_on_time_ns;
bool allow = true;
trace_android_vh_allow_domain_state(genpd, state, &allow);
if (!allow)
return false;
off_on_time_ns = genpd->states[state].power_off_latency_ns +
genpd->states[state].power_on_latency_ns;

View File

@@ -0,0 +1,27 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM pm_domain
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_PM_DOMAIN_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_PM_DOMAIN_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
struct generic_pm_domain;
DECLARE_HOOK(android_vh_allow_domain_state,
TP_PROTO(struct generic_pm_domain *genpd, uint32_t idx, bool *allow),
TP_ARGS(genpd, idx, allow))
#else
#define trace_android_vh_allow_domain_state(genpd, idx, allow)
#endif
#endif /* _TRACE_HOOK_PM_DOMAIN_H */
#include <trace/define_trace.h>