Skip to content

Support hardware perf counters on xtensa

Max Filippov lkml stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest13 patches 6 repliesIn review
  2. v18 patches 11 repliesSuperseded

Changes in v2 from the cover letter

- make continuous stack changes conditional;
- replace l32i/s32i + add used to access spilled registers with l32e/s32e;
- use -EINVAL instead of -ENOENT for invalid PMU event configuratons;
- fix kernel register spilling code;
- optionally treat perf IRQ as NMI.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13xtensa: clean up Kconfig dependencies for custom coresarch/xtensa/Kconfig+3 -80 replies
2/13xtensa: keep exception/interrupt stack continuousarch/xtensa/kernel/entry.S+44 -150 replies
3/13xtensa: move oprofile stack tracing to stacktrace.carch/xtensa/include/asm/stacktrace.h arch/xtensa/kernel/stacktrace.c arch/xtensa/oprofile/backtrace.c+182 -1510 replies
4/13xtensa: select PERF_USE_VMALLOC for cache-aliasing configurationsarch/xtensa/Kconfig+1 -00 replies
5/13xtensa: add profiling IRQ type to xtensa_irq_maparch/xtensa/kernel/irq.c+6 -00 replies
6/13xtensa: count software page fault perf eventsarch/xtensa/mm/fault.c+7 -00 replies
7/13xtensa: implement counting and sampling perf eventsarch/xtensa/Kconfig arch/xtensa/kernel/Makefile arch/xtensa/kernel/perf_event.c+461 -04 replies
8/13perf tools: xtensa: add DWARF register namestools/perf/arch/xtensa/Build tools/perf/arch/xtensa/Makefile tools/perf/arch/xtensa/util/Build +1 more+30 -00 replies
9/13xtensa: reorganize irq flags tracingarch/xtensa/kernel/entry.S arch/xtensa/kernel/traps.c+18 -260 replies
10/13xtensa: fix kernel register spillingarch/xtensa/include/asm/traps.h arch/xtensa/kernel/entry.S+21 -120 replies
11/13xtensa: don't touch EXC_TABLE_FIXUP in _switch_toarch/xtensa/kernel/entry.S+0 -40 replies
12/13xtensa: implement fake NMIarch/xtensa/include/asm/atomic.h arch/xtensa/include/asm/cmpxchg.h arch/xtensa/include/asm/irqflags.h +6 more+183 -272 replies
13/13xtensa: drop unused irq_err_countarch/xtensa/kernel/irq.c+0 -30 replies

Reviews trailers per patch

1 of 13 patches has a Reviewed-by or Acked-by.

PatchPeter Zijlstra (Intel)
1/13
2/13
3/13
4/13
5/13
6/13
7/13
8/13
9/13
10/13
11/13
12/13A-b
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/13] Support hardware perf counters on xtensa

Hello,

this series adds support for hardware performance counters in counting and sampling modes as well as for page fault counting. Perf IRQ is handled as NMI when configured properly (as the only topmost medium-priority interrupt).

It reorganizes stack tracing code to share it between old oprofile and new perf interfaces, and improves kernel stack traces both for builtin debug functions and for gdb.

There's also fixes and cleanups for the areas touched by the new features.

Changes v1->v2:
- make continuous stack changes conditional;
- replace l32i/s32i + add used to access spilled registers with l32e/s32e;
- use -EINVAL instead of -ENOENT for invalid PMU event configuratons;
- fix kernel register spilling code;
- optionally treat perf IRQ as NMI.

Max Filippov (13):
xtensa: clean up Kconfig dependencies for custom cores
xtensa: keep exception/interrupt stack continuous
xtensa: move oprofile stack tracing to stacktrace.c
xtensa: select PERF_USE_VMALLOC for cache-aliasing configurations
xtensa: add profiling IRQ type to xtensa_irq_map
xtensa: count software page fault perf events
xtensa: implement counting and sampling perf events perf tools: xtensa: add DWARF register names
xtensa: reorganize irq flags tracing
xtensa: fix kernel register spilling
xtensa: don't touch EXC_TABLE_FIXUP in _switch_to
xtensa: implement fake NMI
xtensa: drop unused irq_err_count

 arch/xtensa/Kconfig                      |  22 +-
 arch/xtensa/include/asm/atomic.h         |  10 +-
 arch/xtensa/include/asm/cmpxchg.h        |   4 +-
 arch/xtensa/include/asm/irqflags.h       |  22 +-
 arch/xtensa/include/asm/processor.h      |  31 ++-
 arch/xtensa/include/asm/stacktrace.h     |   8 +
 arch/xtensa/include/asm/traps.h          |  29 +-
 arch/xtensa/kernel/Makefile              |   1 +
 arch/xtensa/kernel/entry.S               | 197 ++++++++++----
 arch/xtensa/kernel/irq.c                 |  17 +-
 arch/xtensa/kernel/perf_event.c          | 454 +++++++++++++++++++++++++++++++
 arch/xtensa/kernel/stacktrace.c          | 167 +++++++++++-
 arch/xtensa/kernel/traps.c               |  31 ++-
 arch/xtensa/kernel/vectors.S             |  10 +-
 arch/xtensa/mm/fault.c                   |   7 +
 arch/xtensa/oprofile/backtrace.c         | 158 +----------
 tools/perf/arch/xtensa/Build             |   1 +
 tools/perf/arch/xtensa/Makefile          |   3 +
 tools/perf/arch/xtensa/util/Build        |   1 +
 tools/perf/arch/xtensa/util/dwarf-regs.c |  25 ++
 20 files changed, 954 insertions(+), 244 deletions(-)
 create mode 100644 arch/xtensa/kernel/perf_event.c
 create mode 100644 tools/perf/arch/xtensa/Build
 create mode 100644 tools/perf/arch/xtensa/Makefile
 create mode 100644 tools/perf/arch/xtensa/util/Build
 create mode 100644 tools/perf/arch/xtensa/util/dwarf-regs.c
Signature · 1 line
1.8.1.4