[PATCH v2 0/3] perf/sdt: Hardening argument support

From: Ravi Bangoria
Date: Mon Mar 27 2017 - 04:01:22 EST


SDT event argument support on x86 is recently added to Perf. But
there are couple of issues with it.

It lacks renaming mapping for few 8 bit registers: al, bl, cl and dl.
SDT events using these registers in arguments are failing at 'perf
probe'. Add renaming logic to that. (patch 1)

It still has x86 specific code in general code. It also fails to
convert arguments having no offset but still surrounds register with
parenthesis for ex. 8@(%rdi) is converted to +(%di):u64, which is
rejected by uprobe_events. Also, 'perf probe' is failing for *all SDT
events on all archs except x86*. Solve these issues. (patch 2)

Add argument parser for powerpc. (patch 3)

Changes in v2:
- Patch 1 is new.

- (Patch 2) Reimplement argument parsing logic for x86(Esp. OP parser).
Use regex for parsing which makes code more compact and accurate
wrt current implementation.

- (Patch 2) sdt_reg_renamings is bit longer. Rename it to sdt_reg_tbl.

- (Patch 2) Rename sdt_probe_parse_n() to sdt_probe_parse_size() as
suggested by Masami.[1]

- (Patch 2,3) Separate out in/out arguments as suggested by Masami.[1]

- (Patch 2,3) Introduce enum instead of returning hardcoded values
from arch_sdt_arg_parse_op().

- (Parch 2,3) Rename arch_sdt_probe_parse_op() to
arch_sdt_arg_parse_op().

- (Patch 2,3) Remove arch_sdt_probe_arg_supp() function. Instead,
arch_sdt_arg_parse_op() should always return SDT_ARG_SKIP on all
archs who does not implement argument parser.[1]

v1: https://lkml.org/lkml/2017/2/2/145

I've prepared this patchset on top of acme/perf/core.

[1] https://lkml.org/lkml/2017/3/21/427

Ravi Bangoria (3):
perf/sdt/x86: Add renaming logic for (missing) 8 bit registers
perf/sdt/x86: Move OP parser to tools/perf/arch/x86/
perf/sdt/powerpc: Add argument support

tools/perf/arch/powerpc/util/perf_regs.c | 111 +++++++++++++++++++
tools/perf/arch/x86/util/perf_regs.c | 183 +++++++++++++++++++++++++------
tools/perf/util/perf_regs.c | 6 +-
tools/perf/util/perf_regs.h | 11 +-
tools/perf/util/probe-file.c | 132 +++++++---------------
5 files changed, 309 insertions(+), 134 deletions(-)

--
2.9.3