perf/powerpc: Add ability to sample intr machine state in powerpc
Subsystems (2)
v11 cover perf/powerpc: Add ability to sample intr machine state in powerpc
This short patch series adds the ability to sample the interrupted machine state for each hardware sample.
To test this patchset,
Eg:
$ perf record -I? # list supported registers
output:
available registers: r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 nip msr orig_r3 ctr link xer ccr softe trap dar dsisr
usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
-I, --intr-regs[=<any register>]
sample selected machine registers on interrupt, use -I ? to list register names
$ perf record -I ls # record machine state at interrupt $ perf script -D # read the perf.data file
Sample output obtained for this patchset/ output looks like as follows:
496768515470 0x1988 [0x188]: PERF_RECORD_SAMPLE(IP, 0x1): 4522/4522: 0xc0000000001e538c period: 1 addr: 0 ... intr regs: mask 0x7ffffffffff ABI 64-bit
.... r0 0xc0000000001e5e34 .... r1 0xc000000fe733f9a0 .... r2 0xc000000001523100 .... r3 0xc000000ffaadeb60 .... r4 0xc000000003456800 .... r5 0x73a9b5e000 .... r6 0x1e000000 .... r7 0x0 .... r8 0x0 .... r9 0x0 .... r10 0x1 .... r11 0x0 .... r12 0x24022822 .... r13 0xc00000000feec180 .... r14 0x0 .... r15 0xc000001e4be18800 .... r16 0x0 .... r17 0xc000000ffaac5000 .... r18 0xc000000fe733f8a0 .... r19 0xc000000001523100 .... r20 0xc00000000009fd1c .... r21 0xc000000fcaa69000 .... r22 0xc0000000001e4968 .... r23 0xc000000001523100 .... r24 0xc000000fe733f850 .... r25 0xc000000fcaa69000 .... r26 0xc000000003b8fcf0 .... r27 0xfffffffffffffead .... r28 0x0 .... r29 0xc000000fcaa69000 .... r30 0x1 .... r31 0x0 .... nip 0xc0000000001dd320 .... msr 0x9000000000009032 .... orig_r3 0xc0000000001e538c .... ctr 0xc00000000009d550 .... link 0xc0000000001e5e34 .... xer 0x0 .... ccr 0x84022882
.... softe 0x0
.... trap 0xf01
.... dar 0x0
.... dsisr 0xf00040060000004
... thread: :4522:4522
...... dso: /root/.debug/.build-id/b0/ef11b1a1629e62ac9de75199117ee5ef9469e9
:4522 4522 496.768515: 1 cycles: c0000000001e538c .perf_event_context_sched_in (/boot/vmlinux)
Changes from v10:
- Included SOFTE as suggested by mpe
- The name of registers displayed is changed from gpr* to r* also the macro names changed from PERF_REG_POWERPC_GPR* to PERF_REG_POWERPC_R*.
- The conflict in returning the ABI is resolved.
- #define PERF_REG_SP is again changed to PERF_REG_POWERPC_R1
- Comment in tools/perf/config/Makefile is updated.
- removed the "Reviewed-By" tag as the patch has logic changes.
Changes from V9:
- Changed the name displayed for link register from "lnk" to "link" in tools/perf/arch/powerpc/include/perf_regs.h
changes from V8:
- Corrected the indentation issue in the Makefile mentioned in 3rd patch
Changes from V7:
- Addressed the new line issue in 3rd patch.
Changes from V6:
- Corrected the typo in patch tools/perf: Map the ID values with register names.
ie #define PERF_REG_SP PERF_REG_POWERPC_R1 should be #define PERF_REG_SP PERF_REG_POWERPC_GPR1
Changes from V5:
- Enabled perf_sample_regs_user also in this patch set.Functions added in arch/powerpc/perf/perf_regs.c
- Added Maddy's patch to this patchset for enabling -I? option which will list the supported register names.
Changes from V4:
- Removed the softe and MQ from all patches
- Switch case is replaced with an array in the 3rd patch
Changes from V3:
- Addressed the comments by Sukadev regarding the nits in the descriptions.
- Modified the subject of first patch.
- Included the sample output in the 3rd patch also.
Changes from V2:
- tools/perf/config/Makefile is moved to the patch tools/perf.
- The patchset is reordered.
- perf_regs_load() function is used for the dwarf unwind test.Since it is not required here, it is removed from tools/perf/arch/powerpc/include/perf_regs.h
- PERF_REGS_POWERPC_RESULT is removed.
Changes from V1:
- Solved the name missmatch issue in the from and signed-off field of the patch series.
- Added necessary comments in the 3rd patch ie perf/powerpc ,as suggested by Maddy.
Anju T (3):
perf/powerpc: assign an id to each powerpc register perf/powerpc: add support for sampling intr machine state tools/perf: Map the ID values with register names
Madhavan Srinivasan (1):
tool/perf: Add sample_reg_mask to include all perf_regs regs
arch/powerpc/Kconfig | 1 + arch/powerpc/include/uapi/asm/perf_regs.h | 50 ++++++++++++++++ arch/powerpc/perf/Makefile | 1 + arch/powerpc/perf/perf_regs.c | 91 +++++++++++++++++++++++++++++ tools/perf/arch/powerpc/include/perf_regs.h | 69 ++++++++++++++++++++++ tools/perf/arch/powerpc/util/Build | 1 + tools/perf/arch/powerpc/util/perf_regs.c | 49 ++++++++++++++++ tools/perf/config/Makefile | 5 ++ 8 files changed, 267 insertions(+) create mode 100644 arch/powerpc/include/uapi/asm/perf_regs.h create mode 100644 arch/powerpc/perf/perf_regs.c create mode 100644 tools/perf/arch/powerpc/include/perf_regs.h create mode 100644 tools/perf/arch/powerpc/util/perf_regs.c
Signature · 1 line
2.1.0
PATCH v11 1/4 perf/powerpc: assign an id to each powerpc register
The enum definition assigns an 'id' to each register in "struct pt_regs" of arch/powerpc. The order of these values in the enum definition are based on the corresponding macros in arch/powerpc/include/uapi/asm/ptrace.h.
--- arch/powerpc/include/uapi/asm/perf_regs.h | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 arch/powerpc/include/uapi/asm/perf_regs.h
arch/powerpc/include/uapi/asm/perf_regs.h new file +50 -0
@@ -0,0 +1,50 @@ +#ifndef _ASM_POWERPC_PERF_REGS_H +#define _ASM_POWERPC_PERF_REGS_H + +enum perf_event_powerpc_regs { +PERF_REG_POWERPC_R0 , +PERF_REG_POWERPC_R1 , +PERF_REG_POWERPC_R2 , +PERF_REG_POWERPC_R3 , +PERF_REG_POWERPC_R4 , +PERF_REG_POWERPC_R5 , +PERF_REG_POWERPC_R6 , +PERF_REG_POWERPC_R7 , +PERF_REG_POWERPC_R8 , +PERF_REG_POWERPC_R9 , +PERF_REG_POWERPC_R10 , +PERF_REG_POWERPC_R11 , +PERF_REG_POWERPC_R12 , +PERF_REG_POWERPC_R13 , +PERF_REG_POWERPC_R14 , +PERF_REG_POWERPC_R15 , +PERF_REG_POWERPC_R16 , +PERF_REG_POWERPC_R17 , +PERF_REG_POWERPC_R18 , +PERF_REG_POWERPC_R19 , +PERF_REG_POWERPC_R20 , +PERF_REG_POWERPC_R21 , +PERF_REG_POWERPC_R22 , +PERF_REG_POWERPC_R23 , +PERF_REG_POWERPC_R24 , +PERF_REG_POWERPC_R25 , +PERF_REG_POWERPC_R26 , +PERF_REG_POWERPC_R27 , +PERF_REG_POWERPC_R28 , +PERF_REG_POWERPC_R29 , +PERF_REG_POWERPC_R30 , +PERF_REG_POWERPC_R31 , +PERF_REG_POWERPC_NIP , +PERF_REG_POWERPC_MSR , +PERF_REG_POWERPC_ORIG_R3 , +PERF_REG_POWERPC_CTR , +PERF_REG_POWERPC_LNK , +PERF_REG_POWERPC_XER , +PERF_REG_POWERPC_CCR , +PERF_REG_POWERPC_SOFTE , +PERF_REG_POWERPC_TRAP , +PERF_REG_POWERPC_DAR , +PERF_REG_POWERPC_DSISR , +PERF_REG_POWERPC_MAX , +}; +#endif /* _ASM_POWERPC_PERF_REGS_H */
Signature · 1 line
2.1.0
PATCH v11 2/4 perf/powerpc: add support for sampling intr machine state
In reply to Anju TThe perf infrastructure uses a bit mask to find out valid registers to display. Define a register mask for supported registers defined in asm/perf_regs.h. The bit positions also correspond to register IDs which is used by perf infrastructure to fetch the register values. CONFIG_HAVE_PERF_REGS enables sampling of the interrupted machine state.
--- arch/powerpc/Kconfig | 1 + arch/powerpc/perf/Makefile | 1 + arch/powerpc/perf/perf_regs.c | 91 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 arch/powerpc/perf/perf_regs.c
arch/powerpc/Kconfig +1 -0
@@ -119,6 +119,7 @@ config PPC select GENERIC_ATOMIC64 if PPC32 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select HAVE_PERF_EVENTS + select HAVE_PERF_REGS select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64 select ARCH_WANT_IPC_PARSE_VERSION
arch/powerpc/perf/Makefile +1 -0
@@ -8,6 +8,7 @@ obj64-$(CONFIG_PPC_PERF_CTRS) += power4-pmu.o ppc970-pmu.o power5-pmu.o \ power8-pmu.o obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o +obj-$(CONFIG_PERF_EVENTS) += perf_regs.o obj-$(CONFIG_FSL_EMB_PERF_EVENT) += core-fsl-emb.o obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o e6500-pmu.o
arch/powerpc/perf/perf_regs.c new file +91 -0
91 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH v11 3/4 tools/perf: Map the ID values with register names
In reply to Anju TMap ID values with corresponding register names. These names are then displayed when user issues perf record with the -I option followed by perf report/script with -D option.
To test this patchset,
Eg:
$ perf record -I ls # record machine state at interrupt $ perf script -D # read the perf.data file
Sample output obtained for this patch / output looks like as follows:
496768515470 0x1988 [0x188]: PERF_RECORD_SAMPLE(IP, 0x1): 4522/4522: 0xc0000000001e538c period: 1 addr: 0 ... intr regs: mask 0x7ffffffffff ABI 64-bit
.... r0 0xc0000000001e5e34 .... r1 0xc000000fe733f9a0 .... r2 0xc000000001523100 .... r3 0xc000000ffaadeb60 .... r4 0xc000000003456800 .... r5 0x73a9b5e000 .... r6 0x1e000000 .... r7 0x0 .... r8 0x0 .... r9 0x0 .... r10 0x1 .... r11 0x0 .... r12 0x24022822 .... r13 0xc00000000feec180 .... r14 0x0 .... r15 0xc000001e4be18800 .... r16 0x0 .... r17 0xc000000ffaac5000 .... r18 0xc000000fe733f8a0 .... r19 0xc000000001523100 .... r20 0xc00000000009fd1c .... r21 0xc000000fcaa69000 .... r22 0xc0000000001e4968 .... r23 0xc000000001523100 .... r24 0xc000000fe733f850 .... r25 0xc000000fcaa69000 .... r26 0xc000000003b8fcf0 .... r27 0xfffffffffffffead .... r28 0x0 .... r29 0xc000000fcaa69000 .... r30 0x1 .... r31 0x0 .... nip 0xc0000000001dd320 .... msr 0x9000000000009032 .... orig_r3 0xc0000000001e538c .... ctr 0xc00000000009d550 .... link 0xc0000000001e5e34 .... xer 0x0 .... ccr 0x84022882
.... softe 0x0
.... trap 0xf01
.... dar 0x0
.... dsisr 0xf00040060000004
... thread: :4522:4522
...... dso: /root/.debug/.build-id/b0/ef11b1a1629e62ac9de75199117ee5ef9469e9
:4522 4522 496.768515: 1 cycles: c0000000001e538c .perf_event_context_sched_in (/boot/vmlinux)
--- tools/perf/arch/powerpc/include/perf_regs.h | 69 +++++++++++++++++++++++++++++ tools/perf/config/Makefile | 5 +++ 2 files changed, 74 insertions(+) create mode 100644 tools/perf/arch/powerpc/include/perf_regs.h
tools/perf/arch/powerpc/include/perf_regs.h new file +69 -0
@@ -0,0 +1,69 @@ +#ifndef ARCH_PERF_REGS_H +#define ARCH_PERF_REGS_H + +#include <stdlib.h> +#include <linux/types.h> +#include <asm/perf_regs.h> + +#define PERF_REGS_MASK ((1ULL << PERF_REG_POWERPC_MAX) - 1) +#define PERF_REGS_MAX PERF_REG_POWERPC_MAX +#ifdef __powerpc64__ +#define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_64 +#else +#define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_32 +#endif + +#define PERF_REG_IP PERF_REG_POWERPC_NIP +#define PERF_REG_SP PERF_REG_POWERPC_R1 + +static const char *reg_names[] = { + [PERF_REG_POWERPC_R0 ] ="r0" , + [PERF_REG_POWERPC_R1 ] ="r1" , + [PERF_REG_POWERPC_R2 ] ="r2" , + [PERF_REG_POWERPC_R3 ] ="r3" , + [PERF_REG_POWERPC_R4 ] ="r4" , + [PERF_REG_POWERPC_R5 ] ="r5" , + [PERF_REG_POWERPC_R6 ] ="r6" , + [PERF_REG_POWERPC_R7 ] ="r7" , + [PERF_REG_POWERPC_R8 ] ="r8" , + [PERF_REG_POWERPC_R9 ] ="r9" , + [PERF_REG_POWERPC_R10 ] ="r10" , + [PERF_REG_POWERPC_R11 ] ="r11" , + [PERF_REG_POWERPC_R12 ] ="r12" , + [PERF_REG_POWERPC_R13 ] ="r13" , + [PERF_REG_POWERPC_R14 ] ="r14" , + [PERF_REG_POWERPC_R15 ] ="r15" , + [PERF_REG_POWERPC_R16 ] ="r16" , + [PERF_REG_POWERPC_R17 ] ="r17" , + [PERF_REG_POWERPC_R18 ] ="r18" , + [PERF_REG_POWERPC_R19 ] ="r19" , + [PERF_REG_POWERPC_R20 ] ="r20" , + [PERF_REG_POWERPC_R21 ] ="r21" , + [PERF_REG_POWERPC_R22 ] ="r22" , + [PERF_REG_POWERPC_R23 ] ="r23" , + [PERF_REG_POWERPC_R24 ] ="r24" , + [PERF_REG_POWERPC_R25 ] ="r25" , + [PERF_REG_POWERPC_R26 ] ="r26" , + [PERF_REG_POWERPC_R27 ] ="r27" , + [PERF_REG_POWERPC_R28 ] ="r28" , + [PERF_REG_POWERPC_R29 ] ="r29" , + [PERF_REG_POWERPC_R30 ] ="r30" , + [PERF_REG_POWERPC_R31 ] ="r31" , + [PERF_REG_POWERPC_NIP ] ="nip" , + [PERF_REG_POWERPC_MSR ] ="msr" , + [PERF_REG_POWERPC_ORIG_R3 ] ="orig_r3" , + [PERF_REG_POWERPC_CTR ] ="ctr" , + [PERF_REG_POWERPC_LNK ] ="link" , + [PERF_REG_POWERPC_XER ] ="xer" , + [PERF_REG_POWERPC_CCR ] ="ccr" , + [PERF_REG_POWERPC_SOFTE ] ="softe" , + [PERF_REG_POWERPC_TRAP ] ="trap" , + [PERF_REG_POWERPC_DAR ] ="dar" , + [PERF_REG_POWERPC_DSISR ] ="dsisr" +}; + +static inline const char *perf_reg_name (int id) +{ +return reg_names[id]; +} +#endif /* ARCH_PERF_REGS_H */
tools/perf/config/Makefile +5 -0
@@ -23,6 +23,11 @@ $(call detected_var,ARCH) NO_PERF_REGS := 1 +# Additional ARCH settings for ppc +ifeq ($(ARCH),powerpc) + NO_PERF_REGS := 0 +endif + # Additional ARCH settings for x86 ifeq ($(ARCH),x86) $(call detected,CONFIG_X86)
Signature · 1 line
2.1.0
PATCH v2 4/4 tool/perf: Add sample_reg_mask to include all perf_regs
In reply to Anju TFrom: Madhavan Srinivasan <[email protected]>
Add sample_reg_mask array with pt_regs registers. This is needed for printing supported regs ( -I? option).
--- tools/perf/arch/powerpc/util/Build | 1 + tools/perf/arch/powerpc/util/perf_regs.c | 49 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 tools/perf/arch/powerpc/util/perf_regs.c
tools/perf/arch/powerpc/util/Build +1 -0
@@ -1,5 +1,6 @@ libperf-y += header.o libperf-y += sym-handling.o +libperf-y += perf_regs.o libperf-$(CONFIG_DWARF) += dwarf-regs.o libperf-$(CONFIG_DWARF) += skip-callchain-idx.o
tools/perf/arch/powerpc/util/perf_regs.c new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
2.1.0
Hi,
Any updates on this?
Quoted 157 lines · Anju T
This short patch series adds the ability to sample the interrupted machine state for each hardware sample.
To test this patchset,
Eg:$ perf record -I? # list supported registersoutput:
available registers: r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 nip msrorig_r3ctr link xer ccr softe trap dar dsisrusage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]-I, --intr-regs[=<any register>]
sample selected machine registers on interrupt, use -I ? to list register names$ perf record -I ls # record machine state at interrupt $ perf script -D # read the perf.data fileSample output obtained for this patchset/ output looks like as follows:
496768515470
0x1988[0x188]:PERF_RECORD_SAMPLE(IP, 0x1): 4522/4522:0xc0000000001e538cperiod: 1 addr: 0 ... intr regs: mask0x7ffffffffffABI 64-bit.... r0 0xc0000000001e5e34 .... r1 0xc000000fe733f9a0 .... r2 0xc000000001523100 .... r3 0xc000000ffaadeb60 .... r4 0xc000000003456800 .... r5 0x73a9b5e000 .... r6 0x1e000000 .... r7 0x0 .... r8 0x0 .... r9 0x0 .... r10 0x1 .... r11 0x0 .... r12 0x24022822 .... r13 0xc00000000feec180 .... r14 0x0 .... r15 0xc000001e4be18800 .... r16 0x0 .... r17 0xc000000ffaac5000 .... r18 0xc000000fe733f8a0 .... r19 0xc000000001523100 .... r20 0xc00000000009fd1c .... r21 0xc000000fcaa69000 .... r22 0xc0000000001e4968 .... r23 0xc000000001523100 .... r24 0xc000000fe733f850 .... r25 0xc000000fcaa69000 .... r26 0xc000000003b8fcf0 .... r27 0xfffffffffffffead .... r28 0x0 .... r29 0xc000000fcaa69000 .... r30 0x1 .... r31 0x0 .... nip 0xc0000000001dd320 .... msr 0x9000000000009032 .... orig_r3 0xc0000000001e538c .... ctr 0xc00000000009d550 .... link 0xc0000000001e5e34 .... xer 0x0 .... ccr 0x84022882.... softe
0x0
.... trap0xf01
.... dar0x0
.... dsisr0xf00040060000004
... thread: :4522:4522
...... dso:/root/.debug/.build-id/b0/ef11b1a1629e62ac9de75199117ee5ef9469e9:4522 4522 496.768515: 1 cycles: c0000000001e538c .perf_event_context_sched_in (/boot/vmlinux)Changes from v10:
- Included SOFTE as suggested by mpe
- The name of registers displayed is changed from gpr* to r* also the macro names changed from PERF_REG_POWERPC_GPR* to PERF_REG_POWERPC_R*.
- The conflict in returning the ABI is resolved.
- #definePERF_REG_SPis again changed toPERF_REG_POWERPC_R1
- Comment intools/perf/config/Makefileis updated.
- removed the "Reviewed-By" tag as the patch has logic changes.Changes from V9:
- Changed the name displayed for link register from "lnk" to "link" in
tools/perf/arch/powerpc/include/perf_regs.hchanges from V8:
- Corrected the indentation issue in the
Makefilementioned in 3rd patchChanges from V7:
- Addressed the new line issue in 3rd patch.
Changes from V6:
- Corrected the typo in patch
tools/perf: Map the ID values with register names.
ie #definePERF_REG_SPPERF_REG_POWERPC_R1should be #definePERF_REG_SPPERF_REG_POWERPC_GPR1Changes from V5:
- Enabled
perf_sample_regs_useralso in this patch set.Functions added inarch/powerpc/perf/perf_regs.c
- Added Maddy's patch to this patchset for enabling -I? option which will list the supported register names.Changes from V4:
- Removed the softe and MQ from all patches
- Switch case is replaced with an array in the 3rd patchChanges from V3:
- Addressed the comments by Sukadev regarding the nits in the descriptions.
- Modified the subject of first patch.
- Included the sample output in the 3rd patch also.Changes from V2:
-
tools/perf/config/Makefileis moved to the patchtools/perf.
- The patchset is reordered.
-perf_regs_load()function is used for the dwarf unwind test.Since it is not required here, it is removed fromtools/perf/arch/powerpc/include/perf_regs.h
-PERF_REGS_POWERPC_RESULTis removed.Changes from V1:
- Solved the name missmatch issue in the from and signed-off field of the patch series.
- Added necessary comments in the 3rd patch ie perf/powerpc ,as suggested by Maddy.Anju T (3):
perf/powerpc: assign an id to each powerpc register perf/powerpc: add support for sampling intr machine statetools/perf: Map the ID values with register namesMadhavan Srinivasan (1):
tool/perf: Addsample_reg_maskto include allperf_regsregsarch/powerpc/Kconfig | 1 + arch/powerpc/include/uapi/asm/perf_regs.h | 50 ++++++++++++++++ arch/powerpc/perf/Makefile | 1 + arch/powerpc/perf/perf_regs.c | 91 +++++++++++++++++++++++++++++ tools/perf/arch/powerpc/include/perf_regs.h | 69 ++++++++++++++++++++++ tools/perf/arch/powerpc/util/Build | 1 + tools/perf/arch/powerpc/util/perf_regs.c | 49 ++++++++++++++++ tools/perf/config/Makefile | 5 ++ 8 files changed, 267 insertions(+)
Quoted 5 lines
create mode 100644
arch/powerpc/include/uapi/asm/perf_regs.hcreate mode 100644arch/powerpc/perf/perf_regs.ccreate mode 100644tools/perf/arch/powerpc/include/perf_regs.hcreate mode 100644tools/perf/arch/powerpc/util/perf_regs.c
Thanks
Anju
Quoted 157 lines · Anju T
This short patch series adds the ability to sample the interrupted machine state for each hardware sample.
To test this patchset,
Eg:$ perf record -I? # list supported registersoutput:
available registers: r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 nip msrorig_r3ctr link xer ccr softe trap dar dsisrusage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]-I, --intr-regs[=<any register>]
sample selected machine registers on interrupt, use -I ? to list register names$ perf record -I ls # record machine state at interrupt $ perf script -D # read the perf.data fileSample output obtained for this patchset/ output looks like as follows:
496768515470
0x1988[0x188]:PERF_RECORD_SAMPLE(IP, 0x1): 4522/4522:0xc0000000001e538cperiod: 1 addr: 0 ... intr regs: mask0x7ffffffffffABI 64-bit.... r0 0xc0000000001e5e34 .... r1 0xc000000fe733f9a0 .... r2 0xc000000001523100 .... r3 0xc000000ffaadeb60 .... r4 0xc000000003456800 .... r5 0x73a9b5e000 .... r6 0x1e000000 .... r7 0x0 .... r8 0x0 .... r9 0x0 .... r10 0x1 .... r11 0x0 .... r12 0x24022822 .... r13 0xc00000000feec180 .... r14 0x0 .... r15 0xc000001e4be18800 .... r16 0x0 .... r17 0xc000000ffaac5000 .... r18 0xc000000fe733f8a0 .... r19 0xc000000001523100 .... r20 0xc00000000009fd1c .... r21 0xc000000fcaa69000 .... r22 0xc0000000001e4968 .... r23 0xc000000001523100 .... r24 0xc000000fe733f850 .... r25 0xc000000fcaa69000 .... r26 0xc000000003b8fcf0 .... r27 0xfffffffffffffead .... r28 0x0 .... r29 0xc000000fcaa69000 .... r30 0x1 .... r31 0x0 .... nip 0xc0000000001dd320 .... msr 0x9000000000009032 .... orig_r3 0xc0000000001e538c .... ctr 0xc00000000009d550 .... link 0xc0000000001e5e34 .... xer 0x0 .... ccr 0x84022882.... softe
0x0
.... trap0xf01
.... dar0x0
.... dsisr0xf00040060000004
... thread: :4522:4522
...... dso:/root/.debug/.build-id/b0/ef11b1a1629e62ac9de75199117ee5ef9469e9:4522 4522 496.768515: 1 cycles: c0000000001e538c .perf_event_context_sched_in (/boot/vmlinux)Changes from v10:
- Included SOFTE as suggested by mpe
- The name of registers displayed is changed from gpr* to r* also the macro names changed from PERF_REG_POWERPC_GPR* to PERF_REG_POWERPC_R*.
- The conflict in returning the ABI is resolved.
- #definePERF_REG_SPis again changed toPERF_REG_POWERPC_R1
- Comment intools/perf/config/Makefileis updated.
- removed the "Reviewed-By" tag as the patch has logic changes.Changes from V9:
- Changed the name displayed for link register from "lnk" to "link" in
tools/perf/arch/powerpc/include/perf_regs.hchanges from V8:
- Corrected the indentation issue in the
Makefilementioned in 3rd patchChanges from V7:
- Addressed the new line issue in 3rd patch.
Changes from V6:
- Corrected the typo in patch
tools/perf: Map the ID values with register names.
ie #definePERF_REG_SPPERF_REG_POWERPC_R1should be #definePERF_REG_SPPERF_REG_POWERPC_GPR1Changes from V5:
- Enabled
perf_sample_regs_useralso in this patch set.Functions added inarch/powerpc/perf/perf_regs.c
- Added Maddy's patch to this patchset for enabling -I? option which will list the supported register names.Changes from V4:
- Removed the softe and MQ from all patches
- Switch case is replaced with an array in the 3rd patchChanges from V3:
- Addressed the comments by Sukadev regarding the nits in the descriptions.
- Modified the subject of first patch.
- Included the sample output in the 3rd patch also.Changes from V2:
-
tools/perf/config/Makefileis moved to the patchtools/perf.
- The patchset is reordered.
-perf_regs_load()function is used for the dwarf unwind test.Since it is not required here, it is removed fromtools/perf/arch/powerpc/include/perf_regs.h
-PERF_REGS_POWERPC_RESULTis removed.Changes from V1:
- Solved the name missmatch issue in the from and signed-off field of the patch series.
- Added necessary comments in the 3rd patch ie perf/powerpc ,as suggested by Maddy.Anju T (3):
perf/powerpc: assign an id to each powerpc register perf/powerpc: add support for sampling intr machine statetools/perf: Map the ID values with register namesMadhavan Srinivasan (1):
tool/perf: Addsample_reg_maskto include allperf_regsregsarch/powerpc/Kconfig | 1 + arch/powerpc/include/uapi/asm/perf_regs.h | 50 ++++++++++++++++ arch/powerpc/perf/Makefile | 1 + arch/powerpc/perf/perf_regs.c | 91 +++++++++++++++++++++++++++++ tools/perf/arch/powerpc/include/perf_regs.h | 69 ++++++++++++++++++++++ tools/perf/arch/powerpc/util/Build | 1 + tools/perf/arch/powerpc/util/perf_regs.c | 49 ++++++++++++++++ tools/perf/config/Makefile | 5 ++ 8 files changed, 267 insertions(+)
Quoted 5 lines
create mode 100644
arch/powerpc/include/uapi/asm/perf_regs.hcreate mode 100644arch/powerpc/perf/perf_regs.ccreate mode 100644tools/perf/arch/powerpc/include/perf_regs.hcreate mode 100644tools/perf/arch/powerpc/util/perf_regs.c
Hi,
Can this be taken into the next tree?
Thanks
Anju.
Em Mon, Apr 18, 2016 at 03:17:11PM +0530, Anju T escreveu:
Quoted 164 lines · Anju T
Quoted 148 lines
This short patch series adds the ability to sample the interrupted machine state for each hardware sample.
To test this patchset,
Eg:$ perf record -I? # list supported registersoutput:
available registers: r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 nip msrorig_r3ctr link xer ccr softe trap dar dsisrusage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]-I, --intr-regs[=<any register>]
sample selected machine registers on interrupt, use -I ? to list register names$ perf record -I ls # record machine state at interrupt $ perf script -D # read the perf.data fileSample output obtained for this patchset/ output looks like as follows:
496768515470
0x1988[0x188]:PERF_RECORD_SAMPLE(IP, 0x1): 4522/4522:0xc0000000001e538cperiod: 1 addr: 0 ... intr regs: mask0x7ffffffffffABI 64-bit.... r0 0xc0000000001e5e34 .... r1 0xc000000fe733f9a0 .... r2 0xc000000001523100 .... r3 0xc000000ffaadeb60 .... r4 0xc000000003456800 .... r5 0x73a9b5e000 .... r6 0x1e000000 .... r7 0x0 .... r8 0x0 .... r9 0x0 .... r10 0x1 .... r11 0x0 .... r12 0x24022822 .... r13 0xc00000000feec180 .... r14 0x0 .... r15 0xc000001e4be18800 .... r16 0x0 .... r17 0xc000000ffaac5000 .... r18 0xc000000fe733f8a0 .... r19 0xc000000001523100 .... r20 0xc00000000009fd1c .... r21 0xc000000fcaa69000 .... r22 0xc0000000001e4968 .... r23 0xc000000001523100 .... r24 0xc000000fe733f850 .... r25 0xc000000fcaa69000 .... r26 0xc000000003b8fcf0 .... r27 0xfffffffffffffead .... r28 0x0 .... r29 0xc000000fcaa69000 .... r30 0x1 .... r31 0x0 .... nip 0xc0000000001dd320 .... msr 0x9000000000009032 .... orig_r3 0xc0000000001e538c .... ctr 0xc00000000009d550 .... link 0xc0000000001e5e34 .... xer 0x0 .... ccr 0x84022882.... softe
0x0
.... trap0xf01
.... dar0x0
.... dsisr0xf00040060000004
... thread: :4522:4522
...... dso:/root/.debug/.build-id/b0/ef11b1a1629e62ac9de75199117ee5ef9469e9:4522 4522 496.768515: 1 cycles: c0000000001e538c .perf_event_context_sched_in (/boot/vmlinux)Changes from v10:
- Included SOFTE as suggested by mpe
- The name of registers displayed is changed from gpr* to r* also the macro names changed from PERF_REG_POWERPC_GPR* to PERF_REG_POWERPC_R*.
- The conflict in returning the ABI is resolved.
- #definePERF_REG_SPis again changed toPERF_REG_POWERPC_R1
- Comment intools/perf/config/Makefileis updated.
- removed the "Reviewed-By" tag as the patch has logic changes.Changes from V9:
- Changed the name displayed for link register from "lnk" to "link" in
tools/perf/arch/powerpc/include/perf_regs.hchanges from V8:
- Corrected the indentation issue in the
Makefilementioned in 3rd patchChanges from V7:
- Addressed the new line issue in 3rd patch.
Changes from V6:
- Corrected the typo in patch
tools/perf: Map the ID values with register names.
ie #definePERF_REG_SPPERF_REG_POWERPC_R1should be #definePERF_REG_SPPERF_REG_POWERPC_GPR1Changes from V5:
- Enabled
perf_sample_regs_useralso in this patch set.Functions added inarch/powerpc/perf/perf_regs.c
- Added Maddy's patch to this patchset for enabling -I? option which will list the supported register names.Changes from V4:
- Removed the softe and MQ from all patches
- Switch case is replaced with an array in the 3rd patchChanges from V3:
- Addressed the comments by Sukadev regarding the nits in the descriptions.
- Modified the subject of first patch.
- Included the sample output in the 3rd patch also.Changes from V2:
-
tools/perf/config/Makefileis moved to the patchtools/perf.
- The patchset is reordered.
-perf_regs_load()function is used for the dwarf unwind test.Since it is not required here, it is removed fromtools/perf/arch/powerpc/include/perf_regs.h
-PERF_REGS_POWERPC_RESULTis removed.Changes from V1:
- Solved the name missmatch issue in the from and signed-off field of the patch series.
- Added necessary comments in the 3rd patch ie perf/powerpc ,as suggested by Maddy.Anju T (3):
perf/powerpc: assign an id to each powerpc register perf/powerpc: add support for sampling intr machine statetools/perf: Map the ID values with register namesMadhavan Srinivasan (1):
tool/perf: Addsample_reg_maskto include allperf_regsregsQuoted 14 lines
arch/powerpc/Kconfig | 1 + arch/powerpc/include/uapi/asm/perf_regs.h | 50 ++++++++++++++++ arch/powerpc/perf/Makefile | 1 + arch/powerpc/perf/perf_regs.c | 91 +++++++++++++++++++++++++++++ tools/perf/arch/powerpc/include/perf_regs.h | 69 ++++++++++++++++++++++ tools/perf/arch/powerpc/util/Build | 1 + tools/perf/arch/powerpc/util/perf_regs.c | 49 ++++++++++++++++ tools/perf/config/Makefile | 5 ++ 8 files changed, 267 insertions(+) create mode 100644 arch/powerpc/include/uapi/asm/perf_regs.h create mode 100644 arch/powerpc/perf/perf_regs.c create mode 100644 tools/perf/arch/powerpc/include/perf_regs.h create mode 100644 tools/perf/arch/powerpc/util/perf_regs.c
Quoted 3 lines
Hi,
Can this be taken into the next tree?
Even the bits in tools/perf/ are arch specific, so I guess this goes via the powerpc tree? Michael?
- Arnaldo
Michael Ellerman
reviewerQuoted 18 lines · Arnaldo Carvalho de Melo
Em Mon, Apr 18, 2016 at 03:17:11PM +0530, Anju T escreveu:
Quoted 17 lines · Anju T
Quoted 15 lines
arch/powerpc/Kconfig | 1 + arch/powerpc/include/uapi/asm/perf_regs.h | 50 ++++++++++++++++ arch/powerpc/perf/Makefile | 1 + arch/powerpc/perf/perf_regs.c | 91 +++++++++++++++++++++++++++++ tools/perf/arch/powerpc/include/perf_regs.h | 69 ++++++++++++++++++++++ tools/perf/arch/powerpc/util/Build | 1 + tools/perf/arch/powerpc/util/perf_regs.c | 49 ++++++++++++++++ tools/perf/config/Makefile | 5 ++ 8 files changed, 267 insertions(+) create mode 100644 arch/powerpc/include/uapi/asm/perf_regs.h create mode 100644 arch/powerpc/perf/perf_regs.c create mode 100644 tools/perf/arch/powerpc/include/perf_regs.h create mode 100644 tools/perf/arch/powerpc/util/perf_regs.c
Quoted 6 lines
Quoted 3 lines
Hi,
Can this be taken into the next tree?
Even the bits in
tools/perf/are arch specific, so I guess this goes via the powerpc tree? Michael?
Yeah if that's OK with you.
It doesn't look like it will generate much in the way of merge conflicts.
Do you want to send an ack?
cheers
Arnaldo Carvalho de Melo
Acked-byEm Wed, Apr 20, 2016 at 02:55:58PM +1000, Michael Ellerman escreveu:
Quoted 12 lines · Arnaldo Carvalho de Melo
Quoted 10 lines
Em Mon, Apr 18, 2016 at 03:17:11PM +0530, Anju T escreveu:
Quoted 9 lines · Anju T
Quoted 6 lines
tools/perf/arch/powerpc/include/perf_regs.h | 69 ++++++++++++++++++++++ tools/perf/arch/powerpc/util/Build | 1 + tools/perf/arch/powerpc/util/perf_regs.c | 49 ++++++++++++++++ tools/perf/config/Makefile | 5 ++ create mode 100644 tools/perf/arch/powerpc/include/perf_regs.h create mode 100644 tools/perf/arch/powerpc/util/perf_regs.cCan this be taken into the next tree?
Quoted 8 lines
Quoted 2 lines
Even the bits in
tools/perf/are arch specific, so I guess this goes via the powerpc tree? Michael?Yeah if that's OK with you.
It doesn't look like it will generate much in the way of merge conflicts.
Do you want to send an ack?
For the tools/perf/ bits:
- Arnaldo
Re: [PATCH V11 1/4] perf/powerpc: assign an id to each powerpc register
In reply to Anju TQuoted 9 lines · Anju T
The enum definition assigns an 'id' to each register in "struct
pt_regs" ofarch/powerpc. The order of these values in the enum definition are based on the corresponding macros inarch/powerpc/include/uapi/asm/ptrace.h.Signed-off-by Anju T <[email protected]>--- arch/powerpc/include/uapi/asm/perf_regs.h | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 arch/powerpc/include/uapi/asm/perf_regs.h
This patch doesn't enable anything and doesn't look to be useful by itself. Please merge this with your second patch.
- Naveen
Quoted 60 lines
arch/powerpc/include/uapi/asm/perf_regs.h new file +50
-0@@ -0,0 +1,50 @@ +#ifndef _ASM_POWERPC_PERF_REGS_H +#define _ASM_POWERPC_PERF_REGS_H + +enum perf_event_powerpc_regs { +PERF_REG_POWERPC_R0 , +PERF_REG_POWERPC_R1 , +PERF_REG_POWERPC_R2 , +PERF_REG_POWERPC_R3 , +PERF_REG_POWERPC_R4 , +PERF_REG_POWERPC_R5 , +PERF_REG_POWERPC_R6 , +PERF_REG_POWERPC_R7 , +PERF_REG_POWERPC_R8 , +PERF_REG_POWERPC_R9 , +PERF_REG_POWERPC_R10 , +PERF_REG_POWERPC_R11 , +PERF_REG_POWERPC_R12 , +PERF_REG_POWERPC_R13 , +PERF_REG_POWERPC_R14 , +PERF_REG_POWERPC_R15 , +PERF_REG_POWERPC_R16 , +PERF_REG_POWERPC_R17 , +PERF_REG_POWERPC_R18 , +PERF_REG_POWERPC_R19 , +PERF_REG_POWERPC_R20 , +PERF_REG_POWERPC_R21 , +PERF_REG_POWERPC_R22 , +PERF_REG_POWERPC_R23 , +PERF_REG_POWERPC_R24 , +PERF_REG_POWERPC_R25 , +PERF_REG_POWERPC_R26 , +PERF_REG_POWERPC_R27 , +PERF_REG_POWERPC_R28 , +PERF_REG_POWERPC_R29 , +PERF_REG_POWERPC_R30 , +PERF_REG_POWERPC_R31 , +PERF_REG_POWERPC_NIP , +PERF_REG_POWERPC_MSR , +PERF_REG_POWERPC_ORIG_R3 , +PERF_REG_POWERPC_CTR , +PERF_REG_POWERPC_LNK , +PERF_REG_POWERPC_XER , +PERF_REG_POWERPC_CCR , +PERF_REG_POWERPC_SOFTE , +PERF_REG_POWERPC_TRAP , +PERF_REG_POWERPC_DAR , +PERF_REG_POWERPC_DSISR , +PERF_REG_POWERPC_MAX , +}; +#endif /* _ASM_POWERPC_PERF_REGS_H */ Signature · 1 line
2.1.0
Re: [PATCH V11 2/4] perf/powerpc: add support for sampling intr machine state
In reply to Anju TQuoted 6 lines · Anju T
The perf infrastructure uses a bit mask to find out valid registers to display. Define a register mask for supported registers defined in
asm/perf_regs.h. The bit positions also correspond to register IDs which is used by perf infrastructure to fetch the register values.CONFIG_HAVE_PERF_REGSenables sampling of the interrupted machine state.
Please also update Documentation/features/perf/perf-regs/arch-support.txt as part of this patch.
arch/powerpc/perf/perf_regs.c
Quoted 39 lines
Signed-off-by Anju T <[email protected]>--- arch/powerpc/Kconfig | 1 + arch/powerpc/perf/Makefile | 1 + arch/powerpc/perf/perf_regs.c | 91 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 arch/powerpc/perf/perf_regs.carch/powerpc/Kconfig +1
-0@@ -119,6 +119,7 @@ config PPC select GENERIC_ATOMIC64 if PPC32 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE select HAVE_PERF_EVENTS + select HAVE_PERF_REGS select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64 select ARCH_WANT_IPC_PARSE_VERSIONarch/powerpc/perf/Makefile +1
-0@@ -8,6 +8,7 @@ obj64-$(CONFIG_PPC_PERF_CTRS) += power4-pmu.o ppc970-pmu.o power5-pmu.o \ power8-pmu.o obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o +obj-$(CONFIG_PERF_EVENTS) += perf_regs.o obj-$(CONFIG_FSL_EMB_PERF_EVENT) += core-fsl-emb.o obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o e6500-pmu.oarch/powerpc/perf/perf_regs.c new file +0
-0@@ -0,0 +1,91 @@
You may want to add a copyright header here.
arch/powerpc/perf/perf_regs.c line 10
Quoted 10 lines
arch/powerpc/perf/perf_regs.c new file +10
-0+#include <linux/errno.h> +#include <linux/kernel.h> +#include <linux/sched.h> +#include <linux/perf_event.h> +#include <linux/bug.h> +#include <linux/stddef.h> +#include <asm/ptrace.h> +#include <asm/perf_regs.h> + +#define PT_REGS_OFFSET (id, r) [id] = offsetof(struct pt_regs, r)
Also, run this through checkpatch.pl. There is a whitespace issue reported here.
Quoted 60 lines
arch/powerpc/perf/perf_regs.c new file +60
-0+ +#define REG_RESERVED (~((1ULL << PERF_REG_POWERPC_MAX) - 1)) + +static unsigned int pt_regs_offset[PERF_REG_POWERPC_MAX ] = { +PT_REGS_OFFSET (PERF_REG_POWERPC_R0 , gpr[0 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R1 , gpr[1 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R2 , gpr[2 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R3 , gpr[3 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R4 , gpr[4 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R5 , gpr[5 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R6 , gpr[6 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R7 , gpr[7 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R8 , gpr[8 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R9 , gpr[9 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R10 , gpr[10 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R11 , gpr[11 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R12 , gpr[12 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R13 , gpr[13 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R14 , gpr[14 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R15 , gpr[15 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R16 , gpr[16 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R17 , gpr[17 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R18 , gpr[18 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R19 , gpr[19 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R20 , gpr[20 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R21 , gpr[21 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R22 , gpr[22 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R23 , gpr[23 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R24 , gpr[24 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R25 , gpr[25 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R26 , gpr[26 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R27 , gpr[27 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R28 , gpr[28 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R29 , gpr[29 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R30 , gpr[30 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_R31 , gpr[31 ]), +PT_REGS_OFFSET (PERF_REG_POWERPC_NIP , nip), +PT_REGS_OFFSET (PERF_REG_POWERPC_MSR , msr), +PT_REGS_OFFSET (PERF_REG_POWERPC_ORIG_R3 , orig_gpr3), +PT_REGS_OFFSET (PERF_REG_POWERPC_CTR , ctr), +PT_REGS_OFFSET (PERF_REG_POWERPC_LNK , link), +PT_REGS_OFFSET (PERF_REG_POWERPC_XER , xer), +PT_REGS_OFFSET (PERF_REG_POWERPC_CCR , ccr), +PT_REGS_OFFSET (PERF_REG_POWERPC_SOFTE , softe), +PT_REGS_OFFSET (PERF_REG_POWERPC_TRAP , trap), +PT_REGS_OFFSET (PERF_REG_POWERPC_DAR , dar), +PT_REGS_OFFSET (PERF_REG_POWERPC_DSISR , dsisr), +}; + +u64 perf_reg_value (struct pt_regs *regs,int idx) +{ +if (WARN_ON_ONCE (idx >=PERF_REG_POWERPC_MAX )) +return 0 ; + +return regs_get_register (regs, pt_regs_offset[idx]); +} + +int perf_reg_validate (u64 mask) +{ +if (!mask || mask ®_RESERVED )
arch/powerpc/perf/perf_regs.c line 80
Quoted 10 lines
arch/powerpc/perf/perf_regs.c new file +10
-0+return -EINVAL ; +return 0 ; +} + +u64 perf_reg_abi (struct task_struct *task) +{ +#ifdef __powerpc64__ +if (!test_tsk_thread_flag (task,TIF_32BIT )) +return PERF_SAMPLE_REGS_ABI_64 ; +else
The 'else' above is redundant.
- Naveen
Quoted 14 lines
arch/powerpc/perf/perf_regs.c new file +11
-0+#endif +return PERF_SAMPLE_REGS_ABI_32 ; +} + +void perf_get_regs_user (struct perf_regs *regs_user, +struct pt_regs *regs, +struct pt_regs *regs_user_copy) +{ + regs_user->regs =task_pt_regs (current); + regs_user->abi =perf_reg_abi (current); +}Signature · 1 line
2.1.0
Re: [V11,1/4] perf/powerpc: assign an id to each powerpc register
In reply to Anju TQuoted 5 lines · Anju T
The enum definition assigns an 'id' to each register in "struct
pt_regs" ofarch/powerpc. The order of these values in the enum definition are based on the corresponding macros inarch/powerpc/include/uapi/asm/ptrace.h.Signed-off-by Anju T <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/1bfadabfebc671a6af0f5008b5
cheers
Re: [V11,2/4] perf/powerpc: add support for sampling intr machine state
In reply to Anju TQuoted 8 lines · Anju T
The perf infrastructure uses a bit mask to find out valid registers to display. Define a register mask for supported registers defined in
asm/perf_regs.h. The bit positions also correspond to register IDs which is used by perf infrastructure to fetch the register values.CONFIG_HAVE_PERF_REGSenables sampling of the interrupted machine state.Signed-off-by Anju T <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/ed4a4ef85cf5b7523107950103
cheers
Re: [V11,3/4] tools/perf: Map the ID values with register names
In reply to Anju TQuoted 58 lines · Anju T
Map ID values with corresponding register names. These names are then displayed when user issues perf record with the -I option followed by perf report/script with -D option.
To test this patchset,
Eg:$ perf record -I ls # record machine state at interrupt $ perf script -D # read the perf.data fileSample output obtained for this patch / output looks like as follows:
496768515470
0x1988[0x188]:PERF_RECORD_SAMPLE(IP, 0x1): 4522/4522:0xc0000000001e538cperiod: 1 addr: 0 ... intr regs: mask0x7ffffffffffABI 64-bit.... r0 0xc0000000001e5e34 .... r1 0xc000000fe733f9a0 .... r2 0xc000000001523100 .... r3 0xc000000ffaadeb60 .... r4 0xc000000003456800 .... r5 0x73a9b5e000 .... r6 0x1e000000 .... r7 0x0 .... r8 0x0 .... r9 0x0 .... r10 0x1 .... r11 0x0 .... r12 0x24022822 .... r13 0xc00000000feec180 .... r14 0x0 .... r15 0xc000001e4be18800 .... r16 0x0 .... r17 0xc000000ffaac5000 .... r18 0xc000000fe733f8a0 .... r19 0xc000000001523100 .... r20 0xc00000000009fd1c .... r21 0xc000000fcaa69000 .... r22 0xc0000000001e4968 .... r23 0xc000000001523100 .... r24 0xc000000fe733f850 .... r25 0xc000000fcaa69000 .... r26 0xc000000003b8fcf0 .... r27 0xfffffffffffffead .... r28 0x0 .... r29 0xc000000fcaa69000 .... r30 0x1 .... r31 0x0 .... nip 0xc0000000001dd320 .... msr 0x9000000000009032 .... orig_r3 0xc0000000001e538c .... ctr 0xc00000000009d550 .... link 0xc0000000001e5e34 .... xer 0x0 .... ccr 0x84022882.... softe
0x0
.... trap0xf01
.... dar0x0
.... dsisr0xf00040060000004
... thread: :4522:4522
...... dso:/root/.debug/.build-id/b0/ef11b1a1629e62ac9de75199117ee5ef9469e9
Quoted 3 lines
:4522 4522 496.768515: 1 cycles: c0000000001e538c .perf_event_context_sched_in (/boot/vmlinux)Signed-off-by Anju T <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/dc642e8388b63a9a221903584b
cheers
Re: [V2,4/4] tool/perf: Add sample_reg_mask to include all perf_regs
In reply to Anju TQuoted 6 lines · Anju T
From: Madhavan Srinivasan <[email protected]>
Add
sample_reg_maskarray withpt_regsregisters. This is needed for printing supported regs ( -I? option).Signed-off-by Madhavan Srinivasan <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/bb62bad623deb7952aef13fcbe
cheers
Michael Ellerman
reviewerQuoted 7 lines · Arnaldo Carvalho de Melo
Em Wed, Apr 20, 2016 at 02:55:58PM +1000, Michael Ellerman escreveu:
Quoted 6 lines · Arnaldo Carvalho de Melo
Quoted 2 lines
Even the bits in
tools/perf/are arch specific, so I guess this goes via the powerpc tree? Michael?Yeah if that's OK with you.
Quoted 7 lines
Quoted 3 lines
It doesn't look like it will generate much in the way of merge conflicts.
Do you want to send an ack?
For the
tools/perf/bits:
Thanks.
cheers