140 lines
11 KiB
XML
140 lines
11 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="1393" height="690" viewBox="0 0 1393 690" role="img" aria-labelledby="diagram-title diagram-description">
|
|
<title id="diagram-title">게스트가 하드웨어에 닿는 갈래는 셋이고 깊이가 다르다</title>
|
|
<desc id="diagram-description">위에서 아래로 읽는다. 맨 위 QEMU 에서 갈래 셋이 갈린다. 왼쪽 CPU 갈래는 KVM_RUN 으로 커널의 KVM 에 들어가고 KVM 이 VM entry 로 물리 CPU 에 올리며 게스트 코드가 VMX non-root 로 거기서 돈다. 물리 CPU 상자에 VM exit 이 함께 적혀 있고 나온 이유는 KVM 상자의 struct kvm_run 으로 유저공간에 돌아간다. 가운데 패스스루 갈래는 QEMU 가 VFIO 로 장치 fd 를 받고 vfio-pci 가 장치를 묶으며 그 장치의 DMA 가 IOMMU 를 지난다. 오른쪽 virtio 갈래는 virtqueue 가 게스트 드라이버에 닿고 같은 virtqueue 를 커널 vhost 와 나누는 길이 따로 있다. 앞의 둘은 이 실험대가 쓰고 패스스루는 쓰지 않는다.</desc>
|
|
<metadata>{"techviz":{"spec_version":"1.1","id":"cpu-io-passthrough-paths","profile":"component-flow"},"source_context":{"document":"docs/keycloak-session-store/final/document.md","document_sha256":"28aef96a2bbb94fbb10ade26a71238fee62a5a4d9fa6e7749ae98cfd0a65e560","anchor":{"kind":"heading","value":"이 층 아래의 구조 — 조사한 것","line":3430}},"evidence_policy":"Each factual element cites source lines or is marked assumption.","diagram_only":true}</metadata>
|
|
<defs>
|
|
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
<path d="M 0 0 L 10 5 L 0 10 z" />
|
|
</marker>
|
|
<style>
|
|
:root { color-scheme: light; }
|
|
text { font-family: Inter, Pretendard, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; fill: #111827; }
|
|
.canvas { fill: #ffffff; }
|
|
.group-box { fill: #ffffff; stroke: #9ca3af; stroke-width: 1.4; stroke-dasharray: 7 5; }
|
|
.group-label-bg { fill: #ffffff; }
|
|
.group-label { font-size: 13px; font-weight: 650; fill: #374151; }
|
|
.edge { fill: none; stroke: #374151; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; marker-end: url(#arrow); }
|
|
.edge.style-dashed, .edge.semantic-dashed, .edge.assumption { stroke-dasharray: 7 5; }
|
|
.edge.style-dotted { stroke-dasharray: 2 5; }
|
|
.edge.emphasis-primary { stroke: #2563eb; stroke-width: 2.2; }
|
|
.edge.emphasis-muted { stroke: #9ca3af; }
|
|
.edge.emphasis-warning, .edge.kind-failure, .edge.kind-error { stroke: #dc2626; stroke-width: 2.2; }
|
|
.edge-label-bg { fill: #ffffff; }
|
|
.edge-label { font-size: 12px; font-weight: 560; text-anchor: middle; }
|
|
.node-shape { fill: #ffffff; stroke: #4b5563; stroke-width: 1.7; }
|
|
.node-shape.emphasis-primary { stroke: #2563eb; stroke-width: 2.2; }
|
|
.node-shape.emphasis-muted { stroke: #9ca3af; fill: #f9fafb; }
|
|
.node-shape.emphasis-warning { stroke: #d97706; stroke-width: 2; fill: #fffdf5; }
|
|
.node-shape.kind-database, .node-shape.kind-datastore, .node-shape.kind-storage { fill: #f8fafc; }
|
|
.node-shape.kind-queue, .node-shape.kind-event, .node-shape.kind-topic { fill: #fafafa; }
|
|
.node-shape.assumption { stroke-dasharray: 4 4; }
|
|
.storage-bottom, .controller-divider { fill: none; stroke: #4b5563; stroke-width: 1.4; }
|
|
.controller-led { fill: #4b5563; }
|
|
.actor-symbol { fill: none; stroke: #4b5563; stroke-width: 1.8; stroke-linecap: round; }
|
|
.actor-symbol.emphasis-primary { stroke: #2563eb; stroke-width: 2.2; }
|
|
.node-label { font-size: 14px; font-weight: 650; text-anchor: middle; }
|
|
.node-role { font-size: 10px; letter-spacing: 0.04em; text-anchor: middle; fill: #6b7280; }
|
|
.node-detail-divider { stroke: #d1d5db; stroke-width: 1; }
|
|
.node-detail { font-size: 11px; fill: #374151; }
|
|
.assumption-badge { font-size: 9px; font-weight: 700; fill: #92400e; }
|
|
.failure-mark { stroke: #dc2626; stroke-width: 4; stroke-linecap: round; }
|
|
.lifeline { stroke: #9ca3af; stroke-width: 1.2; stroke-dasharray: 5 5; }
|
|
.timeline-axis { stroke: #374151; stroke-width: 1.8; marker-end: url(#arrow); }
|
|
.timeline-stem { stroke: #6b7280; stroke-width: 1.3; }
|
|
.timeline-marker { fill: #ffffff; stroke: #374151; stroke-width: 1.7; }
|
|
.timeline-marker.primary { fill: #2563eb; stroke: #2563eb; }
|
|
.timeline-marker.warning { fill: #dc2626; stroke: #dc2626; }
|
|
.timeline-label { font-size: 13px; font-weight: 650; text-anchor: middle; }
|
|
.timeline-detail { font-size: 11px; fill: #4b5563; text-anchor: middle; }
|
|
</style>
|
|
</defs>
|
|
<rect class="canvas" width="1393" height="690" />
|
|
<polyline class="edge kind-data style-solid emphasis-normal" points="1038.0,281.0 1118.0,281.0 1118.0,281.0 1198.0,281.0" data-evidence="3450-3451" />
|
|
<rect class="edge-label-bg" x="1068.8" y="239.0" width="98.4" height="22" rx="3" />
|
|
<text class="edge-label" x="1118.0" y="254.0">VMX non-root</text>
|
|
<polyline class="edge kind-data style-solid emphasis-normal" points="1015.5,441.0 1106.8,441.0 1106.8,424.0 1198.0,424.0" data-evidence="3483-3485" />
|
|
<rect class="edge-label-bg" x="1108.8" y="418.5" width="44.0" height="22" rx="3" />
|
|
<text class="edge-label" x="1130.8" y="433.5">DMA</text>
|
|
<polyline class="edge kind-request style-solid emphasis-normal" points="676.0,104.0 759.5,104.0 759.5,281.0 843.0,281.0" data-evidence="3450-3451" />
|
|
<rect class="edge-label-bg" x="747.7" y="178.5" width="71.6" height="22" rx="3" />
|
|
<text class="edge-label" x="783.5" y="193.5">VM entry</text>
|
|
<polyline class="edge kind-request style-solid emphasis-normal" points="321.0,343.5 414.0,343.5 414.0,272.5 507.0,272.5" data-evidence="3477-3480" />
|
|
<rect class="edge-label-bg" x="412.2" y="294.0" width="51.5" height="22" rx="3" />
|
|
<text class="edge-label" x="438.0" y="309.0">장치 fd</text>
|
|
<polyline class="edge kind-request style-solid emphasis-normal" points="321.0,325.5 404.5,325.5 404.5,104.0 488.0,104.0" data-evidence="3443-3445" />
|
|
<rect class="edge-label-bg" x="396.1" y="200.8" width="64.9" height="22" rx="3" />
|
|
<text class="edge-label" x="428.5" y="215.8">KVM_RUN</text>
|
|
<polyline class="edge kind-control style-dashed emphasis-normal" points="321.0,361.5 414.0,361.5 414.0,441.0 507.0,441.0" data-evidence="3464-3468" />
|
|
<rect class="edge-label-bg" x="402.2" y="387.2" width="71.6" height="22" rx="3" />
|
|
<text class="edge-label" x="438.0" y="402.2">제어 ioctl</text>
|
|
<polyline class="edge kind-data style-solid emphasis-normal" points="321.0,379.5 401.0,379.5 401.0,601.0 481.0,601.0" data-evidence="3455-3457,3467-3467" />
|
|
<rect class="edge-label-bg" x="385.9" y="476.2" width="78.3" height="22" rx="3" />
|
|
<text class="edge-label" x="425.0" y="491.2">virtqueue</text>
|
|
<polyline class="edge kind-control style-solid emphasis-normal" points="657.0,272.5 761.2,272.5 761.2,441.0 865.5,441.0" data-evidence="3483-3485" />
|
|
<rect class="edge-label-bg" x="739.4" y="342.8" width="91.7" height="22" rx="3" />
|
|
<text class="edge-label" x="785.2" y="357.8">vfio-pci 결합</text>
|
|
<g id="node-qemu">
|
|
<rect class="node-shape kind-service emphasis-primary role-source" data-evidence="3441-3447" x="70.0" y="308.5" width="251.0" height="88.0" rx="7" />
|
|
<text class="node-label" x="195.5" y="335.5">QEMU</text>
|
|
<line class="node-detail-divider" x1="84.0" y1="356.5" x2="307.0" y2="356.5" />
|
|
<text class="node-detail" x="86.0" y="373.5">/dev/kvm</text>
|
|
<text class="node-detail" x="86.0" y="389.5">KVM_CREATE_VM · KVM_CREATE_VCPU</text>
|
|
</g>
|
|
<g id="node-kvm">
|
|
<rect class="node-shape kind-service emphasis-normal role-service" data-evidence="3444-3447" x="488.0" y="60.0" width="188.0" height="88.0" rx="7" />
|
|
<text class="node-label" x="582.0" y="87.0">KVM</text>
|
|
<line class="node-detail-divider" x1="502.0" y1="108.0" x2="662.0" y2="108.0" />
|
|
<text class="node-detail" x="504.0" y="125.0">struct kvm_run</text>
|
|
<text class="node-detail" x="504.0" y="141.0">KVM_GET_VCPU_MMAP_SIZE</text>
|
|
</g>
|
|
<g id="node-vfio">
|
|
<rect class="node-shape kind-service emphasis-normal role-service" data-evidence="3470-3485" x="507.0" y="220.0" width="150.0" height="105.0" rx="7" />
|
|
<text class="node-label" x="582.0" y="247.0">VFIO</text>
|
|
<line class="node-detail-divider" x1="521.0" y1="268.0" x2="643.0" y2="268.0" />
|
|
<text class="node-detail" x="523.0" y="285.0">vfio-pci</text>
|
|
<text class="node-detail" x="523.0" y="301.0">IOMMU 그룹</text>
|
|
<text class="node-detail" x="523.0" y="317.0">/dev/vfio/vfio</text>
|
|
</g>
|
|
<g id="node-vhost">
|
|
<rect class="node-shape kind-service emphasis-normal role-sink" data-evidence="3464-3468" x="507.0" y="397.0" width="150.0" height="88.0" rx="7" />
|
|
<text class="node-label" x="582.0" y="424.0">vhost</text>
|
|
<line class="node-detail-divider" x1="521.0" y1="445.0" x2="643.0" y2="445.0" />
|
|
<text class="node-detail" x="523.0" y="462.0">리눅스 커널 구현</text>
|
|
<text class="node-detail" x="523.0" y="478.0">virtqueue 공유</text>
|
|
</g>
|
|
<g id="node-virtio-driver">
|
|
<rect class="node-shape kind-service emphasis-normal role-sink" data-evidence="3455-3457" x="481.0" y="557.0" width="202.0" height="88.0" rx="7" />
|
|
<text class="node-label" x="582.0" y="584.0">게스트 virtio 드라이버</text>
|
|
<line class="node-detail-divider" x1="495.0" y1="605.0" x2="669.0" y2="605.0" />
|
|
<text class="node-detail" x="497.0" y="622.0">virtio-pci · virtio-mmio</text>
|
|
<text class="node-detail" x="497.0" y="638.0">virtqueue</text>
|
|
</g>
|
|
<g id="node-physical-cpu">
|
|
<rect class="node-shape kind-service emphasis-normal role-service" data-evidence="3450-3452" x="843.0" y="228.5" width="195.0" height="105.0" rx="7" />
|
|
<text class="node-label" x="940.5" y="255.5">물리 CPU</text>
|
|
<line class="node-detail-divider" x1="857.0" y1="276.5" x2="1024.0" y2="276.5" />
|
|
<text class="node-detail" x="859.0" y="293.5">VMX root · VMX non-root</text>
|
|
<text class="node-detail" x="859.0" y="309.5">VM entry · VM exit</text>
|
|
<text class="node-detail" x="859.0" y="325.5">guest-state 영역</text>
|
|
</g>
|
|
<g id="node-pci-device">
|
|
<rect class="node-shape kind-service emphasis-normal role-service" data-evidence="3470-3472,3483-3485" x="865.5" y="405.5" width="150.0" height="71.0" rx="7" />
|
|
<text class="node-label" x="940.5" y="432.5">물리 PCI 장치</text>
|
|
<line class="node-detail-divider" x1="879.5" y1="453.5" x2="1001.5" y2="453.5" />
|
|
<text class="node-detail" x="881.5" y="470.5">게스트 직접 할당</text>
|
|
</g>
|
|
<g id="node-guest-code">
|
|
<rect class="node-shape kind-service emphasis-normal role-sink" data-evidence="3450-3452" x="1198.0" y="245.5" width="150.0" height="71.0" rx="7" />
|
|
<text class="node-label" x="1273.0" y="272.5">게스트 코드</text>
|
|
<line class="node-detail-divider" x1="1212.0" y1="293.5" x2="1334.0" y2="293.5" />
|
|
<text class="node-detail" x="1214.0" y="310.5">vCPU</text>
|
|
</g>
|
|
<g id="node-iommu">
|
|
<rect class="node-shape kind-service emphasis-normal role-sink" data-evidence="3483-3485" x="1198.0" y="388.5" width="150.0" height="71.0" rx="7" />
|
|
<text class="node-label" x="1273.0" y="415.5">IOMMU</text>
|
|
<line class="node-detail-divider" x1="1212.0" y1="436.5" x2="1334.0" y2="436.5" />
|
|
<text class="node-detail" x="1214.0" y="453.5">DMA · 인터럽트 리매핑</text>
|
|
</g>
|
|
</svg>
|