요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
==========================
ARM Cache Coherent Network
==========================
CCN-504 is a ring-bus interconnect consisting of 11 crosspoints
(XPs), with each crosspoint supporting up to two device ports,
so nodes (devices) 0 and 1 are connected to crosspoint 0,
nodes 2 and 3 to crosspoint 1 etc.
PMU (perf) driver
-----------------
The CCN driver registers a perf PMU driver, which provides
description of available events and configuration options
in sysfs, see /sys/bus/event_source/devices/ccn*.
The "format" directory describes format of the config, config1
and config2 fields of the perf_event_attr structure. The "events"
directory provides configuration templates for all documented
events, that can be used with perf tool. For example "xp_valid_flit"
is an equivalent of "type=0x8,event=0x4". Other parameters must be
explicitly specified.
For events originating from device, "node" defines its index.
Crosspoint PMU events require "xp" (index), "bus" (bus number)
and "vc" (virtual channel ID).
Crosspoint watchpoint-based events (special "event" value 0xfe)
require "xp" and "vc" as above plus "port" (device port index),
"dir" (transmit/receive direction), comparator values ("cmp_l"
and "cmp_h") and "mask", being index of the comparator mask.
Masks are defined separately from the event description
(due to limited number of the config values) in the "cmp_mask"
directory, with first 8 configurable by user and additional
4 hardcoded for the most frequent use cases.
Cycle counter is described by a "type" value 0xff and does
not require any other settings.
The driver also provides a "cpumask" sysfs attribute, which contains
a single CPU ID, of the processor which will be used to handle all
the CCN PMU events. It is recommended that the user space tools
request the events on this processor (if not, the perf_event->cpu value
will be overwritten anyway). In case of this processor being offlined,
the events are migrated to another one and the attribute is updated.
Example of perf tool use::
/ # perf list | grep ccn
ccn/cycles/ [Kernel PMU event]
<...>
ccn/xp_valid_flit,xp=?,port=?,vc=?,dir=?/ [Kernel PMU event]
<...>
/ # perf stat -a -e ccn/cycles/,ccn/xp_valid_flit,xp=1,port=0,vc=1,dir=1/ \
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은 원문 표기를 유지합니다.
CCN-504 ring topology
1-9`ARM Cache Coherent Network`의 CCN-504는 `11 crosspoints (XPs)`로 구성된 ring-bus interconnect이며 각 XP는 최대 두 device port를 지원합니다.
따라서 node(device) 0·1은 crosspoint 0에, node 2·3은 crosspoint 1에 연결되는 방식으로 index가 배치됩니다.
PMU event와 watchpoint encoding
10-40CCN driver는 사용 가능한 event와 configuration option을 sysfs `/sys/bus/event_source/devices/ccn*`에 설명하는 perf PMU driver를 등록합니다.
`format` directory는 `perf_event_attr` structure의 `config`, `config1`, `config2` field 형식을 설명합니다. `events` directory는 문서화된 event의 perf configuration template을 제공합니다.
| Event 종류 | Parameter | 의미 |
|---|---|---|
| Device event | `node` | Device node index |
| Crosspoint event | `xp` | Crosspoint index |
| Crosspoint event | `bus` | Bus number |
| Crosspoint event | `vc` | Virtual channel ID |
| Watchpoint `event=0xfe` | `port` | Device port index |
| Watchpoint `event=0xfe` | `dir` | Transmit/receive direction |
| Watchpoint `event=0xfe` | `cmp_l`, `cmp_h` | Comparator values |
| Watchpoint `event=0xfe` | `mask` | `cmp_mask` comparator-mask index |
| Cycle counter | `type=0xff` | 다른 setting 불필요 |
| Event template | `xp_valid_flit` | `type=0x8,event=0x4`와 동일 |
Device-origin event에는 `node`를 지정합니다. Crosspoint event에는 `xp`, `bus`, `vc`가 필요합니다.
Special `event` 값 `0xfe`인 crosspoint watchpoint는 `xp`, `vc`와 함께 `port`, `dir`, comparator `cmp_l`·`cmp_h`, comparator-mask index인 `mask`가 필요합니다.
Mask는 config value 수가 제한돼 event description과 별도로 `cmp_mask` directory에 정의됩니다. 처음 8개는 user가 구성할 수 있고 추가 4개는 자주 쓰는 use case용으로 hardcoded됩니다.
Cycle counter는 `type=0xff`이며 다른 설정이 필요하지 않습니다.
Event 처리 CPU와 migration
41-48Driver의 `cpumask` sysfs attribute에는 모든 CCN PMU event를 처리할 processor의 단일 CPU ID가 들어 있습니다.
User-space tool은 이 processor에서 event를 요청하는 것이 좋습니다. 다른 CPU를 지정해도 `perf_event->cpu` 값이 덮어써집니다. 해당 processor가 offline되면 event를 다른 CPU로 migrate하고 attribute를 갱신합니다.
Perf 예시와 제한
49-61`perf list`에서 cycle과 `xp_valid_flit` template을 확인하고 XP·port·virtual channel·direction을 지정해 system-wide count합니다.
/ # perf list | grep ccn
ccn/cycles/ [Kernel PMU event]
<...>
ccn/xp_valid_flit,xp=?,port=?,vc=?,dir=?/ [Kernel PMU event]
<...>
/ # perf stat -a -e ccn/cycles/,ccn/xp_valid_flit,xp=1,port=0,vc=1,dir=1/ \
sleep 1
Driver는 sampling을 지원하지 않아 `perf record`가 동작하지 않으며 `-a` 없는 `Per-task` perf session도 지원하지 않습니다.
운영 핵심
arm-ccn.rst:1-61Event 종류에 맞는 node·XP·bus·VC·watchpoint parameter를 지정하고 `cpumask` CPU에서 system-wide로 측정합니다.