mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/7] parisc: perf: fix the RDR tables and add PA-8800/PA-8900 counters
@ 2026-11-27  5:02 Matt Turner
  2026-11-27  5:02 ` [PATCH 1/7] parisc: perf: swap the PCX-U and PCX-W RDR tables Matt Turner
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Matt Turner @ 2026-11-27  5:02 UTC (permalink / raw)
  To: James E.J. Bottomley, Helge Deller, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
	James Clark
  Cc: linux-parisc, linux-kernel, linux-perf-users, Matt Turner

The first two patches fix the RDR width tables of the existing /dev/perf
driver: the PCX-U and PCX-W tables have been swapped since the driver
was added, and PCX-W2 needs widths of its own. Both are taken from the
RDR description tables in the PA-8500/PA-8600 and PA-8700 PDC firmware.
I have no PA-8x00 machine older than PA-8800 to test them on.

The rest adds support for the PA-8800 and PA-8900 (Mako) counters, which
/dev/perf claimed to support but could not program: they sit in RDR15
of a second RDR chain that is shared by the two cores of a processor.
The access sequences and the event image come from the C8000 PDC 2.13
firmware's PDC_INTRIGUE implementation.

The firmware's image counts only TLB misses and cycles, on the first
core, and nothing documents the other event selections, so I found them
on a C8000. I flipped every bit of the RDRs the image writes, one at a
time, in sweeps of several thousand settings each, and compared the
counts against about 30 small assembly loops with known numbers of
loads, stores, branches, cache and TLB misses and nullified
instructions. Many settings take an HPMC or hang the machine and need a
reset through the BMC. The bits that select events turned out to be
spread over three RDRs on both chains. This found cycles, stall and
non-stall cycles, instructions with and without nullified ones, TLB
misses of either kind, TLB handler cycles, loads and stores, D-cache
misses, branches, taken branches and an instruction match filter.

I expected to find at least what the PA-8500 to PA-8700 images in
perf_images.h count, but mispredicted branches, I-cache misses, return
stack predictions, branch abort stalls and D-cache misses inside the TLB
handler are still missing. I also could not find any HP-UX tool that
used the counters on PA-8800 or later. The last release of CXperf was in
2001, two years before the PA-8800 came out, and its HP-UX 11.11 kernel
module does not program the PA-8x00 counters at all. Caliper was to be
ported to PA-RISC but only ever shipped for Itanium. The PA-RISC kernel
of HP-UX 11.31 has a cpu_is_a_MAKO flag, but nothing reads it.

On a Mako, PA_PERF_ON currently runs pmenb on counters that have never
been configured, and that takes an HPMC on both cores of the processor.
Patch 4 loads the firmware's image first. Getting a report out of that
HPMC, and out of the ones the RDR bit sweep caused, took the HPMC
handler fixes sent as "parisc: fix the TOC and HPMC handlers on 64-bit
SMP":

https://lore.kernel.org/r/20261126-parisc-hpmc-fixes-v1-0-80fb55336ac6@gmail.com

The two series do not depend on each other.

Patch 5 exposes the counters as a perf events "cpu" PMU, so that perf
stat works, and patches 6 and 7 add the stall, TLB handler, filtered,
memory and branch events. The counters cannot interrupt and do not
distinguish privilege levels, so there is no sampling and no exclude_*
support. /dev/perf only loads the firmware's image and gains no new ABI.

Tested on a C8000 (2x PA-8900, 4 CPUs, 1.1 GHz) together with the cr16
and HPMC series: on every CPU, alone and with all four counting at once,
a pinned loop of known instructions counts 1.0011-1.0014 of them, also
over 18 * 10^9 instructions and eight counter wraps, and the cycle count
read through /dev/perf runs at 1100.6-1101.5 MHz. The memory, branch and
filter events count the expected number per iteration of small loops of
loads, stores, branches and adds. Events that would disturb the other
core of a processor wait while it has events, and /dev/perf and perf
events refuse each other with EBUSY.

---
Matt Turner (7):
      parisc: perf: swap the PCX-U and PCX-W RDR tables
      parisc: perf: add an RDR table for PCX-W2 (PA-8700)
      parisc: perf: add PA-8800/PA-8900 RDR and DR2 access
      parisc: perf: program the PA-8800/PA-8900 counters
      parisc: perf: add a perf events PMU for PA-8800/PA-8900
      parisc: perf: add PA-8800/PA-8900 event sets and an instruction filter
      parisc: perf: add PA-8800/PA-8900 memory and branch events

 arch/parisc/kernel/Makefile          |   5 +-
 arch/parisc/kernel/perf.c            |  88 +++++-
 arch/parisc/kernel/perf_asm.S        | 163 ++++++++++
 arch/parisc/kernel/perf_event_mako.c | 586 +++++++++++++++++++++++++++++++++++
 arch/parisc/kernel/perf_mako.c       | 565 +++++++++++++++++++++++++++++++++
 arch/parisc/kernel/perf_mako.h       |  88 ++++++
 arch/parisc/kernel/perf_mako_image.h | 208 +++++++++++++
 7 files changed, 1685 insertions(+), 18 deletions(-)
---
base-commit: 9437ee8b6cf607e883b36e44bd755968daaebd48
change-id: 20261126-parisc-perf-pa8800-07b6b144da8b

Best regards,
--  
Matt Turner <mattst88@gmail.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-27  5:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27  5:02 [PATCH 0/7] parisc: perf: fix the RDR tables and add PA-8800/PA-8900 counters Matt Turner
2026-11-27  5:02 ` [PATCH 1/7] parisc: perf: swap the PCX-U and PCX-W RDR tables Matt Turner
2026-11-27  5:02 ` [PATCH 2/7] parisc: perf: add an RDR table for PCX-W2 (PA-8700) Matt Turner
2026-11-27  5:02 ` [PATCH 3/7] parisc: perf: add PA-8800/PA-8900 RDR and DR2 access Matt Turner
2026-11-27  5:02 ` [PATCH 4/7] parisc: perf: program the PA-8800/PA-8900 counters Matt Turner
2026-11-27  5:02 ` [PATCH 5/7] parisc: perf: add a perf events PMU for PA-8800/PA-8900 Matt Turner
2026-11-27  5:02 ` [PATCH 6/7] parisc: perf: add PA-8800/PA-8900 event sets and an instruction filter Matt Turner
2026-11-27  5:03 ` [PATCH 7/7] parisc: perf: add PA-8800/PA-8900 memory and branch events Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®