Skip to content

Commit e097291

Browse files
committed
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar: "Features: - Add "uretprobes" - an optimization to uprobes, like kretprobes are an optimization to kprobes. "perf probe -x file sym%return" now works like kretprobes. By Oleg Nesterov. - Introduce per core aggregation in 'perf stat', from Stephane Eranian. - Add memory profiling via PEBS, from Stephane Eranian. - Event group view for 'annotate' in --stdio, --tui and --gtk, from Namhyung Kim. - Add support for AMD NB and L2I "uncore" counters, by Jacob Shin. - Add Ivy Bridge-EP uncore support, by Zheng Yan - IBM zEnterprise EC12 oprofile support patchlet from Robert Richter. - Add perf test entries for checking breakpoint overflow signal handler issues, from Jiri Olsa. - Add perf test entry for for checking number of EXIT events, from Namhyung Kim. - Add perf test entries for checking --cpu in record and stat, from Jiri Olsa. - Introduce perf stat --repeat forever, from Frederik Deweerdt. - Add --no-demangle to report/top, from Namhyung Kim. - PowerPC fixes plus a couple of cleanups/optimizations in uprobes and trace_uprobes, by Oleg Nesterov. Various fixes and refactorings: - Fix dependency of the python binding wrt libtraceevent, from Naohiro Aota. - Simplify some perf_evlist methods and to allow 'stat' to share code with 'record' and 'trace', by Arnaldo Carvalho de Melo. - Remove dead code in related to libtraceevent integration, from Namhyung Kim. - Revert "perf sched: Handle PERF_RECORD_EXIT events" to get 'perf sched lat' back working, by Arnaldo Carvalho de Melo - We don't use Newt anymore, just plain libslang, by Arnaldo Carvalho de Melo. - Kill a bunch of die() calls, from Namhyung Kim. - Fix build on non-glibc systems due to libio.h absence, from Cody P Schafer. - Remove some perf_session and tracing dead code, from David Ahern. - Honor parallel jobs, fix from Borislav Petkov - Introduce tools/lib/lk library, initially just removing duplication among tools/perf and tools/vm. from Borislav Petkov ... and many more I missed to list, see the shortlog and git log for more details." * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (136 commits) perf/x86/intel/P4: Robistify P4 PMU types perf/x86/amd: Fix AMD NB and L2I "uncore" support perf/x86/amd: Remove old-style NB counter support from perf_event_amd.c perf/x86: Check all MSRs before passing hw check perf/x86/amd: Add support for AMD NB and L2I "uncore" counters perf/x86/intel: Add Ivy Bridge-EP uncore support perf/x86/intel: Fix SNB-EP CBO and PCU uncore PMU filter management perf/x86: Avoid kfree() in CPU_{STARTING,DYING} uprobes/perf: Avoid perf_trace_buf_prepare/submit if ->perf_events is empty uprobes/tracing: Don't pass addr=ip to perf_trace_buf_submit() uprobes/tracing: Change create_trace_uprobe() to support uretprobes uprobes/tracing: Make seq_printf() code uretprobe-friendly uprobes/tracing: Make register_uprobe_event() paths uretprobe-friendly uprobes/tracing: Make uprobe_{trace,perf}_print() uretprobe-friendly uprobes/tracing: Introduce is_ret_probe() and uretprobe_dispatcher() uprobes/tracing: Introduce uprobe_{trace,perf}_print() helpers uprobes/tracing: Generalize struct uprobe_trace_entry_head uprobes/tracing: Kill the pointless local_save_flags/preempt_count calls uprobes/tracing: Kill the pointless seq_print_ip_sym() call uprobes/tracing: Kill the pointless task_pt_regs() calls ...
2 parents 1f889ec + 5ac2b5c commit e097291

130 files changed

Lines changed: 5670 additions & 1708 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 67 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
Uprobe-tracer: Uprobe-based Event Tracing
2-
=========================================
3-
Documentation written by Srikar Dronamraju
1+
Uprobe-tracer: Uprobe-based Event Tracing
2+
=========================================
3+
4+
Documentation written by Srikar Dronamraju
5+
46

57
Overview
68
--------
@@ -13,78 +15,94 @@ current_tracer. Instead of that, add probe points via
1315
/sys/kernel/debug/tracing/events/uprobes/<EVENT>/enabled.
1416

1517
However unlike kprobe-event tracer, the uprobe event interface expects the
16-
user to calculate the offset of the probepoint in the object
18+
user to calculate the offset of the probepoint in the object.
1719

1820
Synopsis of uprobe_tracer
1921
-------------------------
20-
p[:[GRP/]EVENT] PATH:SYMBOL[+offs] [FETCHARGS] : Set a probe
22+
p[:[GRP/]EVENT] PATH:SYMBOL[+offs] [FETCHARGS] : Set a uprobe
23+
r[:[GRP/]EVENT] PATH:SYMBOL[+offs] [FETCHARGS] : Set a return uprobe (uretprobe)
24+
-:[GRP/]EVENT : Clear uprobe or uretprobe event
2125

22-
GRP : Group name. If omitted, use "uprobes" for it.
23-
EVENT : Event name. If omitted, the event name is generated
24-
based on SYMBOL+offs.
25-
PATH : path to an executable or a library.
26-
SYMBOL[+offs] : Symbol+offset where the probe is inserted.
26+
GRP : Group name. If omitted, "uprobes" is the default value.
27+
EVENT : Event name. If omitted, the event name is generated based
28+
on SYMBOL+offs.
29+
PATH : Path to an executable or a library.
30+
SYMBOL[+offs] : Symbol+offset where the probe is inserted.
2731

28-
FETCHARGS : Arguments. Each probe can have up to 128 args.
29-
%REG : Fetch register REG
32+
FETCHARGS : Arguments. Each probe can have up to 128 args.
33+
%REG : Fetch register REG
3034

3135
Event Profiling
3236
---------------
33-
You can check the total number of probe hits and probe miss-hits via
37+
You can check the total number of probe hits and probe miss-hits via
3438
/sys/kernel/debug/tracing/uprobe_profile.
35-
The first column is event name, the second is the number of probe hits,
39+
The first column is event name, the second is the number of probe hits,
3640
the third is the number of probe miss-hits.
3741

3842
Usage examples
3943
--------------
40-
To add a probe as a new event, write a new definition to uprobe_events
41-
as below.
44+
* Add a probe as a new uprobe event, write a new definition to uprobe_events
45+
as below: (sets a uprobe at an offset of 0x4245c0 in the executable /bin/bash)
46+
47+
echo 'p: /bin/bash:0x4245c0' > /sys/kernel/debug/tracing/uprobe_events
48+
49+
* Add a probe as a new uretprobe event:
50+
51+
echo 'r: /bin/bash:0x4245c0' > /sys/kernel/debug/tracing/uprobe_events
52+
53+
* Unset registered event:
4254

43-
echo 'p: /bin/bash:0x4245c0' > /sys/kernel/debug/tracing/uprobe_events
55+
echo '-:bash_0x4245c0' >> /sys/kernel/debug/tracing/uprobe_events
4456

45-
This sets a uprobe at an offset of 0x4245c0 in the executable /bin/bash
57+
* Print out the events that are registered:
4658

47-
echo > /sys/kernel/debug/tracing/uprobe_events
59+
cat /sys/kernel/debug/tracing/uprobe_events
4860

49-
This clears all probe points.
61+
* Clear all events:
5062

51-
The following example shows how to dump the instruction pointer and %ax
52-
a register at the probed text address. Here we are trying to probe
53-
function zfree in /bin/zsh
63+
echo > /sys/kernel/debug/tracing/uprobe_events
64+
65+
Following example shows how to dump the instruction pointer and %ax register
66+
at the probed text address. Probe zfree function in /bin/zsh:
5467

5568
# cd /sys/kernel/debug/tracing/
56-
# cat /proc/`pgrep zsh`/maps | grep /bin/zsh | grep r-xp
69+
# cat /proc/`pgrep zsh`/maps | grep /bin/zsh | grep r-xp
5770
00400000-0048a000 r-xp 00000000 08:03 130904 /bin/zsh
5871
# objdump -T /bin/zsh | grep -w zfree
5972
0000000000446420 g DF .text 0000000000000012 Base zfree
6073

61-
0x46420 is the offset of zfree in object /bin/zsh that is loaded at
62-
0x00400000. Hence the command to probe would be :
74+
0x46420 is the offset of zfree in object /bin/zsh that is loaded at
75+
0x00400000. Hence the command to uprobe would be:
76+
77+
# echo 'p:zfree_entry /bin/zsh:0x46420 %ip %ax' > uprobe_events
78+
79+
And the same for the uretprobe would be:
6380

64-
# echo 'p /bin/zsh:0x46420 %ip %ax' > uprobe_events
81+
# echo 'r:zfree_exit /bin/zsh:0x46420 %ip %ax' >> uprobe_events
6582

66-
Please note: User has to explicitly calculate the offset of the probepoint
83+
Please note: User has to explicitly calculate the offset of the probe-point
6784
in the object. We can see the events that are registered by looking at the
6885
uprobe_events file.
6986

7087
# cat uprobe_events
71-
p:uprobes/p_zsh_0x46420 /bin/zsh:0x00046420 arg1=%ip arg2=%ax
88+
p:uprobes/zfree_entry /bin/zsh:0x00046420 arg1=%ip arg2=%ax
89+
r:uprobes/zfree_exit /bin/zsh:0x00046420 arg1=%ip arg2=%ax
7290

73-
The format of events can be seen by viewing the file events/uprobes/p_zsh_0x46420/format
91+
Format of events can be seen by viewing the file events/uprobes/zfree_entry/format
7492

75-
# cat events/uprobes/p_zsh_0x46420/format
76-
name: p_zsh_0x46420
93+
# cat events/uprobes/zfree_entry/format
94+
name: zfree_entry
7795
ID: 922
7896
format:
79-
field:unsigned short common_type; offset:0; size:2; signed:0;
80-
field:unsigned char common_flags; offset:2; size:1; signed:0;
81-
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
82-
field:int common_pid; offset:4; size:4; signed:1;
83-
field:int common_padding; offset:8; size:4; signed:1;
97+
field:unsigned short common_type; offset:0; size:2; signed:0;
98+
field:unsigned char common_flags; offset:2; size:1; signed:0;
99+
field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
100+
field:int common_pid; offset:4; size:4; signed:1;
101+
field:int common_padding; offset:8; size:4; signed:1;
84102

85-
field:unsigned long __probe_ip; offset:12; size:4; signed:0;
86-
field:u32 arg1; offset:16; size:4; signed:0;
87-
field:u32 arg2; offset:20; size:4; signed:0;
103+
field:unsigned long __probe_ip; offset:12; size:4; signed:0;
104+
field:u32 arg1; offset:16; size:4; signed:0;
105+
field:u32 arg2; offset:20; size:4; signed:0;
88106

89107
print fmt: "(%lx) arg1=%lx arg2=%lx", REC->__probe_ip, REC->arg1, REC->arg2
90108

@@ -94,6 +112,7 @@ events, you need to enable it by:
94112
# echo 1 > events/uprobes/enable
95113

96114
Lets disable the event after sleeping for some time.
115+
97116
# sleep 20
98117
# echo 0 > events/uprobes/enable
99118

@@ -104,10 +123,11 @@ And you can see the traced information via /sys/kernel/debug/tracing/trace.
104123
#
105124
# TASK-PID CPU# TIMESTAMP FUNCTION
106125
# | | | | |
107-
zsh-24842 [006] 258544.995456: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79
108-
zsh-24842 [007] 258545.000270: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79
109-
zsh-24842 [002] 258545.043929: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79
110-
zsh-24842 [004] 258547.046129: p_zsh_0x46420: (0x446420) arg1=446421 arg2=79
111-
112-
Each line shows us probes were triggered for a pid 24842 with ip being
113-
0x446421 and contents of ax register being 79.
126+
zsh-24842 [006] 258544.995456: zfree_entry: (0x446420) arg1=446420 arg2=79
127+
zsh-24842 [007] 258545.000270: zfree_exit: (0x446540 <- 0x446420) arg1=446540 arg2=0
128+
zsh-24842 [002] 258545.043929: zfree_entry: (0x446420) arg1=446420 arg2=79
129+
zsh-24842 [004] 258547.046129: zfree_exit: (0x446540 <- 0x446420) arg1=446540 arg2=0
130+
131+
Output shows us uprobe was triggered for a pid 24842 with ip being 0x446420
132+
and contents of ax register being 79. And uretprobe was triggered with ip at
133+
0x446540 with counterpart function entry at 0x446420.

‎Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,11 +1332,11 @@ kernelversion:
13321332
# Clear a bunch of variables before executing the submake
13331333
tools/: FORCE
13341334
$(Q)mkdir -p $(objtree)/tools
1335-
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/
1335+
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(objtree) subdir=tools -C $(src)/tools/
13361336

13371337
tools/%: FORCE
13381338
$(Q)mkdir -p $(objtree)/tools
1339-
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ $*
1339+
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(objtree) subdir=tools -C $(src)/tools/ $*
13401340

13411341
# Single targets
13421342
# ---------------------------------------------------------------------------

‎arch/powerpc/include/asm/uprobes.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,5 @@ extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
5151
extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
5252
extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
5353
extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
54+
extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
5455
#endif /* _ASM_UPROBES_H */

‎arch/powerpc/kernel/uprobes.c‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@
3030

3131
#define UPROBE_TRAP_NR UINT_MAX
3232

33+
/**
34+
* is_trap_insn - check if the instruction is a trap variant
35+
* @insn: instruction to be checked.
36+
* Returns true if @insn is a trap variant.
37+
*/
38+
bool is_trap_insn(uprobe_opcode_t *insn)
39+
{
40+
return (is_trap(*insn));
41+
}
42+
3343
/**
3444
* arch_uprobe_analyze_insn
3545
* @mm: the probed address space.
@@ -43,12 +53,6 @@ int arch_uprobe_analyze_insn(struct arch_uprobe *auprobe,
4353
if (addr & 0x03)
4454
return -EINVAL;
4555

46-
/*
47-
* We currently don't support a uprobe on an already
48-
* existing breakpoint instruction underneath
49-
*/
50-
if (is_trap(auprobe->ainsn))
51-
return -ENOTSUPP;
5256
return 0;
5357
}
5458

@@ -188,3 +192,16 @@ bool arch_uprobe_skip_sstep(struct arch_uprobe *auprobe, struct pt_regs *regs)
188192

189193
return false;
190194
}
195+
196+
unsigned long
197+
arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs)
198+
{
199+
unsigned long orig_ret_vaddr;
200+
201+
orig_ret_vaddr = regs->link;
202+
203+
/* Replace the return addr with trampoline addr */
204+
regs->link = trampoline_vaddr;
205+
206+
return orig_ret_vaddr;
207+
}

‎arch/s390/oprofile/init.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ static int oprofile_hwsampler_init(struct oprofile_operations *ops)
440440
switch (id.machine) {
441441
case 0x2097: case 0x2098: ops->cpu_type = "s390/z10"; break;
442442
case 0x2817: case 0x2818: ops->cpu_type = "s390/z196"; break;
443+
case 0x2827: ops->cpu_type = "s390/zEC12"; break;
443444
default: return -ENODEV;
444445
}
445446
}

‎arch/x86/include/asm/cpufeature.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
#define X86_FEATURE_TOPOEXT (6*32+22) /* topology extensions CPUID leafs */
169169
#define X86_FEATURE_PERFCTR_CORE (6*32+23) /* core performance counter extensions */
170170
#define X86_FEATURE_PERFCTR_NB (6*32+24) /* NB performance counter extensions */
171+
#define X86_FEATURE_PERFCTR_L2 (6*32+28) /* L2 performance counter extensions */
171172

172173
/*
173174
* Auxiliary flags: Linux defined - For features scattered in various
@@ -311,6 +312,7 @@ extern const char * const x86_power_flags[32];
311312
#define cpu_has_pclmulqdq boot_cpu_has(X86_FEATURE_PCLMULQDQ)
312313
#define cpu_has_perfctr_core boot_cpu_has(X86_FEATURE_PERFCTR_CORE)
313314
#define cpu_has_perfctr_nb boot_cpu_has(X86_FEATURE_PERFCTR_NB)
315+
#define cpu_has_perfctr_l2 boot_cpu_has(X86_FEATURE_PERFCTR_L2)
314316
#define cpu_has_cx8 boot_cpu_has(X86_FEATURE_CX8)
315317
#define cpu_has_cx16 boot_cpu_has(X86_FEATURE_CX16)
316318
#define cpu_has_eager_fpu boot_cpu_has(X86_FEATURE_EAGER_FPU)

‎arch/x86/include/asm/perf_event_p4.h‎

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,45 +24,45 @@
2424
#define ARCH_P4_CNTRVAL_MASK ((1ULL << ARCH_P4_CNTRVAL_BITS) - 1)
2525
#define ARCH_P4_UNFLAGGED_BIT ((1ULL) << (ARCH_P4_CNTRVAL_BITS - 1))
2626

27-
#define P4_ESCR_EVENT_MASK 0x7e000000U
27+
#define P4_ESCR_EVENT_MASK 0x7e000000ULL
2828
#define P4_ESCR_EVENT_SHIFT 25
29-
#define P4_ESCR_EVENTMASK_MASK 0x01fffe00U
29+
#define P4_ESCR_EVENTMASK_MASK 0x01fffe00ULL
3030
#define P4_ESCR_EVENTMASK_SHIFT 9
31-
#define P4_ESCR_TAG_MASK 0x000001e0U
31+
#define P4_ESCR_TAG_MASK 0x000001e0ULL
3232
#define P4_ESCR_TAG_SHIFT 5
33-
#define P4_ESCR_TAG_ENABLE 0x00000010U
34-
#define P4_ESCR_T0_OS 0x00000008U
35-
#define P4_ESCR_T0_USR 0x00000004U
36-
#define P4_ESCR_T1_OS 0x00000002U
37-
#define P4_ESCR_T1_USR 0x00000001U
33+
#define P4_ESCR_TAG_ENABLE 0x00000010ULL
34+
#define P4_ESCR_T0_OS 0x00000008ULL
35+
#define P4_ESCR_T0_USR 0x00000004ULL
36+
#define P4_ESCR_T1_OS 0x00000002ULL
37+
#define P4_ESCR_T1_USR 0x00000001ULL
3838

3939
#define P4_ESCR_EVENT(v) ((v) << P4_ESCR_EVENT_SHIFT)
4040
#define P4_ESCR_EMASK(v) ((v) << P4_ESCR_EVENTMASK_SHIFT)
4141
#define P4_ESCR_TAG(v) ((v) << P4_ESCR_TAG_SHIFT)
4242

43-
#define P4_CCCR_OVF 0x80000000U
44-
#define P4_CCCR_CASCADE 0x40000000U
45-
#define P4_CCCR_OVF_PMI_T0 0x04000000U
46-
#define P4_CCCR_OVF_PMI_T1 0x08000000U
47-
#define P4_CCCR_FORCE_OVF 0x02000000U
48-
#define P4_CCCR_EDGE 0x01000000U
49-
#define P4_CCCR_THRESHOLD_MASK 0x00f00000U
43+
#define P4_CCCR_OVF 0x80000000ULL
44+
#define P4_CCCR_CASCADE 0x40000000ULL
45+
#define P4_CCCR_OVF_PMI_T0 0x04000000ULL
46+
#define P4_CCCR_OVF_PMI_T1 0x08000000ULL
47+
#define P4_CCCR_FORCE_OVF 0x02000000ULL
48+
#define P4_CCCR_EDGE 0x01000000ULL
49+
#define P4_CCCR_THRESHOLD_MASK 0x00f00000ULL
5050
#define P4_CCCR_THRESHOLD_SHIFT 20
51-
#define P4_CCCR_COMPLEMENT 0x00080000U
52-
#define P4_CCCR_COMPARE 0x00040000U
53-
#define P4_CCCR_ESCR_SELECT_MASK 0x0000e000U
51+
#define P4_CCCR_COMPLEMENT 0x00080000ULL
52+
#define P4_CCCR_COMPARE 0x00040000ULL
53+
#define P4_CCCR_ESCR_SELECT_MASK 0x0000e000ULL
5454
#define P4_CCCR_ESCR_SELECT_SHIFT 13
55-
#define P4_CCCR_ENABLE 0x00001000U
56-
#define P4_CCCR_THREAD_SINGLE 0x00010000U
57-
#define P4_CCCR_THREAD_BOTH 0x00020000U
58-
#define P4_CCCR_THREAD_ANY 0x00030000U
59-
#define P4_CCCR_RESERVED 0x00000fffU
55+
#define P4_CCCR_ENABLE 0x00001000ULL
56+
#define P4_CCCR_THREAD_SINGLE 0x00010000ULL
57+
#define P4_CCCR_THREAD_BOTH 0x00020000ULL
58+
#define P4_CCCR_THREAD_ANY 0x00030000ULL
59+
#define P4_CCCR_RESERVED 0x00000fffULL
6060

6161
#define P4_CCCR_THRESHOLD(v) ((v) << P4_CCCR_THRESHOLD_SHIFT)
6262
#define P4_CCCR_ESEL(v) ((v) << P4_CCCR_ESCR_SELECT_SHIFT)
6363

6464
#define P4_GEN_ESCR_EMASK(class, name, bit) \
65-
class##__##name = ((1 << bit) << P4_ESCR_EVENTMASK_SHIFT)
65+
class##__##name = ((1ULL << bit) << P4_ESCR_EVENTMASK_SHIFT)
6666
#define P4_ESCR_EMASK_BIT(class, name) class##__##name
6767

6868
/*
@@ -107,7 +107,7 @@
107107
* P4_PEBS_CONFIG_MASK and related bits on
108108
* modification.)
109109
*/
110-
#define P4_CONFIG_ALIASABLE (1 << 9)
110+
#define P4_CONFIG_ALIASABLE (1ULL << 9)
111111

112112
/*
113113
* The bits we allow to pass for RAW events
@@ -784,17 +784,17 @@ enum P4_ESCR_EMASKS {
784784
* Note we have UOP and PEBS bits reserved for now
785785
* just in case if we will need them once
786786
*/
787-
#define P4_PEBS_CONFIG_ENABLE (1 << 7)
788-
#define P4_PEBS_CONFIG_UOP_TAG (1 << 8)
789-
#define P4_PEBS_CONFIG_METRIC_MASK 0x3f
790-
#define P4_PEBS_CONFIG_MASK 0xff
787+
#define P4_PEBS_CONFIG_ENABLE (1ULL << 7)
788+
#define P4_PEBS_CONFIG_UOP_TAG (1ULL << 8)
789+
#define P4_PEBS_CONFIG_METRIC_MASK 0x3FLL
790+
#define P4_PEBS_CONFIG_MASK 0xFFLL
791791

792792
/*
793793
* mem: Only counters MSR_IQ_COUNTER4 (16) and
794794
* MSR_IQ_COUNTER5 (17) are allowed for PEBS sampling
795795
*/
796-
#define P4_PEBS_ENABLE 0x02000000U
797-
#define P4_PEBS_ENABLE_UOP_TAG 0x01000000U
796+
#define P4_PEBS_ENABLE 0x02000000ULL
797+
#define P4_PEBS_ENABLE_UOP_TAG 0x01000000ULL
798798

799799
#define p4_config_unpack_metric(v) (((u64)(v)) & P4_PEBS_CONFIG_METRIC_MASK)
800800
#define p4_config_unpack_pebs(v) (((u64)(v)) & P4_PEBS_CONFIG_MASK)

‎arch/x86/include/asm/uprobes.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
5555
extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
5656
extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
5757
extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
58+
extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
5859
#endif /* _ASM_UPROBES_H */

‎arch/x86/include/uapi/asm/msr-index.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
#define MSR_IA32_PEBS_ENABLE 0x000003f1
7373
#define MSR_IA32_DS_AREA 0x00000600
7474
#define MSR_IA32_PERF_CAPABILITIES 0x00000345
75+
#define MSR_PEBS_LD_LAT_THRESHOLD 0x000003f6
7576

7677
#define MSR_MTRRfix64K_00000 0x00000250
7778
#define MSR_MTRRfix16K_80000 0x00000258
@@ -195,6 +196,10 @@
195196
#define MSR_AMD64_IBSBRTARGET 0xc001103b
196197
#define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */
197198

199+
/* Fam 16h MSRs */
200+
#define MSR_F16H_L2I_PERF_CTL 0xc0010230
201+
#define MSR_F16H_L2I_PERF_CTR 0xc0010231
202+
198203
/* Fam 15h MSRs */
199204
#define MSR_F15H_PERF_CTL 0xc0010200
200205
#define MSR_F15H_PERF_CTR 0xc0010201

‎arch/x86/kernel/cpu/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o
3131
obj-$(CONFIG_PERF_EVENTS) += perf_event.o
3232

3333
ifdef CONFIG_PERF_EVENTS
34-
obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o
34+
obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o perf_event_amd_uncore.o
3535
obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o
3636
obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o
3737
obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore.o

0 commit comments

Comments
 (0)