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
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+2−0
@@ -251,6 +251,8 @@ enum { · 250 unmodified lines
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+2−0
@@ -251,6 +251,8 @@ enum { · 250 unmodified lines
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+3−1
@@ -49,7 +49,9 @@ const char *branch_type_name(int type) · 48 unmodified lines
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)