ANDROID: cpu/hotplug: create vendor hook for cpu_up/cpu_down

Include a vendor hook for cpu_up and cpu_down to force the
rebuilding of scheduling domains prior to issuing a new
cpu up/down.  Include a Kernel Export for
cpuset_wait_for_hotplug such that vendor hooks may refer
to this functionality, to ensure scheduling domains are
complete.

Bug: 176152285
Change-Id: I778dbc5e4f9d613f39b8c61f244c0f33020a3dd3
Signed-off-by: Stephen Dickey <dickey@codeaurora.org>
This commit is contained in:
Stephen Dickey 2021-01-26 10:47:27 -08:00 committed by Todd Kjos
parent 32c13ae5ff
commit f7d52eda9f
4 changed files with 32 additions and 0 deletions

View File

@ -9,6 +9,7 @@
#define CREATE_TRACE_POINTS
#include <trace/hooks/vendor_hooks.h>
#include <trace/hooks/sched.h>
#include <trace/hooks/cpu.h>
#include <trace/hooks/fpsimd.h>
#include <trace/hooks/binder.h>
#include <trace/hooks/rwsem.h>
@ -133,3 +134,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_allow_domain_state);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_report_bug);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_em_cpu_energy);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpu_up);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpu_down);

23
include/trace/hooks/cpu.h Normal file
View File

@ -0,0 +1,23 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM cpu
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_CPU_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_CPU_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
/*
* Following tracepoints are not exported in tracefs and provide a
* mechanism for vendor modules to hook and extend functionality
*/
DECLARE_HOOK(android_vh_cpu_up,
TP_PROTO(void *unused),
TP_ARGS(unused));
DECLARE_HOOK(android_vh_cpu_down,
TP_PROTO(void *unused),
TP_ARGS(unused));
#endif /* _TRACE_HOOK_CPU_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View File

@ -3261,6 +3261,7 @@ void cpuset_wait_for_hotplug(void)
{
flush_work(&cpuset_hotplug_work);
}
EXPORT_SYMBOL_GPL(cpuset_wait_for_hotplug);
/*
* Keep top_cpuset.mems_allowed tracking node_states[N_MEMORY].

View File

@ -41,6 +41,7 @@
#undef CREATE_TRACE_POINTS
#include <trace/hooks/sched.h>
#include <trace/hooks/cpu.h>
#include "smpboot.h"
@ -1070,6 +1071,8 @@ static int cpu_down(unsigned int cpu, enum cpuhp_state target)
{
int err;
trace_android_vh_cpu_down(NULL);
cpu_maps_update_begin();
err = cpu_down_maps_locked(cpu, target);
cpu_maps_update_done();
@ -1499,6 +1502,8 @@ static int cpu_up(unsigned int cpu, enum cpuhp_state target)
return -EINVAL;
}
trace_android_vh_cpu_up(NULL);
/*
* CPU hotplug operations consists of many steps and each step
* calls a callback of core kernel subsystem. CPU hotplug-in