CHAPTER 05
5. MSI/MSI-X table에서 LAPIC vector까지 message를 해석한다
PCI capability의 enable, multiple message, MSI-X table/PBA, message address/data와 mask를 읽고 destination APIC ID, delivery mode와 vector를 Linux irqdomain mapping까지 연결합니다.
MSI
config capability에 message address/data를 저장하며 여러 vector encoding은 capability에 따라 제한됩니다.
MSI-X
BAR의 table entry마다 address/data/vector control이 있고 PBA가 pending을 보존합니다.
message write
장치가 특정 address/data memory write를 발행하는 것이 interrupt입니다.
ordering
device completion data와 MSI write ordering은 장치/bus 계약에 따라 handler visibility에 영향을 줍니다.
레지스터·번호·소유권 대조
| 항목 | 소유자 | 값의 의미 | 정상 증거 | 오류 해석 |
|---|---|---|---|---|
| MSI control | PCI config | enable, 64-bit, multiple messages | 할당 vector 수와 일치 | capability programming |
| MSI address/data | PCI config | destination/vector/delivery | Linux vector와 target 일치 | wrong APIC target |
| MSI-X table | BAR memory | entry address/data/mask | 사용 entry unmasked | table BAR/offset 오류 |
| MSI-X PBA | BAR memory | masked pending | unmask 후 전달 | pending 고정 |
| device status/mask | device | queue completion과 source enable | vector와 queue mapping 일치 | message 자체 미발생 |
실패 경계 판정
| 증상 | 직전 통과 | 우선 확인 | 반증 시험 | 판정 |
|---|---|---|---|---|
| device completion, MSI write 없음 | queue status set | device interrupt enable/table mask | poll mode와 table readback | device source |
| MSI write, LAPIC IRR 없음 | bus analyzer/IOMMU 확인 | address/data/remapper | self MSI 또는 remap fault | message routing |
| 한 vector만 동작 | MSI enable | multi-message encoding/queue map | vector별 table/capability 비교 | vector programming |
| MSI-X unmask 후 storm | PBA pending | device status ack | mask 상태에서 source clear | 장치 원인 |
| affinity 후 wrong CPU | vector 동작 | table message update/remap | message data와 vector_cfg 비교 | migration update |
실제 검증 절차
| 순서 | 실행 | 남길 증거 | 판정 목적 |
|---|---|---|---|
| 1 | capability와 table entry를 raw/decoded로 저장합니다. | vector별 message | programming 확인 |
| 2 | queue→MSI-X entry→virq→CPU/vector를 연결합니다. | vector ledger | mapping 검증 |
| 3 | mask/PBA/unmask 시나리오로 pending 보존을 시험합니다. | PBA lifecycle | table 동작 |
| 4 | affinity 이동 중 message와 count를 capture합니다. | target 전환 | loss/duplicate 검증 |
주의MSI-X table은 device BAR에 있으며 일반 RAM처럼 cacheable mapping하면 안 됩니다. kernel MMIO accessor와 ordering을 사용합니다.
공개적으로 다시 확인할 수 있는 자료
공개되지 않은 vendor register나 integration별 offset을 추측해서 채우지 않았습니다. 아래 제조사 자료, architecture 문서와 Linux v6.18.37 원본에서 다시 확인할 수 있는 범위만 사용했습니다.
Intel 64 and IA-32 SDM
Local APIC, x2APIC, interrupt/exception과 virtualization
Linux APIC code
APIC mode 선택과 초기화
Linux IOAPIC code
GSI와 redirection entry 관리
Linux vector allocator
CPU별 vector 할당과 이동