Ch 7: Error Handling — Correctable·Uncorrectable·AER·DPC
#한 줄 요약
**“PCIe 에러는 Correctable (CE)·Uncorrectable Non-Fatal (UE-NF)·Uncorrectable Fatal (UE-F)의 3-tier 분류입니다.” — Physical·DLL·TL 각 계층이 자기 단계에서 정정·검출. AER capability가 상세 로깅·report, *DPC (Downstream Port Containment)*가 switch 단에서 fault 격리. Linux는 pci_error_handlers callback으로 driver-level 복구 지원.
Ch 2 TLP·Ch 8 DLL에서 ECRC·LCRC·ACK/NAK가 각 계층 무결성 보장임을 봤습니다. 이 장은 그 보호망을 넘은 에러를 어떻게 분류·report·복구하는지 본격적으로 분해합니다.
#Error 3-Tier 분류
| Tier | 의미 | 영향 |
|---|---|---|
| Correctable (CE) | Hardware가 복구. 로깅만 | application 영향 없음 |
| Uncorrectable Non-Fatal (UE-NF) | 복구 못 함, transaction은 abort | application 그 transaction 실패 |
| Uncorrectable Fatal (UE-F) | link 자체 손상 | OS panic·device offline·containment 필요 |
Critical workload (RAS-sensitive)은 모든 tier 로깅, server 환경은 CE 누적도 health monitoring.
#계층별 에러
| 계층 | 에러 종류 |
|---|---|
| Physical | LTSSM Recovery, Receiver Error, Symbol Error |
| Data Link | LCRC 실패 → NAK·Replay, Replay Number Rollover |
| Transaction | Poisoned TLP, ECRC 실패, Unsupported Request, Completer Abort, Completion Timeout |
각 계층이 자기 단계에서 detect·report. 상위 계층은 모름.
#AER — Advanced Error Reporting
*AER (Extended Cap ID 0x0001)*가 상세 에러 정보:
| Register | 의미 |
|---|---|
| Uncorrectable Error Status | UE 종류별 비트 |
| Uncorrectable Error Mask | report 차단할 UE |
| Uncorrectable Error Severity | UE의 Fatal/Non-Fatal 구분 |
| Correctable Error Status·Mask | CE 동일 |
| AER Capabilities·Control | ECRC enable, multiple header recording |
| Header Log | 첫 UE의 TLP header (디버깅용) |
| Root Error Status·Cmd | Root Port의 AER 통합 |
lspci -vv | grep -A 20 "Advanced Error Reporting"로 device의 AER 상태 dump.
#ERR Messages
UE/CE 발생 시 EP가 Message TLP로 RC에 report:
| Message | 의미 |
|---|---|
| ERR_COR | Correctable 발생 |
| ERR_NONFATAL | UE Non-Fatal |
| ERR_FATAL | UE Fatal |
Switch는 내려온 ERR Message를 RC로 forward. RC가 AER root status에 record + MSI/MSI-X로 OS interrupt.
#DPC — Downstream Port Containment
*DPC (Extended Cap ID 0x001D)*는 fault 격리 메커니즘:
| 동작 | 효과 |
|---|---|
| UE Fatal 발생 | Switch downstream port가 link 차단 |
| 차단 후 bus traffic 흐르지 않음 | 추가 corruption 방지 |
| Recovery 동작 | OS가 port reset·device reinit |
DPC 없으면 fault가 propagate해 다른 device·system 영향. enterprise server·NVMe·CXL에 필수.
#Linux pci_error_handlers
driver가 복구 callback 등록:
| Callback | 호출 시점 |
|---|---|
error_detected | AER가 에러 인식, 상태 확인 |
mmio_enabled | MMIO 접근 가능 확인 |
slot_reset | Slot reset 후 device reinit |
link_reset | Link reset 후 |
resume | 정상 복귀, workload 재개 |
static const struct pci_error_handlers my_err_handler = { .error_detected = my_error_detected, .mmio_enabled = my_mmio_enabled, .slot_reset = my_slot_reset, .resume = my_resume,};
static struct pci_driver my_driver = { .name = "mydrv", .id_table = my_id_table, .probe = my_probe, .err_handler = &my_err_handler,};#Poisoned TLP
Header 손상 또는 명시적 poison된 TLP는 EP가 special bit set:
| 시나리오 | 영향 |
|---|---|
| EP가 Header bit (EP=1) set해서 send | downstream이 bad data 인식, AER report |
| 받은 측이 data를 사용하지 않음 | corruption 전파 차단 |
ECC memory의 poison bit과 유사 — bad data를 표시해서 downstream이 사용 회피.
#Reset 종류
UE Fatal 후 복구는 다양한 reset 옵션:
| Reset | 효과 |
|---|---|
| FLR (Function Level Reset) | 단일 function 리셋, 다른 function 영향 없음 |
| Hot Reset | bridge에서 secondary bus reset signal |
| Secondary Bus Reset | bridge가 자기 secondary bus의 모든 device reset |
| PERST# (Platform Reset) | 보드 차원 reset |
echo 1 > /sys/bus/pci/devices/.../reset이 FLR 또는 secondary bus reset. VFIO pass-through 시 필수.
#Replay·Replay Timer
DLL 단계에서 NAK 받으면 replay buffer로 재전송. replay timer 만료 시:
| 시나리오 | 효과 |
|---|---|
| Replay 1~3회 성공 | 정상 — CE 로그만 |
| Replay 반복 실패 | Replay Number Rollover → UE 진입 |
| Replay timer 없음 | timeout으로 ERR_NONFATAL |
*Frequent CE (Replay)*는 physical layer 문제 신호 — cable·connector·signal integrity 검토 필요.
#EEH — Enhanced Error Handling (POWER)
IBM POWER 아키텍처의 추가 mechanism. Linux 일반은 AER + DPC만, POWER는 EEH로 PE (Partitionable Endpoint) 격리. enterprise POWER server에서.
#자주 하는 실수
#”CE는 무시해도 된다”
개별 CE는 무시 OK. Frequent CE 누적은 physical layer 임박 fault 신호. server monitoring에서 CE rate threshold alarm 필수.
#”AER 활성하면 자동 복구”
AER는 report만. 복구는 driver의 pci_error_handlers callback. driver 미지원 device는 fatal 시 OS panic 가능.
#”DPC가 NIC도 reset한다”
DPC는 downstream port의 link 차단만. NIC 자체 reset은 driver의 slot_reset callback. DPC가 containment이고 recovery는 별도.
#”FLR은 모든 device 지원”
FLR Capability bit 확인 필요. legacy device는 FLR 미지원 — secondary bus reset만. FLR 미지원 device가 같은 bus면 모두 reset 영향.
#”Replay Number Rollover면 끝”
UE에 진입하지만 driver·OS가 reset으로 복구 가능. 다만 link instability가 근본 원인이라 물리적 해결 (cable·card 교체) 권장.
#정리
- PCIe error는 CE·UE-NF·UE-F 3-tier. 각 계층 (Physical·DLL·TL)이 detect·report.
- *AER (0x0001)*가 상세 로깅·classification·Header Log.
- ERR_COR·ERR_NONFATAL·ERR_FATAL Message가 EP → RC.
- *DPC (0x001D)*가 fault 격리 — switch가 link 차단.
- Linux pci_error_handlers가 driver-level 복구 callback.
- Poisoned TLP가 bad data 전파 차단.
- Reset: FLR (function)·Hot Reset·Secondary Bus·PERST#.
- Frequent CE가 physical 임박 fault 신호.
#다음 편
Ch 8: Data Link Layer — DLLP·ACK/NAK·Flow Control·FLIT Mode에서 TLP 위에 신뢰성·credit-based flow control을 얹는 DLL과 Gen 6 FLIT mode의 큰 변화를 본격적으로 분해합니다.
#관련 항목
- Ch 2: TLP — ECRC·Poisoned TLP
- Ch 8: DLLP — Replay·NAK
- Ch 14: Linux Operations (Hot-plug·AER·DPC)
- Ch 16: Troubleshooting — error 시나리오
#시리즈 자료 출처 안내
본 글의 1차 자료·정책은 Ch 1 footer 참고.
PCIe Deep Dive · 7 of 19
- 1Ch 1: PCIe Fundamentals — 계층 구조와 토폴로지
- 2Ch 2: TLP — Transaction Layer Packet
- 3Ch 3: Configuration Space — 4 KB ECAM·Capability Linked List
- 4Ch 4: BAR & MMIO — Device 자원의 호스트 주소 매핑
- 5Ch 5: Interrupts — INTx·MSI·MSI-X·Interrupt Remapping
- 6Ch 6: Power Management — D-state·L-state·ASPM
- 7Ch 7: Error Handling — Correctable·Uncorrectable·AER·DPC
- 8Ch 8: Data Link Layer — DLLP·ACK/NAK·Flow Control·FLIT Mode
- 9Ch 9: Physical Layer — LTSSM·Equalization·SerDes
- 10Ch 10: Linux PCI Basics — Enumeration·Driver Model·sysfs
- 11Ch 11: DMA·IOMMU — Coherent·Streaming·ATS·PRI·PASID·IOMMUFD
- 12Ch 12: Virtualization I — Pass-through·SR-IOV·VFIO·DPDK·SPDK
- 13Ch 13: Virtualization II — vIOMMU·Scalable IOV·VirtIO·IDE·TDISP
- 14Ch 14: Linux Operations — Hot-plug·AER Recovery·DPC·ARI
- 15Ch 15: Tools — lspci·setpci·pcimem·protocol analyzer
- 16Ch 16: Troubleshooting — 실무 시나리오북
- 17Ch 17: Performance — Bandwidth·Latency·Tuning
- 18Ch 18: Register Maps — Config Space·Capability 비트 reference
- 19Ch 19: 고급 기능 — Lane Margining·10-bit Tag·TPH·ACS·L0p
관련 글
Ch 14: Linux Operations — Hot-plug·AER Recovery·DPC·ARI
PCIe 운영 — pciehp surprise·orderly hot-plug·AER recovery callback chain·DPC integration·ARI 256+ function·EEH.
Ch 19: 고급 기능 — Lane Margining·10-bit Tag·TPH·ACS·L0p
코어 동작 너머의 PCIe spec 기능들 — Lane Margining(신호 마진 측정)·10-bit Tag(outstanding 확장)·TPH(캐시 주입 힌트)·ACS(격리)·L0p(부분폭 저전력)을 실무 관점에서 정리합니다.
Ch 18: Register Maps — Config Space·Capability 비트 reference
PCIe register reference — Type 0/1 header·PCIe Cap·AER·MSI·MSI-X·SR-IOV·ACS·LTR의 주요 비트 layout.
이 글을 참조하는 글 (7)
- Ch 16: Troubleshooting — 실무 시나리오북— PCIe Deep Dive
- Ch 15: Tools — lspci·setpci·pcimem·protocol analyzer— PCIe Deep Dive
- Ch 14: Linux Operations — Hot-plug·AER Recovery·DPC·ARI— PCIe Deep Dive
- Ch 10: Linux PCI Basics — Enumeration·Driver Model·sysfs— PCIe Deep Dive
- Ch 8: Data Link Layer — DLLP·ACK/NAK·Flow Control·FLIT Mode— PCIe Deep Dive
- Ch 6: Power Management — D-state·L-state·ASPM— PCIe Deep Dive
- Ch 2: TLP — Transaction Layer Packet— PCIe Deep Dive