History

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.

Anshuman Khandual committed 4 years ago

Commit cedd3611 parent 71a412e4 files · +9 −3Browse files

Unified · Split

4 files
  1. arch/x86/events/intel/lbr.c +2 −2
  2. include/uapi/linux/perf_event.h +2 −0
  3. tools/include/uapi/linux/perf_event.h +2 −0
  4. tools/perf/util/branch.c +3 −1
arch/x86/events/intel/lbr.c+2−2
@@ -1329,10 +1329,10 @@ static int branch_map[X86_BR_TYPE_MAP_MAX] = { · 1328 unmodified lines
1329 PERF_BR_SYSCALL, /* X86_BR_SYSCALL */1329 PERF_BR_SYSCALL, /* X86_BR_SYSCALL */
1330 PERF_BR_SYSRET, /* X86_BR_SYSRET */1330 PERF_BR_SYSRET, /* X86_BR_SYSRET */
1331 PERF_BR_UNKNOWN, /* X86_BR_INT */1331 PERF_BR_UNKNOWN, /* X86_BR_INT */
1332 PERF_BR_UNKNOWN, /* X86_BR_IRET */1332 PERF_BR_ERET, /* X86_BR_IRET */
1333 PERF_BR_COND, /* X86_BR_JCC */1333 PERF_BR_COND, /* X86_BR_JCC */
1334 PERF_BR_UNCOND, /* X86_BR_JMP */1334 PERF_BR_UNCOND, /* X86_BR_JMP */
1335 PERF_BR_UNKNOWN, /* X86_BR_IRQ */1335 PERF_BR_IRQ, /* X86_BR_IRQ */
1336 PERF_BR_IND_CALL, /* X86_BR_IND_CALL */1336 PERF_BR_IND_CALL, /* X86_BR_IND_CALL */
1337 PERF_BR_UNKNOWN, /* X86_BR_ABORT */1337 PERF_BR_UNKNOWN, /* X86_BR_ABORT */
1338 PERF_BR_UNKNOWN, /* X86_BR_IN_TX */1338 PERF_BR_UNKNOWN, /* X86_BR_IN_TX */
include/uapi/linux/perf_event.h+2−0
@@ -251,6 +251,8 @@ enum { · 250 unmodified lines
251 PERF_BR_SYSRET = 8, /* syscall return */251 PERF_BR_SYSRET = 8, /* syscall return */
252 PERF_BR_COND_CALL = 9, /* conditional function call */252 PERF_BR_COND_CALL = 9, /* conditional function call */
253 PERF_BR_COND_RET = 10, /* conditional function return */253 PERF_BR_COND_RET = 10, /* conditional function return */
254 PERF_BR_ERET = 11, /* exception return */
255 PERF_BR_IRQ = 12, /* irq */
254 PERF_BR_MAX,256 PERF_BR_MAX,
255};257};
256 258
tools/include/uapi/linux/perf_event.h+2−0
@@ -251,6 +251,8 @@ enum { · 250 unmodified lines
251 PERF_BR_SYSRET = 8, /* syscall return */251 PERF_BR_SYSRET = 8, /* syscall return */
252 PERF_BR_COND_CALL = 9, /* conditional function call */252 PERF_BR_COND_CALL = 9, /* conditional function call */
253 PERF_BR_COND_RET = 10, /* conditional function return */253 PERF_BR_COND_RET = 10, /* conditional function return */
254 PERF_BR_ERET = 11, /* exception return */
255 PERF_BR_IRQ = 12, /* irq */
254 PERF_BR_MAX,256 PERF_BR_MAX,
255};257};
256 258
tools/perf/util/branch.c+3−1
@@ -49,7 +49,9 @@ const char *branch_type_name(int type) · 48 unmodified lines
49 "SYSCALL",49 "SYSCALL",
50 "SYSRET",50 "SYSRET",
51 "COND_CALL",51 "COND_CALL",
52 "COND_RET"52 "COND_RET",
53 "ERET",
54 "IRQ"
53 };55 };
54 56
55 if (type >= 0 && type < PERF_BR_MAX)57 if (type >= 0 && type < PERF_BR_MAX)