요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
=====================================================================
Qualcomm Technologies Level-2 Cache Performance Monitoring Unit (PMU)
=====================================================================
This driver supports the L2 cache clusters found in Qualcomm Technologies
Centriq SoCs. There are multiple physical L2 cache clusters, each with their
own PMU. Each cluster has one or more CPUs associated with it.
There is one logical L2 PMU exposed, which aggregates the results from
the physical PMUs.
The driver provides a description of its available events and configuration
options in sysfs, see /sys/bus/event_source/devices/l2cache_0.
The "format" directory describes the format of the events.
Events can be envisioned as a 2-dimensional array. Each column represents
a group of events. There are 8 groups. Only one entry from each
group can be in use at a time. If multiple events from the same group
are specified, the conflicting events cannot be counted at the same time.
Events are specified as 0xCCG, where CC is 2 hex digits specifying
the code (array row) and G specifies the group (column) 0-7.
In addition there is a cycle counter event specified by the value 0xFE
which is outside the above scheme.
The driver provides a "cpumask" sysfs attribute which contains a mask
consisting of one CPU per cluster which will be used to handle all the PMU
events on that cluster.
Examples for use with perf::
perf stat -e l2cache_0/config=0x001/,l2cache_0/config=0x042/ -a sleep 1
perf stat -e l2cache_0/config=0xfe/ -C 2 sleep 1
The driver does not support sampling, therefore "perf record" will
not work. Per-task perf sessions are not supported.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
L2 cluster와 논리 PMU
1-10이 driver는 Qualcomm Technologies Centriq SoC에 있는 L2 cache cluster를 지원합니다. 물리 L2 cache cluster는 여러 개이며, 각 cluster에는 자체 PMU가 있고 하나 이상의 CPU가 연결됩니다.
외부에는 논리적인 `L2 PMU` 하나만 노출됩니다. 이 장치는 여러 physical PMU가 낸 결과를 집계합니다.
Sysfs와 2차원 event 공간
11-26사용 가능한 event와 설정 option은 `/sys/bus/event_source/devices/l2cache_0` 아래 sysfs에서 확인합니다. `format` directory는 event 형식을 설명합니다.
Event는 2차원 배열로 생각할 수 있습니다. 열은 event group이며 총 8개입니다. 한 group에서는 한 항목만 사용할 수 있으므로 같은 group의 event를 여러 개 지정하면 충돌한 event를 동시에 셀 수 없습니다.
Event 값은 `0xCCG` 형식입니다. `CC`는 배열 행에 해당하는 2자리 16진수 code이고 `G`는 배열 열에 해당하는 0-7 group 번호입니다. Cycle counter event `0xFE`는 이 체계 밖에 있습니다.
| 필드 | 의미 |
|---|---|
| `CC` | 2자리 16진수 event code, 즉 배열의 행 |
| `G` | 0-7 group 번호, 즉 배열의 열 |
| 동시 사용 | 서로 다른 group은 함께 측정 가능 |
| 충돌 | 같은 group의 여러 event는 동시에 측정 불가 |
CPU affinity, 예제와 제한
27-39`cpumask` sysfs attribute에는 cluster마다 CPU 하나가 포함됩니다. 그 CPU가 해당 cluster의 모든 PMU event를 처리합니다.
perf stat -e l2cache_0/config=0x001/,l2cache_0/config=0x042/ -a sleep 1
첫 예제는 서로 다른 group의 event `0x001`과 `0x042`를 system-wide로 1초 동안 측정합니다. 다음 예제는 CPU 2에서 cycle event `0xfe`를 측정합니다.
perf stat -e l2cache_0/config=0xfe/ -C 2 sleep 1
Driver는 sampling을 지원하지 않으므로 `perf record`가 동작하지 않으며, per-task perf session도 지원하지 않습니다.
| 항목 | 경로 또는 의미 |
|---|---|
| 장치 | `/sys/bus/event_source/devices/l2cache_0` |
| `format` | Event 설정 형식 |
| `cpumask` | Cluster마다 event를 처리할 CPU 하나 |
| 집계 | Logical PMU가 physical PMU 결과를 합산 |
운영 요약
qcom_l2_pmu.rst:1-39Event의 마지막 16진수 자리로 group을 확인하고 같은 group의 event가 한 측정에 겹치지 않게 구성한 뒤 logical L2 PMU에서 cluster 결과를 집계합니다.