All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: irogers@google.com, linux-perf-users@vger.kernel.org,
	 linux-rpi-kernel@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,  mark.rutland@arm.com,
	u.kleine-koenig@baylibre.com, will@kernel.org
Subject: [PATCH v8 0/2] perf: Add Raspberry Pi AXI PMU driver
Date: Wed, 12 Aug 2026 23:42:26 -0700	[thread overview]
Message-ID: <20260813064228.2799872-1-irogers@google.com> (raw)
In-Reply-To: <20260813052419.2770841-1-irogers@google.com>

This patch series adds an uncore Performance Monitoring Unit (PMU) driver
for Broadcom AXI system and VideoCore VPU performance monitors found on
Raspberry Pi SoCs (BCM2835 through BCM2712 / Raspberry Pi 1 through 5).

Motivation & Background
=======================
Currently, Linux lacks a standard perf-API compatible driver for the
Broadcom AXI performance counter blocks on Raspberry Pi platforms. Prior
out-of-tree vendor solutions relied on custom debugfs nodes and ad-hoc
kthreads, preventing integration with standard Linux perf tooling.

This driver implements standard `struct pmu` hardware uncore callbacks
under `drivers/perf/`, exposing human-readable sysfs event aliases, unit
scaling (`Bytes`), and bus filtering directly to user space.

Key Architectural Improvements & Features
=========================================
1. Standard Linux Perf Integration:
   - Exposes uncore AXI interconnect events via sysfs boundaries.
   - Supports event sampling and hardware counter accumulation,
     automatically managing 31-bit hardware counter wraparound.

2. CPU Hotplug Support (`cpuhp`):
   - Registers dynamic CPU hotplug notifiers (`CPUHP_AP_ONLINE_DYN`).
   - Automatically migrates PMU context to an online CPU core when a
     designated CPU goes offline, avoiding stale uncore state.

3. Hybrid Memory-Mapped & Mailbox Work Queue Architecture:
   - System Monitor (MMIO): Performs fast atomic-safe memory reads
     directly mapped over ARM physical memory space.
   - VPU Monitor (Mailbox IPC): For Broadcom BCM2835-BCM2711 platforms,
     VideoCore VPU monitor IPC calls are offloaded to process context via
     a dedicated workqueue (`vpu_work`) and serialized.

4. PREEMPT_RT & Safety Hardening:
   - Uses HRTIMER_MODE_REL_SOFT for timer callbacks to execute in softirq
     context, avoiding local hard interrupt nesting priority deadlocks.

5. SoC Generation Support:
   - Patch 1 adds core driver support for Broadcom BCM2835-BCM2711.
   - Patch 2 expands support for Broadcom BCM2712 (Raspberry Pi 5).

Changes in v8
=============
- Fully transitioned locking architecture from 'spinlock_t' globally to
  'raw_spinlock_t' to mathematically guarantee fastpath safety against
  "scheduling while atomic" crashes during PREEMPT_RT deployment where
  the perf core unconditionally disables hard IRQs prior to PMU callbacks.
- Re-architected 'RPI_AXI_PMU_TIMER_INTERVAL' significantly downward from
  2000ms natively to 100ms. This acts as a structural baseline compromise
  that prevents excessive VideoCore Mailbox IPC context-switch wakeovers
  on older Pi 1/2 boards, while safely minimizing uncollected residuals
  causing 0-byte dropouts during time multiplexing/undersubscribed traces.
- Enforced strict 100-column sysfs string macro breakages globally.
- Added proper .scale and .unit bytes aliases across all AXI transaction
  events.
- Fixed a fatal use-after-free initialization race condition catching cases
  where cpuhp_state instances were registered prior to the PMU backend,
  which allowed concurrent CPU hotplug migrations to panic aggressively
  against unregistered core structures.

Ian Rogers (2):
  perf: Add Raspberry Pi BCM2835 AXI PMU driver
  perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support

 drivers/perf/rpi_axi_pmu.c | 2884 ++++++++++++++++++++++++++++++++++++
 1 file changed, 2884 insertions(+)
 create mode 100644 drivers/perf/rpi_axi_pmu.c

-- 
2.47.0

  parent reply	other threads:[~2026-08-13  6:42 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11  8:38 [PATCH v1 0/2] perf: Add Raspberry Pi AXI PMU driver Ian Rogers
2026-08-11  8:38 ` [PATCH v1 1/2] perf: Add Raspberry Pi BCM2835 " Ian Rogers
2026-08-11 14:32   ` Uwe Kleine-König
2026-08-11  8:38 ` [PATCH v1 2/2] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-11 23:51 ` [PATCH v2 0/2] perf: Add Raspberry Pi AXI PMU driver Ian Rogers
2026-08-11 23:51   ` [PATCH v2 1/2] perf: Add Raspberry Pi BCM2835 " Ian Rogers
2026-08-12  0:04     ` sashiko-bot
2026-08-11 23:51   ` [PATCH v2 2/2] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-12  0:05     ` sashiko-bot
2026-08-12  0:27   ` [PATCH v3 0/2] perf: Add Raspberry Pi AXI PMU driver Ian Rogers
2026-08-12  0:27     ` [PATCH v3 1/2] perf: Add Raspberry Pi BCM2835 " Ian Rogers
2026-08-12  0:40       ` sashiko-bot
2026-08-12  0:27     ` [PATCH v3 2/2] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-12  0:40       ` sashiko-bot
2026-08-12  5:24     ` [PATCH v4 0/2] perf: Add Raspberry Pi AXI PMU driver Ian Rogers
2026-08-12  5:24       ` [PATCH v4 1/2] perf: Add Raspberry Pi BCM2835 " Ian Rogers
2026-08-12  5:36         ` sashiko-bot
2026-08-12  5:24       ` [PATCH v4 2/2] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-12  5:34         ` sashiko-bot
2026-08-12  8:27       ` [PATCH v4 0/2] perf: Add Raspberry Pi AXI PMU driver Will Deacon
2026-08-12 13:38         ` Ian Rogers
2026-08-12 16:26           ` Uwe Kleine-König
2026-08-12 21:37             ` Ian Rogers
2026-08-13  6:59               ` Uwe Kleine-König
2026-08-13  8:41           ` Will Deacon
2026-08-13 13:44             ` Ian Rogers
2026-08-13 15:01               ` Uwe Kleine-König
2026-08-13  9:08         ` Peter Robinson
2026-08-13 13:48           ` Ian Rogers
2026-08-13 16:34             ` Florian Fainelli
2026-08-13 17:56               ` Ian Rogers
2026-08-12 23:01       ` [PATCH v5 " Ian Rogers
2026-08-12 23:01         ` [PATCH v5 1/2] perf: Add Raspberry Pi BCM2835 " Ian Rogers
2026-08-12 23:15           ` sashiko-bot
2026-08-12 23:01         ` [PATCH v5 2/2] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-12 23:18           ` sashiko-bot
2026-08-12 23:07         ` [PATCH v5 0/2] perf: Add Raspberry Pi AXI PMU driver Ian Rogers
2026-08-12 23:07         ` Ian Rogers
2026-08-12 23:07           ` [PATCH v5 1/2] perf: Add Raspberry Pi BCM2835 " Ian Rogers
2026-08-12 23:25             ` sashiko-bot
2026-08-13  0:06             ` Florian Fainelli
2026-08-12 23:08           ` [PATCH v5 2/2] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-12 23:24             ` sashiko-bot
2026-08-13  4:35         ` [PATCH v6 0/2] perf: Add Raspberry Pi AXI PMU driver Ian Rogers
2026-08-13  4:35           ` [PATCH v6 1/2] perf: Add Raspberry Pi BCM2835 " Ian Rogers
2026-08-13  4:48             ` sashiko-bot
2026-08-13  4:35           ` [PATCH v6 2/2] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-13  4:43             ` sashiko-bot
2026-08-13  5:24           ` [PATCH v7 0/2] perf: Add Raspberry Pi AXI PMU driver Ian Rogers
2026-08-13  5:24             ` [PATCH v7 1/2] perf: Add Raspberry Pi BCM2835 " Ian Rogers
2026-08-13  5:35               ` sashiko-bot
2026-08-13  5:24             ` [PATCH v7 2/2] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-13  5:46               ` sashiko-bot
2026-08-13  6:42             ` Ian Rogers [this message]
2026-08-13  6:42               ` [PATCH v8 1/2] perf: Add Raspberry Pi BCM2835 AXI PMU driver Ian Rogers
2026-08-13  6:51                 ` sashiko-bot
2026-08-13  6:42               ` [PATCH v8 2/2] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-13  6:52                 ` sashiko-bot
2026-08-13  7:30               ` [PATCH v9 0/2] perf: Add Raspberry Pi AXI PMU driver Ian Rogers
2026-08-13 14:26                 ` [PATCH v11 " Ian Rogers
2026-08-13  8:03                 ` [PATCH v10 " Ian Rogers
2026-08-13  7:30                 ` perf: Add Raspberry Pi BCM2835 " Ian Rogers
2026-08-13  7:40                   ` sashiko-bot
2026-08-13 17:31                   ` Florian Fainelli
2026-08-15  6:19                     ` Ian Rogers
2026-08-13  7:30                 ` perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-13  8:03                 ` perf: Add Raspberry Pi BCM2835 AXI PMU driver Ian Rogers
2026-08-13  8:13                   ` sashiko-bot
2026-08-13  8:03                 ` perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-13 14:26                 ` perf: Add Raspberry Pi BCM2835 AXI PMU driver Ian Rogers
2026-08-13 14:38                   ` sashiko-bot
2026-08-13 14:26                 ` perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-15  8:20                 ` [PATCH v12 0/3] perf: Add Raspberry Pi AXI PMU driver Ian Rogers
2026-08-15  8:20                   ` [PATCH v12 1/3] dt-bindings: perf: Add Broadcom Raspberry Pi AXI PMU definition Ian Rogers
2026-08-15  8:25                     ` sashiko-bot
2026-08-15  8:20                   ` [PATCH v12 2/3] perf: Add Raspberry Pi BCM2835 AXI PMU driver Ian Rogers
2026-08-15  8:30                     ` sashiko-bot
2026-08-15  8:20                   ` [PATCH v12 3/3] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-15  8:33                     ` sashiko-bot
2026-08-15 17:27                   ` [PATCH v13 0/3] perf: Add Raspberry Pi AXI PMU driver Ian Rogers
2026-08-15 17:27                     ` [PATCH v13 1/3] dt-bindings: perf: Add Broadcom Raspberry Pi AXI PMU definition Ian Rogers
2026-08-15 17:30                       ` sashiko-bot
2026-08-15 21:39                         ` Uwe Kleine-König
2026-08-17  6:19                       ` Krzysztof Kozlowski
2026-08-17  6:23                       ` Krzysztof Kozlowski
2026-08-17  6:59                         ` Ian Rogers
2026-08-17  7:27                           ` Krzysztof Kozlowski
2026-08-15 17:27                     ` [PATCH v13 2/3] perf: Add Raspberry Pi BCM2835 AXI PMU driver Ian Rogers
2026-08-15 17:35                       ` sashiko-bot
2026-08-15 17:27                     ` [PATCH v13 3/3] perf: Add Raspberry Pi 5 (BCM2712) AXI PMU support Ian Rogers
2026-08-15 17:38                       ` sashiko-bot
2026-08-15 18:40                     ` [PATCH v13 0/3] perf: Add Raspberry Pi AXI PMU driver Ian Rogers
2026-08-17  6:20                     ` Krzysztof Kozlowski
2026-08-17  6:57                       ` Ian Rogers
2026-08-17  7:26                         ` Krzysztof Kozlowski
2026-08-17  7:46                           ` Ian Rogers
2026-08-17  7:54                             ` Krzysztof Kozlowski
2026-08-17 12:51                               ` Ian Rogers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260813064228.2799872-1-irogers@google.com \
    --to=irogers@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.