요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
================================================
APM X-Gene SoC Performance Monitoring Unit (PMU)
================================================
X-Gene SoC PMU consists of various independent system device PMUs such as
L3 cache(s), I/O bridge(s), memory controller bridge(s) and memory
controller(s). These PMU devices are loosely architected to follow the
same model as the PMU for ARM cores. The PMUs share the same top level
interrupt and status CSR region.
PMU (perf) driver
-----------------
The xgene-pmu driver registers several perf PMU drivers. Each of the perf
driver provides description of its available events and configuration options
in sysfs, see /sys/bus/event_source/devices/<l3cX/iobX/mcbX/mcX>/.
The "format" directory describes format of the config (event ID),
config1 (agent ID) fields of the perf_event_attr structure. The "events"
directory provides configuration templates for all supported event types that
can be used with perf tool. For example, "l3c0/bank-fifo-full/" is an
equivalent of "l3c0/config=0x0b/".
Most of the SoC PMU has a specific list of agent ID used for monitoring
performance of a specific datapath. For example, agents of a L3 cache can be
a specific CPU or an I/O bridge. Each PMU has a set of 2 registers capable of
masking the agents from which the request come from. If the bit with
the bit number corresponding to the agent is set, the event is counted only if
it is caused by a request from that agent. Each agent ID bit is inversely mapped
to a corresponding bit in "config1" field. By default, the event will be
counted for all agent requests (config1 = 0x0). For all the supported agents of
each PMU, please refer to APM X-Gene User Manual.
Each perf driver also provides a "cpumask" sysfs attribute, which contains a
single CPU ID of the processor which will be used to handle all the PMU events.
Example for perf tool use::
/ # perf list | grep -e l3c -e iob -e mcb -e mc
l3c0/ackq-full/ [Kernel PMU event]
<...>
mcb1/mcb-csw-stall/ [Kernel PMU event]
/ # perf stat -a -e l3c0/read-miss/,mcb1/csw-write-request/ sleep 1
/ # perf stat -a -e l3c0/read-miss,config1=0xfffffffffffffffe/ sleep 1
The driver does not support sampling, therefore "perf record" will
not work. Per-task (without "-a") perf sessions are not supported.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
독립 system device PMU
1-9X-Gene SoC PMU는 L3 cache, I/O bridge, memory controller bridge, memory controller의 여러 독립 system device PMU로 구성됩니다.
이 PMU들은 ARM core PMU와 느슨하게 같은 모델을 따르며, top-level interrupt와 status CSR 영역을 공유합니다.
| 장치 종류 | Sysfs 이름 |
|---|---|
| L3 cache | `l3cX` |
| I/O bridge | `iobX` |
| Memory controller bridge | `mcbX` |
| Memory controller | `mcX` |
| 공통 sysfs | `/sys/bus/event_source/devices/<l3cX/iobX/mcbX/mcX>/` |
X-Gene perf driver와 event alias
10-22`xgene-pmu` driver는 여러 perf PMU driver를 등록합니다. 각 driver는 `/sys/bus/event_source/devices/<l3cX/iobX/mcbX/mcX>/` 아래에서 event와 설정 option을 설명합니다.
`format` directory는 `perf_event_attr` 구조체의 `config`(event ID)와 `config1`(agent ID) field 형식을 설명합니다. `events` directory는 perf가 사용할 수 있는 모든 지원 event type의 template을 제공합니다.
예를 들어 alias `l3c0/bank-fifo-full/`은 raw 설정 `l3c0/config=0x0b/`과 같습니다.
| Sysfs 항목 | 의미 |
|---|---|
| `format` | `config` event ID와 `config1` agent ID의 배치 |
| `events` | Perf가 사용할 수 있는 지원 event template |
| Alias | `l3c0/bank-fifo-full/` = `l3c0/config=0x0b/` |
| `cpumask` | 모든 PMU event를 처리하는 단일 CPU ID |
Agent ID 요청 filter
23-35대부분의 SoC PMU에는 특정 datapath의 성능을 감시하기 위한 agent ID 목록이 있습니다. 예를 들어 L3 cache의 agent는 특정 CPU나 I/O bridge일 수 있습니다.
각 PMU에는 요청을 보낸 agent를 mask하는 register 두 개가 있습니다. Agent에 해당하는 bit를 설정하면 그 agent의 요청이 일으킨 event만 셉니다.
각 agent ID bit는 `config1`의 대응 bit에 반대로 매핑됩니다. 기본 `config1 = 0x0`에서는 모든 agent 요청을 셉니다. PMU별 지원 agent는 APM X-Gene User Manual을 참조해야 합니다.
각 perf driver의 `cpumask` sysfs attribute에는 모든 PMU event를 처리할 processor의 단일 CPU ID가 들어 있습니다.
| 항목 | 동작 |
|---|---|
| Agent | 특정 CPU 또는 I/O bridge처럼 datapath 요청을 만든 주체 |
| Mask register | PMU마다 agent 요청을 거를 수 있는 register 2개 |
| Set bit | 해당 agent가 만든 요청일 때만 event를 count |
| 기본값 | `config1 = 0x0`, 모든 agent 요청을 count |
Perf discovery, 측정과 제한
36-49첫 명령은 L3C, IOB, MCB, MC event alias를 검색합니다. 출력 예시는 `l3c0/ackq-full/`에서 `mcb1/mcb-csw-stall/`까지 일부를 생략해 보여 줍니다.
/ # perf list | grep -e l3c -e iob -e mcb -e mc
l3c0/ackq-full/ [Kernel PMU event]
<...>
mcb1/mcb-csw-stall/ [Kernel PMU event]
다음 명령은 L3 read miss와 MCB cross-switch write request를 system-wide로 함께 측정합니다.
/ # perf stat -a -e l3c0/read-miss/,mcb1/csw-write-request/ sleep 1
마지막 명령은 `config1=0xfffffffffffffffe`로 agent filter를 지정해 L3 read miss를 측정합니다.
/ # perf stat -a -e l3c0/read-miss,config1=0xfffffffffffffffe/ sleep 1
Driver는 sampling을 지원하지 않으므로 `perf record`가 동작하지 않습니다. `-a`가 없는 per-task perf session도 지원하지 않습니다.
운영 요약
xgene-pmu.rst:1-49장치별 PMU event를 system-wide로 측정하고, 특정 CPU나 I/O bridge의 요청만 분리할 때 `config1` agent mask를 적용합니다.