← Ethernet 상세 목차DUJINLABS.COM

Hardware · Ethernet detailed manual 08 · Linux v6.18.37

8. DMA 오류 복구, PTP와 teardown 순서를 끝까지 검증한다

fatal bus error, TX timeout, ring reset, timestamp pending, close, unbind와 suspend에서 새 work 차단, IRQ/NAPI quiesce, DMA stop, mapping 해제의 역순 계약을 확인합니다.

상세 표
2
검증 행
16
절차
4 checkpoints
기준
Synopsys DWMAC · Linux NAPI · Linux v6.18.37

CHAPTER 08

8. DMA 오류 복구, PTP와 teardown 순서를 끝까지 검증한다

fatal bus error, TX timeout, ring reset, timestamp pending, close, unbind와 suspend에서 새 work 차단, IRQ/NAPI quiesce, DMA stop, mapping 해제의 역순 계약을 확인합니다.

복구 범위

channel만 재시작할지 MAC/DMA 전체 reset할지에 따라 다른 queue와 PTP clock 영향이 달라집니다.

quiesce

새 xmit과 RX refill을 막고 IRQ를 disable한 뒤 NAPI와 work를 동기화해야 descriptor를 안전하게 해제할 수 있습니다.

PTP

timestamp descriptor와 skb 대기 queue, PHC register lifetime이 일반 completion보다 길 수 있습니다.

resume

ring memory가 유지돼도 controller context와 tail pointer가 유실될 수 있습니다. restore 순서를 cold open과 비교합니다.

레지스터와 관측값을 함께 읽는 표

항목소유 블록설정 또는 의미정상 증거실패 해석
DMA fatal bus statusDMA channelread/write/descriptor/data fault정상 0, 오류 시 주소와 함께 기록AXI/IOMMU/mapping
channel process stateDMA channelstopped/suspended/runningstop 요청 뒤 제한시간 내 stoppedoutstanding transaction
MAC/DMA resetglobal DMAsoftware reset self-clearclock 존재 시 완료clock/reset domain 정지
PTP timestamp statusMAC timestampTx/Rx pending/overflow요청 packet과 대응timestamp queue lifetime
IRQ/NAPI statedriver/net coredisabled와 synchronize 완료free 전 callback 0use-after-free
mapping/page countDMA API/page_poolinflight bufferteardown 후 0 또는 의도된 poolleak/stale DMA

증상에서 첫 실패 경계를 찾는 표

관측 증상직전 통과 증거우선 확인반증 시험판정
TX timeout 후 영구 정지timeout 검출recovery가 tail/base를 재설정했는지reset 전후 register diff복구 초기화 누락
복구 중 다른 queue 손실한 channel만 faultreset 범위와 shared blockqueue별 sequence 비교전역 reset 영향
unbind에서 crashtraffic 중 unbindNAPI/work/IRQ synchronize 순서KASAN/lockdep traceobject lifetime
suspend/resume 후 DMA faultresume clock/link 정상ring base/IOMMU restorecold open과 resume snapshot diffcontext restore
PTP skb leak일반 Tx completion 정상timestamp pending timeouttimestamp request/complete ledger추가 lifetime
반복 open/close 메모리 증가기능은 매번 성공page_pool/ring/work allocation1000 cycle slab/page diffresource leak
그림 1. 8. DMA 오류 복구, PTP와 teardown 순서를 끝까지 검증한다의 실행 순서왼쪽에서 오른쪽으로 실제 소유권과 관찰 지점이 이동합니다.
01 fault/close 요청
02 new work 차단
03 IRQ disable
04 NAPI/work sync
05 DMA stop
06 outstanding 회수
07 unmap/free
08 reset/restore
09 재개

실제 검증 절차

순서실행남길 증거판정 목적
1의도적으로 잘못된 DMA 또는 timeout을 주입해 recovery event를 기록합니다.fault→quiesce→restart 순서실제 복구 경로 검증
2traffic 중 unbind/open-close를 반복하며 callback과 free를 trace합니다.free 뒤 접근 0수명 검증
3suspend 전후 모든 base/tail/mask와 PHY link를 diff합니다.복원 누락 registerresume 경계 확인
4PTP on/off에서 pending skb와 timestamp overflow를 비교합니다.추가 queue가 정상 draintimestamp lifetime 검증

주의DMA reset은 descriptor ownership을 자동으로 Linux에 돌려준다는 뜻이 아닙니다. outstanding mapping과 skb를 driver가 일관되게 회수해야 합니다.

공개적으로 다시 확인할 수 있는 자료

공개되지 않은 vendor register나 integration별 offset을 추측해서 채우지 않았습니다. 아래 제조사 자료, architecture 문서와 Linux v6.18.37 원본에서 다시 확인할 수 있는 범위만 사용했습니다.

Linux stmmac driver

Synopsys GMAC/GMAC4/XGMAC, descriptor, NAPI, PTP와 offload 공개 설명

Linux NAPI

schedule, poll budget, completion과 IRQ 재활성화 계약