ANDROID: mpam: add vendor hook to record MPAM

- To use MPAM in kernel task, vendor_hook call is needed to
  set MPAM at scheduling time.
- Vendor_hooks is call ed when task is switching for MPAM state

Bug: 165333282
Signed-off-by: C-J.Chen <C-J.Chen@mediatek.com>
Change-Id: I30270c667c26e1a7039580b33011665bb3a8cce7
This commit is contained in:
C-J.Chen 2020-08-18 08:38:07 +08:00
parent 8334d69e65
commit 1aa1f6a7cf
3 changed files with 32 additions and 0 deletions

View File

@ -44,6 +44,7 @@
#include <linux/thread_info.h>
#include <linux/prctl.h>
#include <trace/hooks/fpsimd.h>
#include <trace/hooks/mpam.h>
#include <asm/alternative.h>
#include <asm/arch_gicv3.h>
@ -560,6 +561,11 @@ __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev,
uao_thread_switch(next);
ssbs_thread_switch(next);
erratum_1418040_thread_switch(prev, next);
/*
* vendor hook is needed before the dsb(),
* because MPAM is related to cache maintenance.
*/
trace_android_vh_mpam_set(prev, next);
/*
* Complete any pending TLB or cache maintenance on this CPU in case

View File

@ -16,6 +16,7 @@
#include <trace/hooks/dtask.h>
#include <trace/hooks/cpuidle.h>
#include <trace/hooks/topology.h>
#include <trace/hooks/mpam.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@ -52,3 +53,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_write_wait_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_write_wait_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_show_task);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpu_idle);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mpam_set);

View File

@ -0,0 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM mpam
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_MPAM_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_MPAM_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
*/
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
struct task_struct;
DECLARE_HOOK(android_vh_mpam_set,
TP_PROTO(struct task_struct *prev, struct task_struct *next),
TP_ARGS(prev, next));
#else
#define trace_android_vh_mpam_set(prev, next)
#endif
#endif /* _TRACE_HOOK_MPAM_H */
/* This part must be outside protection */
#include <trace/define_trace.h>