요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
======================================
CXL Performance Monitoring Unit (CPMU)
======================================
The CXL rev 3.0 specification provides a definition of CXL Performance
Monitoring Unit in section 13.2: Performance Monitoring.
CXL components (e.g. Root Port, Switch Upstream Port, End Point) may have
any number of CPMU instances. CPMU capabilities are fully discoverable from
the devices. The specification provides event definitions for all CXL protocol
message types and a set of additional events for things commonly counted on
CXL devices (e.g. DRAM events).
CPMU driver
===========
The CPMU driver registers a perf PMU with the name pmu_mem<X>.<Y> on the CXL bus
representing the Yth CPMU for memX.
/sys/bus/cxl/device/pmu_mem<X>.<Y>
The associated PMU is registered as
/sys/bus/event_sources/devices/cxl_pmu_mem<X>.<Y>
In common with other CXL bus devices, the id has no specific meaning and the
relationship to specific CXL device should be established via the device parent
of the device on the CXL bus.
PMU driver provides description of available events and filter options in sysfs.
The "format" directory describes all formats of the config (event vendor id,
group id and mask) config1 (threshold, filter enables) and config2 (filter
parameters) fields of the perf_event_attr structure. The "events" directory
describes all documented events show in perf list.
The events shown in perf list are the most fine grained events with a single
bit of the event mask set. More general events may be enable by setting
multiple mask bits in config. For example, all Device to Host Read Requests
may be captured on a single counter by setting the bits for all of
* d2h_req_rdcurr
* d2h_req_rdown
* d2h_req_rdshared
* d2h_req_rdany
* d2h_req_rdownnodata
Example of usage::
$#perf list
cxl_pmu_mem0.0/clock_ticks/ [Kernel PMU event]
cxl_pmu_mem0.0/d2h_req_rdshared/ [Kernel PMU event]
cxl_pmu_mem0.0/h2d_req_snpcur/ [Kernel PMU event]
cxl_pmu_mem0.0/h2d_req_snpdata/ [Kernel PMU event]
cxl_pmu_mem0.0/h2d_req_snpinv/ [Kernel PMU event]
-----------------------------------------------------------
$# perf stat -a -e cxl_pmu_mem0.0/clock_ticks/ -e cxl_pmu_mem0.0/d2h_req_rdshared/
Vendor specific events may also be available and if so can be used via
$# perf stat -a -e cxl_pmu_mem0.0/vid=VID,gid=GID,mask=MASK/
The driver does not support sampling so "perf record" is unsupported.
It only supports system-wide counting so attaching to a task is
unsupported.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
CXL 3.0 CPMU
1-15이 문서는 `SPDX-License-Identifier: GPL-2.0`입니다. `CXL Performance Monitoring Unit (CPMU)`는 CXL rev 3.0 specification의 section 13.2 `Performance Monitoring`에 정의됩니다.
Root Port, Switch Upstream Port, End Point 같은 CXL component는 CPMU instance를 임의 개수 가질 수 있으며 capability는 device에서 완전히 discover할 수 있습니다.
Specification은 모든 CXL protocol message type의 event와 `DRAM events`처럼 CXL device에서 흔히 count하는 추가 event를 정의합니다.
Bus device·perf PMU와 format
16-37CPMU driver는 CXL bus에서 memX의 Y번째 CPMU를 나타내는 `pmu_mem<X>.<Y>` 이름의 perf PMU를 등록합니다.
/sys/bus/cxl/device/pmu_mem<X>.<Y>
연결된 perf PMU는 다음 경로에 등록됩니다.
/sys/bus/event_sources/devices/cxl_pmu_mem<X>.<Y>
다른 CXL bus device처럼 ID 자체에는 특정 의미가 없으므로 CXL bus device의 parent를 통해 구체적인 CXL device와 관계를 확인해야 합니다.
Driver는 사용 가능한 event와 filter option을 sysfs에 설명합니다. `format` directory가 `perf_event_attr` field 형식을, `events` directory가 `perf list`에 표시되는 documented event를 제공합니다.
| Field | 내용 |
|---|---|
| `config` | Event vendor ID, group ID, mask |
| `config1` | Threshold, filter enables |
| `config2` | Filter parameters |
Fine-grained event mask 조합
38-49`perf list` event는 event mask bit 하나만 켠 가장 fine-grained event입니다. 더 일반적인 event는 `config`에서 mask bit 여러 개를 켜 활성화합니다.
예를 들어 모든 Device-to-Host Read Request를 counter 하나에서 capture하려면 다음 event bit를 모두 설정합니다.
| Event bit | Request |
|---|---|
| `d2h_req_rdcurr` | Device-to-host Read Current request |
| `d2h_req_rdown` | Device-to-host Read Own request |
| `d2h_req_rdshared` | Device-to-host Read Shared request |
| `d2h_req_rdany` | Device-to-host Read Any request |
| `d2h_req_rdownnodata` | Device-to-host Read Own No Data request |
Perf와 vendor-specific event
50-65`perf list`로 CPMU event를 확인하고 system-wide `perf stat`으로 clock tick과 protocol request를 count합니다.
$#perf list
cxl_pmu_mem0.0/clock_ticks/ [Kernel PMU event]
cxl_pmu_mem0.0/d2h_req_rdshared/ [Kernel PMU event]
cxl_pmu_mem0.0/h2d_req_snpcur/ [Kernel PMU event]
cxl_pmu_mem0.0/h2d_req_snpdata/ [Kernel PMU event]
cxl_pmu_mem0.0/h2d_req_snpinv/ [Kernel PMU event]
-----------------------------------------------------------
$# perf stat -a -e cxl_pmu_mem0.0/clock_ticks/ -e cxl_pmu_mem0.0/d2h_req_rdshared/
Vendor specific event가 있으면 `vid`, `gid`, `mask`를 직접 지정합니다.
$# perf stat -a -e cxl_pmu_mem0.0/vid=VID,gid=GID,mask=MASK/
지원 범위
66-68Driver는 sampling을 지원하지 않아 `perf record`가 unsupported입니다.
System-wide counting만 지원하므로 task attach도 unsupported입니다.
운영 핵심
cxl.rst:1-68CXL bus parent로 CPMU의 실제 component를 식별하고 sysfs event alias 또는 vendor ID·group ID·mask로 system-wide count합니다.