Skip to content

Commit 3e02a44

Browse files
authored
Merge pull request #3186 from kieranhejmadi01/enable-spe
Enable SPE for Memory Access Recipe - LP
2 parents 5715b55 + fec25b6 commit 3e02a44

10 files changed

Lines changed: 544 additions & 0 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: Enable Arm SPE for Performix memory access analysis
3+
4+
draft: true
5+
cascade:
6+
draft: true
7+
8+
description: Learn how to verify and enable Arm Statistical Profiling Extension (SPE) on Arm Linux machines, including systems hosted through cloud service providers, so the Memory Access recipe in Arm Performix can run on supported environments.
9+
10+
minutes_to_complete: 30
11+
12+
who_is_this_for: This is an introductory topic for software developers and performance engineers who want to prepare Arm Linux machines, including cloud-hosted systems, for Arm Performix memory access profiling.
13+
14+
learning_objectives:
15+
- Check whether Arm Statistical Profiling Extension (SPE) is already available on an Arm Linux system using Sysreport and kernel-level checks.
16+
- Explain the hardware, platform, and kernel requirements that allow Linux to expose the SPE driver.
17+
- Apply Linux-side changes such as loading the SPE PMU module, installing matching kernel modules, or selecting an OS/kernel with SPE support.
18+
- Identify when a cloud instance does not expose SPE to the guest OS and choose a suitable system for Arm Performix memory access analysis.
19+
20+
prerequisites:
21+
- Access to a Linux-based Arm system, such as an Arm cloud instance or bare-metal server, with sudo or root access.
22+
- Access to Arm Performix on your host machine and SSH access to the target system. See the [Arm Performix install guide](/install-guides/performix/) for setup instructions.
23+
- Familiarity with the Linux command line and SSH.
24+
25+
author: Kieran Hejmadi
26+
27+
### Tags
28+
skilllevels: Introductory
29+
subjects: Performance and Architecture
30+
cloud_service_providers:
31+
- AWS
32+
- Google Cloud
33+
- Microsoft Azure
34+
armips:
35+
- Neoverse
36+
tools_software_languages:
37+
- Arm Performix
38+
- Sysreport
39+
- Linux kernel
40+
- perf
41+
operatingsystems:
42+
- Linux
43+
44+
further_reading:
45+
- resource:
46+
title: Arm Performix install guide
47+
link: https://learn.arm.com/install-guides/performix/
48+
type: documentation
49+
- resource:
50+
title: Arm Statistical Profiling Extension documentation
51+
link: https://developer.arm.com/documentation/100616/0401/?lang=en
52+
type: documentation
53+
- resource:
54+
title: Arm Performix
55+
link: https://developer.arm.com/servers-and-cloud-computing/arm-performix
56+
type: website
57+
- resource:
58+
title: Get ready for performance analysis with Sysreport
59+
link: https://learn.arm.com/learning-paths/servers-and-cloud-computing/sysreport/
60+
type: documentation
61+
- resource:
62+
title: Analyze cache behavior with Perf C2C on Arm
63+
link: https://learn.arm.com/learning-paths/servers-and-cloud-computing/false-sharing-arm-spe/
64+
type: learning-path
65+
66+
67+
68+
### FIXED, DO NOT MODIFY
69+
# ================================================================================
70+
weight: 1 # _index.md always has weight of 1 to order correctly
71+
layout: "learningpathall" # All files under learning paths have this same wrapper
72+
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
73+
---
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
# ================================================================================
3+
# FIXED, DO NOT MODIFY THIS FILE
4+
# ================================================================================
5+
weight: 21 # The weight controls the order of the pages. _index.md always has weight 1.
6+
title: "Next Steps" # Always the same, html page title.
7+
layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing.
8+
---
123 KB
Loading
66.2 KB
Loading
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Get started
3+
weight: 2
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
## What is Arm Statistical Profiling Extension
10+
11+
Arm Statistical Profiling Extension (SPE) is a hardware-assisted profiling feature in the Arm A-profile architecture. It was introduced with Armv8.2-A and extended in later architecture revisions. Most modern Arm-based cloud systems support SPE.
12+
13+
Unlike traditional interrupt-driven sampling, SPE records rich metadata for sampled operations, including instruction context, memory address information, and latency-related attributes. This improves attribution accuracy and helps reduce drift (also called skid) when mapping instructions to sampled counts. For more background, see the [performance analysis white paper](https://developer.arm.com/documentation/109429/latest/).
14+
15+
For Arm Performix, this matters because SPE must be enabled to use the `Memory Access` recipe.
16+
17+
## Understand the platform layers that enable SPE
18+
19+
On Linux, SPE is available only when all required layers are aligned:
20+
21+
- **Architecture layer**: the CPU must implement SPE (common on Arm Neoverse systems and the Arm AGI CPU).
22+
- **Firmware layer**: platform firmware must advertise the SPE PMU and its interrupt path through ACPI or Device Tree. This is usually already enabled, so this check is often skipped.
23+
- **Kernel layer**: the running kernel must be built with Arm SPE PMU support through the `CONFIG_ARM_SPE_PMU` kernel build option.
24+
- **Driver layer**: the `arm_spe_pmu` driver must initialize successfully (built-in or loaded as a module). This requires all the above layers to have Arm SPE support.
25+
26+
If any of these layers are missing, Linux cannot expose SPE to profiling tools. Additionally, cloud-based applications usually run on top of a hypervisor which typically disables SPE.
27+
28+
{{% notice Please Note %}}
29+
30+
Cloud providers often disable low-level profiling features on shared (multi-tenant) instances. To use Performix memory access profiling, run your application on an Arm-based **bare-metal instance** with full hardware access. These instances are typically named `metal` instances.
31+
32+
Be aware that this instance type typically has a higher cost.
33+
34+
{{% /notice %}}
35+
36+
37+
## What is usually already present
38+
39+
On Neoverse-based systems, architecture support is already present, and firmware support is usually present.
40+
41+
This Learning Path helps you determine which case applies to your system and what action to take next. Because Linux distributions and kernel versions vary widely, this Learning Path provides practical guidance rather than an exhaustive set of steps.
42+
43+
## Check if Arm SPE is enabled
44+
45+
Open Performix from your local machine. If this is your first time using or installing Performix, see the [install guide](https://learn.arm.com/install-guides/performix/).
46+
47+
Connect to your instance, select the `Recipes` tab, and then select the `Memory Access` recipe. This automatically runs a precheck and prints the status at the bottom of the page. If you receive the **SPE is not configured** status shown below, you need to enable SPE before you can run the recipe.
48+
49+
![Screenshot of the Arm Performix Memory Access recipe showing a red status notification at the bottom of the page indicating that SPE has not been configured for the target system. This is the expected message when the arm_spe_pmu driver is missing or not loaded.#center](./memory-access-no-spe.png "Arm Performix Memory Access recipe reporting that SPE is not configured")
50+
51+
If you receive a different error message, SPE is likely **not** the cause of your issue. See the [Performix user guide](https://developer.arm.com/documentation/110163/latest).
52+
53+
54+
55+
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
---
2+
title: Assess OS kernel
3+
weight: 3
4+
5+
### FIXED, DO NOT MODIFY
6+
layout: learningpathall
7+
---
8+
9+
### Step 1.0) Check whether the OS kernel is built with SPE
10+
11+
From the Getting Started section, you know you need to verify both the kernel and driver layers. Start by checking the kernel version:
12+
13+
```bash
14+
uname -r
15+
```
16+
The output will be similar to:
17+
18+
```output
19+
6.17.0-1010-aws
20+
```
21+
22+
This AWS instance is running the standard Ubuntu 24.04 LTS Amazon Machine Image (AMI) provided through AWS Quick Start. The command output shows a Linux 6.17 kernel, and the `1010-aws` suffix indicates an AWS-specific build customized for the AWS environment.
23+
24+
Now check whether this kernel was built with SPE support enabled:
25+
26+
```bash
27+
grep CONFIG_ARM_SPE_PMU /boot/config-$(uname -r) 2>/dev/null || true
28+
```
29+
30+
The possible outputs are `y`, `m`, or `n`, meaning built-in support, module support, or no support.
31+
32+
- `y` indicates that the kernel was built with SPE support.
33+
- `m` indicates that SPE is available as a loadable kernel module. This is the typical output for cloud instances.
34+
- `n` means the kernel was **not** built with SPE support.
35+
36+
If the output from the previous command is `CONFIG_ARM_SPE_PMU = n`, **skip directly to Step 3.0**.
37+
38+
If the output from the previous command is `CONFIG_ARM_SPE_PMU = y`, **you can skip directly to step 1.2.**
39+
40+
### Step 1.1) Check whether the kernel module is available
41+
42+
If your output was `CONFIG_ARM_SPE_PMU = m`, as shown below, the OS kernel includes SPE support. However, you still need to confirm that the driver layer is present and can be loaded.
43+
44+
```output
45+
CONFIG_ARM_SPE_PMU = m
46+
```
47+
48+
Run the following command to check whether the loadable kernel module (driver) is available on the target:
49+
50+
```bash
51+
modinfo arm_spe_pmu 2>/dev/null || echo "arm_spe_pmu not present for this kernel"
52+
```
53+
54+
If you see output similar to the following, `arm_spe_pmu` is built as a module. If you see `arm_spe_pmu not present for this kernel`, continue to step 1.2. We will attempt to find and install the module for our specific kernel in later steps.
55+
56+
```output
57+
filename: /lib/modules/6.17.0-1010-aws/kernel/drivers/perf/arm_spe_pmu.ko.zst
58+
license: GPL v2
59+
author: Will Deacon <will.deacon@arm.com>
60+
description: Perf driver for the ARMv8.2 Statistical Profiling Extension
61+
srcversion: 3B6FCB5AD9B37B8BB9FF4A9
62+
...
63+
```
64+
65+
Next, run the following command to load the driver:
66+
67+
```bash
68+
sudo modprobe arm_spe_pmu
69+
lsmod | grep arm_spe_pmu
70+
```
71+
72+
If it loads correctly, the output will be similar to:
73+
74+
```output
75+
arm_spe_pmu 24576 0
76+
```
77+
78+
In Step 1.2, use Sysreport to review system-level metrics, including SPE status.
79+
80+
### Step 1.2) Run Sysreport
81+
82+
Follow the steps in the [Get ready for performance analysis with Sysreport guide](https://learn.arm.com/learning-paths/servers-and-cloud-computing/sysreport/) and run `sysreport` on your system:
83+
84+
```bash
85+
python /src/sysreport.py
86+
```
87+
88+
This prints information about your system, including whether SPE is enabled. The `perf sampling` label shows SPE status. It also provides useful details for further debugging.
89+
90+
```output
91+
System feature report:
92+
Collected: 2026-04-13 09:40:16.344396
93+
Script version: 2026-04-08 08:08:28.656402
94+
Running as root: False
95+
System hardware:
96+
Architecture: ARMv8.4
97+
CPUs: 64
98+
CPU types: 64 x Arm Neoverse V1 r1p1
99+
cache info: size, associativity, sharing
100+
cache line size: 64
101+
Caches:
102+
64 x L1D 64K 4-way 64b-line
103+
64 x L1I 64K 4-way 64b-line
104+
64 x L2U 1M 8-way 64b-line
105+
1 x L3U 32M 16-way 64b-line
106+
System memory: 126G
107+
Atomic operations: True
108+
interconnect: CMN-650 x 1
109+
NUMA nodes: 1
110+
Sockets: 1
111+
OS configuration:
112+
Kernel: 6.17.0
113+
config: /boot/config-6.17.0-1010-aws
114+
build dir: /lib/modules/6.17.0-1010-aws/build
115+
uses atomics: True
116+
page size: 4K
117+
huge pages: 2048kB: 0, 32768kB: 0, 64kB: 0, 1048576kB: 0
118+
transparent HP: madvise
119+
MPAM configured: False
120+
resctrl: False
121+
Distribution: Ubuntu 24.04.4 LTS
122+
libc version: glibc 2.39
123+
boot info: ACPI
124+
KPTI enforced: False
125+
Lockdown: landlock, lockdown, yama, integrity, apparmor
126+
Mitigations: spectre_v2:CSV2, BHB; spec_store_bypass:Speculative Store Bypass disabled via prctl; spectre_v1:__user pointer sanitization
127+
Performance features:
128+
perf tools: True
129+
perf installed at: /usr/lib/linux-tools/6.17.0-1010-aws/perf
130+
perf with OpenCSD: False
131+
perf counters: 6
132+
perf sampling: None
133+
perf HW trace: None
134+
perf paranoid: 0
135+
CAP_PERFMON: disabled
136+
kptr_restrict: 1
137+
perf in userspace: disabled
138+
interconnect perf: True
139+
/proc/kcore: True
140+
/dev/mem: True
141+
eBPF:
142+
kernel configured for BPF: True
143+
bpftool installed: True
144+
bpftool v7.7.0 using libbpf v1.7 features:
145+
bpftrace installed: bpftrace v0.20.2
146+
147+
148+
Actions that can be taken to improve performance tools experience:
149+
perf tools cannot decode hardware trace
150+
build with CORESIGHT=1
151+
non-invasive sampling (SPE) not enabled
152+
ensure APIC table describes SPE interrupt
153+
kernel module arm_spe_pmu.ko must be built
154+
hardware trace not enabled
155+
rebuild kernel with CONFIG_CORESIGHT
156+
ensure ACPI describes CoreSight trace fabric
157+
```
158+
159+
In this example, the output shows `perf sampling: None`, so continue to the next step.

0 commit comments

Comments
 (0)