Files

140 lines
11 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="985" height="762" viewBox="0 0 985 762" 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>{&quot;techviz&quot;:{&quot;spec_version&quot;:&quot;1.1&quot;,&quot;id&quot;:&quot;cpu-io-passthrough-paths&quot;,&quot;profile&quot;:&quot;component-flow&quot;},&quot;source_context&quot;:{&quot;document&quot;:&quot;docs/keycloak-session-store/final/document.md&quot;,&quot;document_sha256&quot;:&quot;0ae5674723f25dc85d5069529890f07be1a11b768b56901103fa3ea6ac3dcf55&quot;,&quot;anchor&quot;:{&quot;kind&quot;:&quot;heading&quot;,&quot;value&quot;:&quot;이 층 아래의 구조 — 조사한 것&quot;,&quot;line&quot;:1091}},&quot;evidence_policy&quot;:&quot;Each factual element cites source lines or is marked assumption.&quot;,&quot;diagram_only&quot;: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="985" height="762" />
<polyline class="edge kind-data style-solid emphasis-normal" points="400.0,550.0 400.0,598.0 400.0,598.0 400.0,646.0" data-evidence="1111-1112" />
<rect class="edge-label-bg" x="374.8" y="584.0" width="98.4" height="22" rx="3" />
<text class="edge-label" x="424.0" y="599.0">VMX non-root</text>
<polyline class="edge kind-data style-solid emphasis-normal" points="632.5,533.0 632.5,589.5 610.0,589.5 610.0,646.0" data-evidence="1144-1146" />
<rect class="edge-label-bg" x="599.2" y="547.5" width="44.0" height="22" rx="3" />
<text class="edge-label" x="621.2" y="562.5">DMA</text>
<polyline class="edge kind-request style-solid emphasis-normal" points="164.0,340.5 164.0,392.8 400.0,392.8 400.0,445.0" data-evidence="1111-1112" />
<rect class="edge-label-bg" x="246.2" y="350.8" width="71.6" height="22" rx="3" />
<text class="edge-label" x="282.0" y="365.8">VM entry</text>
<polyline class="edge kind-request style-solid emphasis-normal" points="496.0,148.0 496.0,196.0 393.0,196.0 393.0,244.0" data-evidence="1138-1141" />
<rect class="edge-label-bg" x="418.8" y="154.0" width="51.5" height="22" rx="3" />
<text class="edge-label" x="444.5" y="169.0">장치 fd</text>
<polyline class="edge kind-request style-solid emphasis-normal" points="478.0,148.0 478.0,200.2 164.0,200.2 164.0,252.5" data-evidence="1104-1106" />
<rect class="edge-label-bg" x="288.6" y="158.2" width="64.9" height="22" rx="3" />
<text class="edge-label" x="321.0" y="173.2">KVM_RUN</text>
<polyline class="edge kind-control style-dashed emphasis-normal" points="514.0,148.0 514.0,200.2 603.0,200.2 603.0,252.5" data-evidence="1125-1129" />
<rect class="edge-label-bg" x="522.7" y="158.2" width="71.6" height="22" rx="3" />
<text class="edge-label" x="558.5" y="173.2">제어 ioctl</text>
<polyline class="edge kind-data style-solid emphasis-normal" points="532.0,148.0 532.0,200.2 839.0,200.2 839.0,252.5" data-evidence="1116-1118,1128-1128" />
<rect class="edge-label-bg" x="646.4" y="158.2" width="78.3" height="22" rx="3" />
<text class="edge-label" x="685.5" y="173.2">virtqueue</text>
<polyline class="edge kind-control style-solid emphasis-normal" points="393.0,349.0 393.0,405.5 632.5,405.5 632.5,462.0" data-evidence="1144-1146" />
<rect class="edge-label-bg" x="466.9" y="363.5" width="91.7" height="22" rx="3" />
<text class="edge-label" x="512.8" y="378.5">vfio-pci 결합</text>
<g id="node-qemu">
<rect class="node-shape kind-service emphasis-primary role-source" data-evidence="1102-1108" x="379.5" y="60.0" width="251.0" height="88.0" rx="7" />
<text class="node-label" x="505.0" y="87.0">QEMU</text>
<line class="node-detail-divider" x1="393.5" y1="108.0" x2="616.5" y2="108.0" />
<text class="node-detail" x="395.5" y="125.0">/dev/kvm</text>
<text class="node-detail" x="395.5" y="141.0">KVM_CREATE_VM · KVM_CREATE_VCPU</text>
</g>
<g id="node-kvm">
<rect class="node-shape kind-service emphasis-normal role-service" data-evidence="1105-1108" x="70.0" y="252.5" width="188.0" height="88.0" rx="7" />
<text class="node-label" x="164.0" y="279.5">KVM</text>
<line class="node-detail-divider" x1="84.0" y1="300.5" x2="244.0" y2="300.5" />
<text class="node-detail" x="86.0" y="317.5">struct kvm_run</text>
<text class="node-detail" x="86.0" y="333.5">KVM_GET_VCPU_MMAP_SIZE</text>
</g>
<g id="node-vfio">
<rect class="node-shape kind-service emphasis-normal role-service" data-evidence="1131-1146" x="318.0" y="244.0" width="150.0" height="105.0" rx="7" />
<text class="node-label" x="393.0" y="271.0">VFIO</text>
<line class="node-detail-divider" x1="332.0" y1="292.0" x2="454.0" y2="292.0" />
<text class="node-detail" x="334.0" y="309.0">vfio-pci</text>
<text class="node-detail" x="334.0" y="325.0">IOMMU 그룹</text>
<text class="node-detail" x="334.0" y="341.0">/dev/vfio/vfio</text>
</g>
<g id="node-vhost">
<rect class="node-shape kind-service emphasis-normal role-sink" data-evidence="1125-1129" x="528.0" y="252.5" width="150.0" height="88.0" rx="7" />
<text class="node-label" x="603.0" y="279.5">vhost</text>
<line class="node-detail-divider" x1="542.0" y1="300.5" x2="664.0" y2="300.5" />
<text class="node-detail" x="544.0" y="317.5">리눅스 커널 구현</text>
<text class="node-detail" x="544.0" y="333.5">virtqueue 공유</text>
</g>
<g id="node-virtio-driver">
<rect class="node-shape kind-service emphasis-normal role-sink" data-evidence="1116-1118" x="738.0" y="252.5" width="202.0" height="88.0" rx="7" />
<text class="node-label" x="839.0" y="279.5">게스트 virtio 드라이버</text>
<line class="node-detail-divider" x1="752.0" y1="300.5" x2="926.0" y2="300.5" />
<text class="node-detail" x="754.0" y="317.5">virtio-pci · virtio-mmio</text>
<text class="node-detail" x="754.0" y="333.5">virtqueue</text>
</g>
<g id="node-physical-cpu">
<rect class="node-shape kind-service emphasis-normal role-service" data-evidence="1111-1113" x="302.5" y="445.0" width="195.0" height="105.0" rx="7" />
<text class="node-label" x="400.0" y="472.0">물리 CPU</text>
<line class="node-detail-divider" x1="316.5" y1="493.0" x2="483.5" y2="493.0" />
<text class="node-detail" x="318.5" y="510.0">VMX root · VMX non-root</text>
<text class="node-detail" x="318.5" y="526.0">VM entry · VM exit</text>
<text class="node-detail" x="318.5" y="542.0">guest-state 영역</text>
</g>
<g id="node-pci-device">
<rect class="node-shape kind-service emphasis-normal role-service" data-evidence="1131-1133,1144-1146" x="557.5" y="462.0" width="150.0" height="71.0" rx="7" />
<text class="node-label" x="632.5" y="489.0">물리 PCI 장치</text>
<line class="node-detail-divider" x1="571.5" y1="510.0" x2="693.5" y2="510.0" />
<text class="node-detail" x="573.5" y="527.0">게스트 직접 할당</text>
</g>
<g id="node-guest-code">
<rect class="node-shape kind-service emphasis-normal role-sink" data-evidence="1111-1113" x="325.0" y="646.0" width="150.0" height="71.0" rx="7" />
<text class="node-label" x="400.0" y="673.0">게스트 코드</text>
<line class="node-detail-divider" x1="339.0" y1="694.0" x2="461.0" y2="694.0" />
<text class="node-detail" x="341.0" y="711.0">vCPU</text>
</g>
<g id="node-iommu">
<rect class="node-shape kind-service emphasis-normal role-sink" data-evidence="1144-1146" x="535.0" y="646.0" width="150.0" height="71.0" rx="7" />
<text class="node-label" x="610.0" y="673.0">IOMMU</text>
<line class="node-detail-divider" x1="549.0" y1="694.0" x2="671.0" y2="694.0" />
<text class="node-detail" x="551.0" y="711.0">DMA · 인터럽트 리매핑</text>
</g>
</svg>