본문으로 건너뛰기
PCIe Deep Dive · 17/19

Ch 17: Performance — Bandwidth·Latency·Tuning

· Hawk · 8분 읽기

#한 줄 요약

“PCIe 성능은 theoretical BW × encoding overhead × MaxPayload 효율 × NUMA locality × Posted/Non-Posted 비율에 의해 결정됩니다.”Effective BWtheoretical의 70~90%. MaxPayload·MaxReadReq tuningthroughput을 1.5~3배. LatencyRC·switch·EP의 hop 누적. NUMA mismatch5~30% 손실. ASPMlow-load 절전이지만 burst latency.

Ch 16 Troubleshooting에서 성능 미달 시나리오를 봤습니다. 이 장은 성능 측정·tuning의 전체 그림을 본격적으로 분해합니다.

#Theoretical vs Effective Bandwidth

Generationper-lane rawper-lane effectivex16 rawx16 effective
Gen 38 GT/s~7.88 Gb/s128 GT/s~126 Gb/s (16 GB/s)
Gen 416 GT/s~15.75 Gb/s256 GT/s~252 Gb/s (32 GB/s)
Gen 532 GT/s~31.5 Gb/s512 GT/s~504 Gb/s (63 GB/s)
Gen 664 GT/s~63 Gb/s1024 GT/s~126 GB/s
Gen 7128 GT/s~126 Gb/s2048 GT/s~252 GB/s

encoding overhead (8b/10b 20%·128b/130b 1.5%·PAM4+FEC ~3%) 적용 후가 effective.

실측 BWeffective의 70~90%TLP header overhead·ACK/NAK·Update FC·idle gap.

#MaxPayloadSize (MPS) — TLP Payload 최대 크기

MPSHeader overhead 비율
128 byte~12.5% (header 16 byte / 128 byte)
256 byte~6%
512 byte~3%
1024 byte~1.5%
4096 byte~0.4%

전 link의 device들이 최소값으로 협상. 낮은 MPS device 하나전체를 끌어내림.

Terminal window
# 현재 MPS 확인
lspci -vv | grep "MaxPayload"
# 변경 (driver·BIOS 지원해야)
setpci -s 01:00.0 CAP_EXP+8.W=0x2810 # MaxPayload 256

NVMe·Mellanox NIC은 256·512 byte 일반. legacy device128 bytebottleneck.

#MaxReadRequestSize (MRRS)

outbound Memory Read TLP의 max payload. 즉 한 번에 얼마나 큰 read 요청할지:

MRRS효과
작음 (128 byte)여러 read TLP → header overhead
큼 (4096 byte)적은 read TLP → 효율적
Terminal window
# 현재 MRRS
lspci -vv | grep "MaxReadReq"
# 변경
setpci -s 01:00.0 CAP_EXP+8.W=0x5810 # MRRS 4096

NVMe·NIC는 4096 byte가 일반. MPS와 다름 — MPS는 받을 수 있는 payload, MRRS는 요청할 size.

#Latency Breakdown

End-to-end latency:

영역일반 latency
CPU → Root Complex< 100 ns
Root Complex → Switch50100 ns
Switch → Endpoint~50 ns/hop
Endpoint internaldevice 의존 (NVMe ~10 µs·NIC ~µs)
Completion 돌아옴같은 path 역순

Latency = 2 × (hop count × hop latency) + endpoint processing. *Direct attach (RC → EP)*가 switch traversal보다 빠름.

#Completion Combining·Coalescing

큰 Read여러 Completion으로 split (Ch 2). CoalescingCompletion 묶어 처리:

기능효과
TLP coalescingRC가 여러 작은 Completion을 batch — software overhead 감소
NIC interrupt coalescing다수 packet → 한 interrupt
NVMe Q-depthsubmission queue 깊이

ethtool -C eth0 rx-usecs 100처럼 NIC-level tuning.

#NUMA Locality

Multi-socket system에서 device가 어느 socket에 매달려 있는지:

시나리오latency·BW
Same NUMA (local)최적
Cross-NUMA (UPI/Infinity Fabric traverse)5~30% 손실
Terminal window
# Device NUMA
cat /sys/bus/pci/devices/0000:01:00.0/numa_node
# Process 측 NUMA pinning
numactl --cpunodebind=0 --membind=0 ./app

NVMe·NIC을 해당 NUMA의 CPU·memory에서 사용. 8-socket server에서 NUMA mismatch는 큰 성능 차.

#Posted vs Non-Posted 비율

WorkloadPosted·Non-Posted
NIC RX (DMA write to host)거의 Posted
NVMe ReadNon-Posted (Read 요청) + Completion
NIC TX (host → NIC DMA)NIC이 Read 발행 → 응답
GPU computePosted Write 중심

Non-Posted가 많으면 latency 노출. 큰 MRRS로 Non-Posted 줄임.

#Relaxed Ordering·No Snoop

Attribute 비트throughput에 큰 영향:

Attr효과
RO (Relaxed Ordering)strict order 완화 → parallelism ↑
NS (No Snoop)RC cache snoop skip → host CPU 부담 ↓

GPU·HPC accelerator가 RO·NS 활성최대 throughput. 데이터 손상 위험은 driver가 barrier로 control.

#ASPM·LTR 영향

활성Idle 전력Burst latency
ASPM Off높음낮음·일정
ASPM L0s중간µs 잡음
ASPM L1낮음µs~수십 µs 잡음
L1.2 substates매우 낮음수백 µs

*Latency-critical (NVMe·NIC)*는 ASPM off가 일반. 모바일·노트북L1.2까지 활성.

#P2P DMA

EP A → EP B 직접 DMA (RC 경유 안 함):

시나리오효과
NVMe → GPU 직접 copyhost memory bypass
GPU ↔ GPU (NCCL)inter-GPU NVLink + PCIe
같은 switchswitch peer-to-peer

/sys/bus/pci/.../p2pdma지원 확인. driver·BIOS·switch ACS 모두 P2P 허용해야.

#DDIO — Direct Data I/O

Intel Xeon의 NIC traffic을 LLC에 직접 DMA:

시나리오효과
DDIO 활성NIC RX가 LLC로, CPU L3 hit
DDIO 비활성DRAM 경유 — latency 큼

Latency 200~300 ns 절감. 100 GbE·NVMe·CXL에 유효.

#측정 도구

도구용도
`lspci -vvgrep “Lnk”`
fioNVMe IOPS·throughput·latency
iperf3·netperfNIC throughput
perf c2ccache contention
intel-pmu-toolsPCIe BW counter
pcm-pcie (Intel PCM)PCIe BW per device
nvidia-smi dmonGPU PCIe BW

#자주 하는 실수

#”Gen 5면 NVMe Gen 4의 2배”

Effective BW는 그렇지만 NVMe 내부 throughput 한계도 있음. NVMe controller·flash bandwidthbottleneck이면 PCIe upgrade 효과 적음.

#”MPS 키우면 항상 빠름”

latency-sensitive small transfer작은 MPS가 유리. MPS·MRRS는 workload 따라 다른 optimum.

#”ASPM Off가 항상 최선”

low-load deviceelectricity·thermal cost. server에서도 deeper power state 활용total cost optimum.

#”NUMA가 software 결정”

PCIe slot의 NUMAhardware 고정. board layout으로 결정. bind 못 함. workload를 그 NUMA에 맞춤.

#”Coalescing이 latency 손해만”

low load에서 false. high load에서 throughput per ISR가 크게 향상. workload-aware tuning.

#정리

  • Effective BWtheoretical의 70~90%. encoding·header·ACK/NAK 모두 overhead.
  • MaxPayload·MaxReadReqthroughput tuning의 1순위.
  • Latencyhop count × hop latency + endpoint. Direct attach 빠름.
  • NUMA locality5~30% 차이. Hardware 고정.
  • Posted·Non-Posted 비율·RO·NS attributeparallelism.
  • ASPM·LTRpower vs latency trade-off.
  • P2P DMA·DDIOhost memory bypass·LLC 직접.
  • 측정: lspci·fio·perf·pcm-pcie·nvidia-smi.

#다음 편

Ch 18: Register Maps — Configuration Space 비트 reference에서 Configuration·PCIe Cap·AER·MSI/MSI-X·SR-IOV의 비트별 reference를 제공합니다.

#관련 항목

#시리즈 자료 출처 안내

본 글의 1차 자료·정책은 Ch 1 footer 참고.