요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
======================================================================
Synopsys DesignWare Cores (DWC) PCIe Performance Monitoring Unit (PMU)
======================================================================
DesignWare Cores (DWC) PCIe PMU
===============================
The PMU is a PCIe configuration space register block provided by each PCIe Root
Port in a Vendor-Specific Extended Capability named RAS D.E.S (Debug, Error
injection, and Statistics).
As the name indicates, the RAS DES capability supports system level
debugging, AER error injection, and collection of statistics. To facilitate
collection of statistics, Synopsys DesignWare Cores PCIe controller
provides the following two features:
- one 64-bit counter for Time Based Analysis (RX/TX data throughput and
time spent in each low-power LTSSM state) and
- one 32-bit counter per event for Event Counting (error and non-error
events for a specified lane)
Note: There is no interrupt for counter overflow.
Time Based Analysis
-------------------
Using this feature you can obtain information regarding RX/TX data
throughput and time spent in each low-power LTSSM state by the controller.
The PMU measures data in two categories:
- Group#0: Percentage of time the controller stays in LTSSM states.
- Group#1: Amount of data processed (Units of 16 bytes).
Lane Event counters
-------------------
Using this feature you can obtain Error and Non-Error information in
specific lane by the controller. The PMU event is selected by all of:
- Group i
- Event j within the Group i
- Lane k
Some of the events only exist for specific configurations.
DesignWare Cores (DWC) PCIe PMU Driver
=======================================
This driver adds PMU devices for each PCIe Root Port named based on the SBDF of
the Root Port. For example,
0001:30:03.0 PCI bridge: Device 1ded:8000 (rev 01)
the PMU device name for this Root Port is dwc_rootport_13018.
The DWC PCIe PMU driver registers a perf PMU driver, which provides
description of available events and configuration options in sysfs, see
/sys/bus/event_source/devices/dwc_rootport_{sbdf}.
The "format" directory describes format of the config fields of the
perf_event_attr structure. The "events" directory provides configuration
templates for all documented events. For example,
"rx_pcie_tlp_data_payload" is an equivalent of "eventid=0x21,type=0x0".
The "perf list" command shall list the available events from sysfs, e.g.::
$# perf list | grep dwc_rootport
<...>
dwc_rootport_13018/Rx_PCIe_TLP_Data_Payload/ [Kernel PMU event]
<...>
dwc_rootport_13018/rx_memory_read,lane=?/ [Kernel PMU event]
Time Based Analysis Event Usage
-------------------------------
Example usage of counting PCIe RX TLP data payload (Units of bytes)::
$# perf stat -a -e dwc_rootport_13018/Rx_PCIe_TLP_Data_Payload/
The average RX/TX bandwidth can be calculated using the following formula:
PCIe RX Bandwidth = rx_pcie_tlp_data_payload / Measure_Time_Window
PCIe TX Bandwidth = tx_pcie_tlp_data_payload / Measure_Time_Window
Lane Event Usage
-------------------------------
Each lane has the same event set and to avoid generating a list of hundreds
of events, the user need to specify the lane ID explicitly, e.g.::
$# perf stat -a -e dwc_rootport_13018/rx_memory_read,lane=4/
The driver does not support sampling, therefore "perf record" will not
work. Per-task (without "-a") perf sessions are not supported.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
RAS D.E.S PMU counter
1-23`Synopsys DesignWare Cores (DWC) PCIe Performance Monitoring Unit (PMU)`는 각 PCIe Root Port가 `RAS D.E.S (Debug, Error injection, and Statistics)`라는 Vendor-Specific Extended Capability로 제공하는 PCIe configuration-space register block입니다.
RAS DES capability는 system-level debugging, AER error injection과 statistics collection을 지원합니다. DWC PCIe controller는 statistics를 위해 두 기능을 제공합니다.
| 기능 | Counter | 측정 |
|---|---|---|
| Time Based Analysis | 64-bit counter 1개 | RX/TX data throughput와 low-power LTSSM state 체류 시간 |
| Event Counting | Event별 32-bit counter 1개 | 지정 lane의 error·non-error event |
Counter overflow interrupt는 없습니다.
Time-based와 lane event
24-45Time Based Analysis로 controller의 RX/TX data throughput과 각 low-power LTSSM state 체류 시간을 얻습니다.
| Group | 측정 |
|---|---|
| Group#0 | Controller가 LTSSM state에 머문 시간의 percentage |
| Group#1 | 처리한 data 양, 16 bytes 단위 |
Lane Event counter는 특정 lane의 Error와 Non-Error 정보를 제공합니다. PMU event는 세 요소를 모두 지정해 선택합니다.
| 선택 | 의미 |
|---|---|
| Group `i` | Event group 선택 |
| Event `j` | Group `i` 안의 event 선택 |
| Lane `k` | 측정할 PCIe lane 선택 |
일부 event는 특정 configuration에서만 존재합니다.
SBDF naming과 sysfs event
46-72`DesignWare Cores (DWC) PCIe PMU Driver`는 PCIe Root Port의 SBDF를 바탕으로 각 Root Port의 PMU device를 추가합니다. 다음 Root Port 예시의 PMU 이름은 `dwc_rootport_13018`입니다.
0001:30:03.0 PCI bridge: Device 1ded:8000 (rev 01)
Driver는 `/sys/bus/event_source/devices/dwc_rootport_{sbdf}`에 event와 configuration option을 설명하는 perf PMU를 등록합니다.
`format` directory는 `perf_event_attr`의 config field 형식을, `events` directory는 documented event template을 제공합니다. `rx_pcie_tlp_data_payload`는 `eventid=0x21,type=0x0`와 같습니다.
`perf list`로 sysfs의 available event를 나열합니다.
$# perf list | grep dwc_rootport
<...>
dwc_rootport_13018/Rx_PCIe_TLP_Data_Payload/ [Kernel PMU event]
<...>
dwc_rootport_13018/rx_memory_read,lane=?/ [Kernel PMU event]
RX/TX bandwidth
73-84PCIe RX TLP data payload를 bytes 단위로 count하는 예시입니다.
$# perf stat -a -e dwc_rootport_13018/Rx_PCIe_TLP_Data_Payload/
Average RX/TX bandwidth 공식은 다음과 같습니다.
PCIe RX Bandwidth = rx_pcie_tlp_data_payload / Measure_Time_Window
PCIe TX Bandwidth = tx_pcie_tlp_data_payload / Measure_Time_Window
| Metric | 공식 |
|---|---|
| PCIe RX Bandwidth | `rx_pcie_tlp_data_payload / Measure_Time_Window` |
| PCIe TX Bandwidth | `tx_pcie_tlp_data_payload / Measure_Time_Window` |
Lane 지정과 제한
85-94Lane마다 event set이 같으므로 수백 event를 나열하는 대신 user가 lane ID를 명시합니다.
$# perf stat -a -e dwc_rootport_13018/rx_memory_read,lane=4/
Driver는 sampling을 지원하지 않아 `perf record`가 동작하지 않으며 `-a` 없는 Per-task perf session도 지원하지 않습니다.
운영 핵심
dwc_pcie_pmu.rst:1-94Root Port SBDF로 PMU를 찾고 time-based counter 또는 group·event·lane으로 지정한 lane counter를 system-wide로 측정합니다.