Skip to content

Commit cedd361

Browse files
Anshuman KhandualPeter Zijlstra
authored andcommitted
perf: Add irq and exception return branch types
This expands generic branch type classification by adding two more entries there in i.e irq and exception return. Also updates the x86 implementation to process X86_BR_IRET and X86_BR_IRQ records as appropriate. This changes branch types reported to user space on x86 platform but it should not be a problem. The possible scenarios and impacts are enumerated here. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 71a412e commit cedd361

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

arch/x86/events/intel/lbr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,10 +1329,10 @@ static int branch_map[X86_BR_TYPE_MAP_MAX] = {
13291329
PERF_BR_SYSCALL, /* X86_BR_SYSCALL */
13301330
PERF_BR_SYSRET, /* X86_BR_SYSRET */
13311331
PERF_BR_UNKNOWN, /* X86_BR_INT */
1332-
PERF_BR_UNKNOWN, /* X86_BR_IRET */
1332+
PERF_BR_ERET, /* X86_BR_IRET */
13331333
PERF_BR_COND, /* X86_BR_JCC */
13341334
PERF_BR_UNCOND, /* X86_BR_JMP */
1335-
PERF_BR_UNKNOWN, /* X86_BR_IRQ */
1335+
PERF_BR_IRQ, /* X86_BR_IRQ */
13361336
PERF_BR_IND_CALL, /* X86_BR_IND_CALL */
13371337
PERF_BR_UNKNOWN, /* X86_BR_ABORT */
13381338
PERF_BR_UNKNOWN, /* X86_BR_IN_TX */

include/uapi/linux/perf_event.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ enum {
251251
PERF_BR_SYSRET = 8, /* syscall return */
252252
PERF_BR_COND_CALL = 9, /* conditional function call */
253253
PERF_BR_COND_RET = 10, /* conditional function return */
254+
PERF_BR_ERET = 11, /* exception return */
255+
PERF_BR_IRQ = 12, /* irq */
254256
PERF_BR_MAX,
255257
};
256258

tools/include/uapi/linux/perf_event.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ enum {
251251
PERF_BR_SYSRET = 8, /* syscall return */
252252
PERF_BR_COND_CALL = 9, /* conditional function call */
253253
PERF_BR_COND_RET = 10, /* conditional function return */
254+
PERF_BR_ERET = 11, /* exception return */
255+
PERF_BR_IRQ = 12, /* irq */
254256
PERF_BR_MAX,
255257
};
256258

tools/perf/util/branch.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ const char *branch_type_name(int type)
4949
"SYSCALL",
5050
"SYSRET",
5151
"COND_CALL",
52-
"COND_RET"
52+
"COND_RET",
53+
"ERET",
54+
"IRQ"
5355
};
5456

5557
if (type >= 0 && type < PERF_BR_MAX)

0 commit comments

Comments
 (0)