- HW support updates:
- Add uncore support for Intel Comet Lake
- Add RAPL support for Hygon Fam18h
- Add Intel "IIO stack to PMON mapping" support on Skylake-SP CPUs,
which enumerates per device performance counters via sysfs and enables
the perf stat --iiostat functionality
- Add support for Intel "Architectural LBRs", which generalized the model
specific LBR hardware tracing feature into a model-independent, architected
performance monitoring feature. Usage is mostly seamless to tooling, as the
pre-existing LBR features are kept, but there's a couple of advantages
under the hood, such as faster context-switching, faster LBR reads,
cleaner exposure of LBR features to guest kernels, etc.
( Since architectural LBRs are supported via XSAVE, there's related
changes to the x86 FPU code as well. )
- ftrace/perf updates: Add support to add a text poke event to record changes
to kernel text (i.e. self-modifying code) in order to
support tracers like Intel PT decoding through
jump labels, kprobes and ftrace trampolines.
- Misc cleanups, smaller fixes.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-----BEGIN PGP SIGNATURE-----
iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAl8oAgcRHG1pbmdvQGtl
cm5lbC5vcmcACgkQEnMQ0APhK1gcSA/9EwKeLF03jkEXwzF/a/YhCxZXODH/klz/
5D/Li+0HJy9TTVQWaSOxu31VcnWyAPER97aRjHohNMrAFKpAC4GwzxF2fjKUzzKJ
eoWIgXvtlMM+nQb93UTB2+9Z3eHBEpKsqP8oc6qeXa74b2p3WfmvFRPBWFuzmOlH
nb26F/Cu46HTEUfWvggU9flS0HpkdZ8X2Rt14sRwq5Gi2Wa/5+ygaksD+5nwRlGM
r7jBrZBDTOGhy7HjrjpDPif056YU31giKmMQ/j17h1NaT3ciyXYSi0FuKEghDCII
2OFyH0wZ1vsp63GISosIKFLFoBmOd4He4/sKjdtOtnosan250t3/ZDH/7tw6Rq2V
tf1o/dMbDmV9v0lAVBZO76Z74ZQbk3+TvFxyDwtBSQYBe2eVfNz0VY4YjSRlRIp0
1nIbJqiMLa7uquL2K4zZKapt7qsMaVqLO4YUVTzYPvv3luAqFLvC83a2+hapz4cs
w4nET8lpWanUBK0hidQe1J6NPM4v1mnsvuZfM0p/QwKN9uvV5KoT6YJhRqfTy51g
je+G80q0XqOH0H8x9iWuLiJe0G72UyhRqzSTxg+Cjj9cAhnsFPFLCNMWSVHqioLP
JXGQiTp+6SQM6JDXkj5F8InsyT4KfzqizMSnAaH+6bsv9iQKDL4AbD7r92g6nbN9
PP43QQh23Fg=
=4pKU
-----END PGP SIGNATURE-----
Merge tag 'perf-core-2020-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf event updates from Ingo Molnar:
"HW support updates:
- Add uncore support for Intel Comet Lake
- Add RAPL support for Hygon Fam18h
- Add Intel "IIO stack to PMON mapping" support on Skylake-SP CPUs,
which enumerates per device performance counters via sysfs and
enables the perf stat --iiostat functionality
- Add support for Intel "Architectural LBRs", which generalized the
model specific LBR hardware tracing feature into a
model-independent, architected performance monitoring feature.
Usage is mostly seamless to tooling, as the pre-existing LBR
features are kept, but there's a couple of advantages under the
hood, such as faster context-switching, faster LBR reads, cleaner
exposure of LBR features to guest kernels, etc.
( Since architectural LBRs are supported via XSAVE, there's related
changes to the x86 FPU code as well. )
ftrace/perf updates:
- Add support to add a text poke event to record changes to kernel
text (i.e. self-modifying code) in order to support tracers like
Intel PT decoding through jump labels, kprobes and ftrace
trampolines.
Misc cleanups, smaller fixes..."
* tag 'perf-core-2020-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (47 commits)
perf/x86/rapl: Add Hygon Fam18h RAPL support
kprobes: Remove unnecessary module_mutex locking from kprobe_optimizer()
x86/perf: Fix a typo
perf: <linux/perf_event.h>: drop a duplicated word
perf/x86/intel/lbr: Support XSAVES for arch LBR read
perf/x86/intel/lbr: Support XSAVES/XRSTORS for LBR context switch
x86/fpu/xstate: Add helpers for LBR dynamic supervisor feature
x86/fpu/xstate: Support dynamic supervisor feature for LBR
x86/fpu: Use proper mask to replace full instruction mask
perf/x86: Remove task_ctx_size
perf/x86/intel/lbr: Create kmem_cache for the LBR context data
perf/core: Use kmem_cache to allocate the PMU specific data
perf/core: Factor out functions to allocate/free the task_ctx_data
perf/x86/intel/lbr: Support Architectural LBR
perf/x86/intel/lbr: Factor out intel_pmu_store_lbr
perf/x86/intel/lbr: Factor out rdlbr_all() and wrlbr_all()
perf/x86/intel/lbr: Mark the {rd,wr}lbr_{to,from} wrappers __always_inline
perf/x86/intel/lbr: Unify the stored format of LBR information
perf/x86/intel/lbr: Support LBR_CTL
perf/x86: Expose CPUID enumeration bits for arch LBR
...
This commit is contained in:
commit
b34133fec8
32 changed files with 1943 additions and 280 deletions
|
|
@ -2764,6 +2764,50 @@ void __weak arch_ftrace_trampoline_free(struct ftrace_ops *ops)
|
|||
{
|
||||
}
|
||||
|
||||
/* List of trace_ops that have allocated trampolines */
|
||||
static LIST_HEAD(ftrace_ops_trampoline_list);
|
||||
|
||||
static void ftrace_add_trampoline_to_kallsyms(struct ftrace_ops *ops)
|
||||
{
|
||||
lockdep_assert_held(&ftrace_lock);
|
||||
list_add_rcu(&ops->list, &ftrace_ops_trampoline_list);
|
||||
}
|
||||
|
||||
static void ftrace_remove_trampoline_from_kallsyms(struct ftrace_ops *ops)
|
||||
{
|
||||
lockdep_assert_held(&ftrace_lock);
|
||||
list_del_rcu(&ops->list);
|
||||
}
|
||||
|
||||
/*
|
||||
* "__builtin__ftrace" is used as a module name in /proc/kallsyms for symbols
|
||||
* for pages allocated for ftrace purposes, even though "__builtin__ftrace" is
|
||||
* not a module.
|
||||
*/
|
||||
#define FTRACE_TRAMPOLINE_MOD "__builtin__ftrace"
|
||||
#define FTRACE_TRAMPOLINE_SYM "ftrace_trampoline"
|
||||
|
||||
static void ftrace_trampoline_free(struct ftrace_ops *ops)
|
||||
{
|
||||
if (ops && (ops->flags & FTRACE_OPS_FL_ALLOC_TRAMP) &&
|
||||
ops->trampoline) {
|
||||
/*
|
||||
* Record the text poke event before the ksymbol unregister
|
||||
* event.
|
||||
*/
|
||||
perf_event_text_poke((void *)ops->trampoline,
|
||||
(void *)ops->trampoline,
|
||||
ops->trampoline_size, NULL, 0);
|
||||
perf_event_ksymbol(PERF_RECORD_KSYMBOL_TYPE_OOL,
|
||||
ops->trampoline, ops->trampoline_size,
|
||||
true, FTRACE_TRAMPOLINE_SYM);
|
||||
/* Remove from kallsyms after the perf events */
|
||||
ftrace_remove_trampoline_from_kallsyms(ops);
|
||||
}
|
||||
|
||||
arch_ftrace_trampoline_free(ops);
|
||||
}
|
||||
|
||||
static void ftrace_startup_enable(int command)
|
||||
{
|
||||
if (saved_ftrace_func != ftrace_trace_function) {
|
||||
|
|
@ -2934,7 +2978,7 @@ int ftrace_shutdown(struct ftrace_ops *ops, int command)
|
|||
synchronize_rcu_tasks();
|
||||
|
||||
free_ops:
|
||||
arch_ftrace_trampoline_free(ops);
|
||||
ftrace_trampoline_free(ops);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -6178,6 +6222,27 @@ struct ftrace_mod_map {
|
|||
unsigned int num_funcs;
|
||||
};
|
||||
|
||||
static int ftrace_get_trampoline_kallsym(unsigned int symnum,
|
||||
unsigned long *value, char *type,
|
||||
char *name, char *module_name,
|
||||
int *exported)
|
||||
{
|
||||
struct ftrace_ops *op;
|
||||
|
||||
list_for_each_entry_rcu(op, &ftrace_ops_trampoline_list, list) {
|
||||
if (!op->trampoline || symnum--)
|
||||
continue;
|
||||
*value = op->trampoline;
|
||||
*type = 't';
|
||||
strlcpy(name, FTRACE_TRAMPOLINE_SYM, KSYM_NAME_LEN);
|
||||
strlcpy(module_name, FTRACE_TRAMPOLINE_MOD, MODULE_NAME_LEN);
|
||||
*exported = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -ERANGE;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MODULES
|
||||
|
||||
#define next_to_ftrace_page(p) container_of(p, struct ftrace_page, next)
|
||||
|
|
@ -6514,6 +6579,7 @@ int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *value,
|
|||
{
|
||||
struct ftrace_mod_map *mod_map;
|
||||
struct ftrace_mod_func *mod_func;
|
||||
int ret;
|
||||
|
||||
preempt_disable();
|
||||
list_for_each_entry_rcu(mod_map, &ftrace_mod_maps, list) {
|
||||
|
|
@ -6540,8 +6606,10 @@ int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *value,
|
|||
WARN_ON(1);
|
||||
break;
|
||||
}
|
||||
ret = ftrace_get_trampoline_kallsym(symnum, value, type, name,
|
||||
module_name, exported);
|
||||
preempt_enable();
|
||||
return -ERANGE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
@ -6553,6 +6621,18 @@ allocate_ftrace_mod_map(struct module *mod,
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *value,
|
||||
char *type, char *name, char *module_name,
|
||||
int *exported)
|
||||
{
|
||||
int ret;
|
||||
|
||||
preempt_disable();
|
||||
ret = ftrace_get_trampoline_kallsym(symnum, value, type, name,
|
||||
module_name, exported);
|
||||
preempt_enable();
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_MODULES */
|
||||
|
||||
struct ftrace_init_func {
|
||||
|
|
@ -6733,7 +6813,24 @@ void __weak arch_ftrace_update_trampoline(struct ftrace_ops *ops)
|
|||
|
||||
static void ftrace_update_trampoline(struct ftrace_ops *ops)
|
||||
{
|
||||
unsigned long trampoline = ops->trampoline;
|
||||
|
||||
arch_ftrace_update_trampoline(ops);
|
||||
if (ops->trampoline && ops->trampoline != trampoline &&
|
||||
(ops->flags & FTRACE_OPS_FL_ALLOC_TRAMP)) {
|
||||
/* Add to kallsyms before the perf events */
|
||||
ftrace_add_trampoline_to_kallsyms(ops);
|
||||
perf_event_ksymbol(PERF_RECORD_KSYMBOL_TYPE_OOL,
|
||||
ops->trampoline, ops->trampoline_size, false,
|
||||
FTRACE_TRAMPOLINE_SYM);
|
||||
/*
|
||||
* Record the perf text poke event after the ksymbol register
|
||||
* event.
|
||||
*/
|
||||
perf_event_text_poke((void *)ops->trampoline, NULL, 0,
|
||||
(void *)ops->trampoline,
|
||||
ops->trampoline_size);
|
||||
}
|
||||
}
|
||||
|
||||
void ftrace_init_trace_array(struct trace_array *tr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue