feat: 가상화 문서들 추가

This commit is contained in:
DongHyeonka
2026-09-10 08:54:05 +09:00
parent e9f6a93327
commit 43e1aadef0
695 changed files with 153404 additions and 12754 deletions
@@ -0,0 +1,25 @@
# VM Exit 은 KVM 에서 끝나기도 하고 QEMU userspace 까지 가기도 한다
## Alternative text
Guest 에서 VM Exit 으로 KVM 에 닿은 뒤 커널 처리와 QEMU 처리 두 갈래로 갈라졌다가 VM Entry 로 다시 Guest 실행 재개에 모이는 흐름도.
## Long description
왼쪽에서 오른쪽으로 읽는다. 왼쪽 끝에 Guest 가 있고 VM Exit 이 KVM 으로 제어권을 넘긴다. KVM 은 Exit Reason 을 확인해 두 갈래 중 하나를 고른다. 커널 안에서 처리할 수 있는 Exit 은 Kernel 쪽 KVM 커널 처리로 가고, userspace 처리가 필요한 Exit 만 KVM_RUN 이 반환되면서 Userspace 쪽 QEMU 로 간다. QEMU 는 필요한 장치 동작을 처리한 뒤 KVM_RUN 을 다시 호출한다. 두 갈래는 오른쪽 끝에서 다시 만나며 어느 쪽이든 VM Entry 를 지나 Guest 실행 재개로 돌아온다. 무엇이 Exit 을 부르는지와 Exit 이 잦을 때 무엇을 함께 보는지는 본문의 표와 문단이 맡는다.
## Elements and evidence
- **Guest** (service): VM Exit 이 나기 직전까지 실행 중이던 Guest. Evidence: L498L501.
- **KVM** (service): VM Exit 을 받아 Exit Reason 을 확인하고 갈래를 고르는 자리. Evidence: L495L495, L502L504.
- **KVM 커널 처리** (service): 커널 안에서 끝낼 수 있는 Exit 을 처리하는 갈래. QEMU 까지 올라가지 않는다. Evidence: L508L510, L531L531.
- **QEMU** (service): userspace 처리가 필요한 Exit 에서만 개입하는 갈래. Evidence: L510L516, L533L533.
- **Guest 실행 재개** (service): 두 갈래가 다시 만나는 자리. VM Exit 은 VM 종료가 아니라 여기로 돌아온다. Evidence: L521L524, L529L529.
## Relationships
- **Guest → KVM:** VM Exit. Evidence: L495L495, L498L502.
- **KVM → KVM 커널 처리:** 커널 처리 가능. Evidence: L504L510, L531L531.
- **KVM 커널 처리 → Guest 실행 재개:** VM Entry. Evidence: L518L524, L531L531.
- **KVM → QEMU:** KVM_RUN return. Evidence: L508L512, L533L533.
- **QEMU → Guest 실행 재개:** VM Entry. Evidence: L514L524, L533L533.
@@ -0,0 +1,23 @@
# VM Exit 은 KVM 에서 끝나기도 하고 QEMU userspace 까지 가기도 한다
# Question: VM Exit 이 난 뒤 제어권은 어디까지 올라갔다가 어떻게 Guest 로 돌아오는가
direction: right
n0: "Guest" {
shape: rectangle
}
n1: "KVM" {
shape: rectangle
}
n2: "KVM 커널 처리" {
shape: rectangle
}
n3: "QEMU" {
shape: rectangle
}
n4: "Guest 실행 재개" {
shape: rectangle
}
n0 -> n1: "VM Exit"
n1 -> n2: "커널 처리 가능"
n1 -> n3: "KVM_RUN return"
n2 -> n4: "VM Entry"
n3 -> n4: "VM Entry"
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="app.diagrams.net" modified="2026-07-23T00:00:00.000Z" agent="techviz-harness" version="24.7.17" type="device">
<diagram id="vm-exit-handling-cycle" name="VM Exit 은 KVM 에서 끝나기도 하고 QEMU userspace 까지 가기도 한다">
<mxGraphModel dx="1195" dy="353" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1195" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="n_guest" value="Guest" tooltip="VM Exit 이 나기 직전까지 실행 중이던 Guest. | Evidence: L498-L501" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry x="70.0" y="152.0" width="150.0" height="64.0" as="geometry"/>
</mxCell>
<mxCell id="n_kvm" value="KVM&lt;br/&gt;Exit Reason" tooltip="VM Exit 을 받아 Exit Reason 을 확인하고 갈래를 고르는 자리. | Evidence: L495-L495, L502-L504" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;strokeColor=#2563eb;strokeWidth=2;" vertex="1" parent="1">
<mxGeometry x="380.0" y="148.5" width="150.0" height="71.0" as="geometry"/>
</mxCell>
<mxCell id="n_kvm-kernel-handling" value="KVM 커널 처리&lt;br/&gt;Kernel" tooltip="커널 안에서 끝낼 수 있는 Exit 을 처리하는 갈래. QEMU 까지 올라가지 않는다. | Evidence: L508-L510, L531-L531" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry x="690.0" y="60.0" width="150.0" height="71.0" as="geometry"/>
</mxCell>
<mxCell id="n_qemu" value="QEMU&lt;br/&gt;Userspace&lt;br/&gt;device emulation&lt;br/&gt;KVM_RUN 재호출" tooltip="userspace 처리가 필요한 Exit 에서만 개입하는 갈래. | Evidence: L510-L516, L533-L533" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry x="690.0" y="203.0" width="150.0" height="105.0" as="geometry"/>
</mxCell>
<mxCell id="n_guest-resume" value="Guest 실행 재개" tooltip="두 갈래가 다시 만나는 자리. VM Exit 은 VM 종료가 아니라 여기로 돌아온다. | Evidence: L521-L524, L529-L529" style="whiteSpace=wrap;html=1;rounded=1;strokeWidth=2;fontSize=14;fontStyle=1;fillColor=#ffffff;strokeColor=#2d4357;verticalAlign=middle;" vertex="1" parent="1">
<mxGeometry x="1000.0" y="152.0" width="150.0" height="64.0" as="geometry"/>
</mxCell>
<mxCell id="e_exit-to-kvm" value="VM Exit" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_guest" target="n_kvm">
<mxGeometry relative="1" as="geometry">
<mxPoint x="300.0" y="156.0" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_kernel-branch" value="커널 처리 가능" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_kvm" target="n_kvm-kernel-handling">
<mxGeometry relative="1" as="geometry">
<mxPoint x="634.0" y="135.2" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_kernel-reentry" value="VM Entry" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_kvm-kernel-handling" target="n_guest-resume">
<mxGeometry relative="1" as="geometry">
<mxPoint x="944.0" y="135.2" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_userspace-branch" value="KVM_RUN return" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_kvm" target="n_qemu">
<mxGeometry relative="1" as="geometry">
<mxPoint x="634.0" y="224.2" as="offset"/>
</mxGeometry>
</mxCell>
<mxCell id="e_userspace-reentry" value="VM Entry" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;endArrow=block;endFill=1;" edge="1" parent="1" source="n_qemu" target="n_guest-resume">
<mxGeometry relative="1" as="geometry">
<mxPoint x="944.0" y="224.2" as="offset"/>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
@@ -0,0 +1,853 @@
{
"type": "excalidraw",
"version": 2,
"source": "techviz-harness",
"elements": [
{
"id": "edge-exit-to-kvm",
"type": "arrow",
"x": 220.0,
"y": 184.0,
"width": 160.0,
"height": 0.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 576129632,
"version": 1,
"versionNonce": 483419770,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
0.0
],
[
80.0,
0.0
],
[
80.0,
0.0
],
[
160.0,
0.0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-guest",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-kvm",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-exit-to-kvm",
"type": "text",
"x": 255.0,
"y": 144.0,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1778979104,
"version": 1,
"versionNonce": 1759467009,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "VM Exit",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "VM Exit",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-kernel-branch",
"type": "arrow",
"x": 530.0,
"y": 95.5,
"width": 160.0,
"height": 79.5,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 298728286,
"version": 1,
"versionNonce": 1052103781,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
79.5
],
[
80.0,
79.5
],
[
80.0,
0.0
],
[
160.0,
0.0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-kvm",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-kvm-kernel-handling",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-kernel-branch",
"type": "text",
"x": 589.0,
"y": 123.25,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 182098500,
"version": 1,
"versionNonce": 150063666,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "커널 처리 가능",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "커널 처리 가능",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-kernel-reentry",
"type": "arrow",
"x": 840.0,
"y": 95.5,
"width": 160.0,
"height": 79.5,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 1851363334,
"version": 1,
"versionNonce": 126183680,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
0.0
],
[
80.0,
0.0
],
[
80.0,
79.5
],
[
160.0,
79.5
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-kvm-kernel-handling",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-guest-resume",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-kernel-reentry",
"type": "text",
"x": 899.0,
"y": 123.25,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1185810906,
"version": 1,
"versionNonce": 1820150380,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "VM Entry",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "VM Entry",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-userspace-branch",
"type": "arrow",
"x": 530.0,
"y": 193.0,
"width": 160.0,
"height": 62.5,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 1399118646,
"version": 1,
"versionNonce": 1254117045,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
0.0
],
[
80.0,
0.0
],
[
80.0,
62.5
],
[
160.0,
62.5
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-kvm",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-qemu",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-userspace-branch",
"type": "text",
"x": 578.0,
"y": 212.25,
"width": 112,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1771993102,
"version": 1,
"versionNonce": 1685196756,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "KVM_RUN return",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "KVM_RUN return",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "edge-userspace-reentry",
"type": "arrow",
"x": 840.0,
"y": 193.0,
"width": 160.0,
"height": 62.5,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": null,
"seed": 633909860,
"version": 1,
"versionNonce": 1287721817,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"points": [
[
0.0,
62.5
],
[
80.0,
62.5
],
[
80.0,
0.0
],
[
160.0,
0.0
]
],
"lastCommittedPoint": null,
"startBinding": {
"elementId": "node-qemu",
"focus": 0,
"gap": 4
},
"endBinding": {
"elementId": "node-guest-resume",
"focus": 0,
"gap": 4
},
"startArrowhead": null,
"endArrowhead": "arrow",
"elbowed": true
},
{
"id": "edge-label-userspace-reentry",
"type": "text",
"x": 899.0,
"y": 212.25,
"width": 90,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 142846947,
"version": 1,
"versionNonce": 1732717636,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 13,
"fontFamily": 5,
"text": "VM Entry",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "VM Entry",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-guest",
"type": "rectangle",
"x": 70.0,
"y": 152.0,
"width": 150.0,
"height": 64.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 746352068,
"version": 1,
"versionNonce": 1245638436,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-guest",
"type": "text",
"x": 80.0,
"y": 162.0,
"width": 130.0,
"height": 44.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1592812232,
"version": 1,
"versionNonce": 724526867,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "Guest",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "Guest",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-kvm",
"type": "rectangle",
"x": 380.0,
"y": 148.5,
"width": 150.0,
"height": 71.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1294725949,
"version": 1,
"versionNonce": 774205501,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-kvm",
"type": "text",
"x": 390.0,
"y": 158.5,
"width": 130.0,
"height": 51.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 820201432,
"version": 1,
"versionNonce": 242634004,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "KVM\nExit Reason",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "KVM\nExit Reason",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-kvm-kernel-handling",
"type": "rectangle",
"x": 690.0,
"y": 60.0,
"width": 150.0,
"height": 71.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 116878736,
"version": 1,
"versionNonce": 1278264154,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-kvm-kernel-handling",
"type": "text",
"x": 700.0,
"y": 70.0,
"width": 130.0,
"height": 51.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 66773704,
"version": 1,
"versionNonce": 1987847254,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "KVM 커널 처리\nKernel",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "KVM 커널 처리\nKernel",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-qemu",
"type": "rectangle",
"x": 690.0,
"y": 203.0,
"width": 150.0,
"height": 105.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1265942130,
"version": 1,
"versionNonce": 447320704,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-qemu",
"type": "text",
"x": 700.0,
"y": 213.0,
"width": 130.0,
"height": 85.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 82355235,
"version": 1,
"versionNonce": 463780486,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "QEMU\nUserspace\ndevice emulation\nKVM_RUN 재호출",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "QEMU\nUserspace\ndevice emulation\nKVM_RUN 재호출",
"autoResize": true,
"lineHeight": 1.25
},
{
"id": "node-guest-resume",
"type": "rectangle",
"x": 1000.0,
"y": 152.0,
"width": 150.0,
"height": 64.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "#ffffff",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1508197857,
"version": 1,
"versionNonce": 1661088114,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false
},
{
"id": "node-label-guest-resume",
"type": "text",
"x": 1010.0,
"y": 162.0,
"width": 130.0,
"height": 44.0,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 1,
"strokeStyle": "solid",
"roughness": 0,
"opacity": 100,
"groupIds": [],
"frameId": null,
"index": null,
"roundness": {
"type": 3
},
"seed": 1489903096,
"version": 1,
"versionNonce": 1640327916,
"isDeleted": false,
"boundElements": [],
"updated": 0,
"link": null,
"locked": false,
"fontSize": 15,
"fontFamily": 5,
"text": "Guest 실행 재개",
"textAlign": "center",
"verticalAlign": "middle",
"containerId": null,
"originalText": "Guest 실행 재개",
"autoResize": true,
"lineHeight": 1.25
}
],
"appState": {
"gridSize": 10,
"viewBackgroundColor": "#ffffff",
"currentItemFontFamily": 5
},
"files": {}
}
@@ -0,0 +1,31 @@
{
"harness_version": "0.2.0",
"spec_id": "vm-exit-handling-cycle",
"spec_version": "1.1",
"spec_sha256": "114180c059ff8c4be3e253da16d2d2f0e0fb44a2b87b03fcd2104f4e3fd6fa79",
"source_context": {
"document": "docs/virtualization/final/document.md",
"document_sha256": "181e2b3cc8a45bae81e7e8193d026937c4d586ae4495d3b2c323eb7e6abcfadd",
"anchor": {
"kind": "heading",
"value": "9. VM Exit 이후 처리",
"line": 493
}
},
"outputs": [
"vm-exit-handling-cycle.svg",
"vm-exit-handling-cycle.drawio",
"vm-exit-handling-cycle.mmd",
"vm-exit-handling-cycle.d2",
"vm-exit-handling-cycle.excalidraw",
"vm-exit-handling-cycle.alt.md"
],
"lint_issue_count": 0,
"assumption_count": 0,
"assumptions_allowed": false,
"composition_profile": "component-flow",
"reference_ids": [
"payment-event-flow"
],
"diagram_only": true
}
@@ -0,0 +1,13 @@
%% VM Exit 은 KVM 에서 끝나기도 하고 QEMU userspace 까지 가기도 한다
%% question: VM Exit 이 난 뒤 제어권은 어디까지 올라갔다가 어떻게 Guest 로 돌아오는가
flowchart LR
n0["Guest"]
n1["KVM"]
n2["KVM 커널 처리"]
n3["QEMU"]
n4["Guest 실행 재개"]
n0 -->|"VM Exit"| n1
n1 -->|"커널 처리 가능"| n2
n1 -->|"KVM_RUN return"| n3
n2 -->|"VM Entry"| n4
n3 -->|"VM Entry"| n4
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="1195" height="353" viewBox="0 0 1195 353" role="img" aria-labelledby="diagram-title diagram-description">
<title id="diagram-title">VM Exit 은 KVM 에서 끝나기도 하고 QEMU userspace 까지 가기도 한다</title>
<desc id="diagram-description">왼쪽에서 오른쪽으로 읽는다. 왼쪽 끝에 Guest 가 있고 VM Exit 이 KVM 으로 제어권을 넘긴다. KVM 은 Exit Reason 을 확인해 두 갈래 중 하나를 고른다. 커널 안에서 처리할 수 있는 Exit 은 Kernel 쪽 KVM 커널 처리로 가고, userspace 처리가 필요한 Exit 만 KVM_RUN 이 반환되면서 Userspace 쪽 QEMU 로 간다. QEMU 는 필요한 장치 동작을 처리한 뒤 KVM_RUN 을 다시 호출한다. 두 갈래는 오른쪽 끝에서 다시 만나며 어느 쪽이든 VM Entry 를 지나 Guest 실행 재개로 돌아온다. 무엇이 Exit 을 부르는지와 Exit 이 잦을 때 무엇을 함께 보는지는 본문의 표와 문단이 맡는다.</desc>
<metadata>{&quot;techviz&quot;:{&quot;spec_version&quot;:&quot;1.1&quot;,&quot;id&quot;:&quot;vm-exit-handling-cycle&quot;,&quot;profile&quot;:&quot;component-flow&quot;},&quot;source_context&quot;:{&quot;document&quot;:&quot;docs/virtualization/final/document.md&quot;,&quot;document_sha256&quot;:&quot;181e2b3cc8a45bae81e7e8193d026937c4d586ae4495d3b2c323eb7e6abcfadd&quot;,&quot;anchor&quot;:{&quot;kind&quot;:&quot;heading&quot;,&quot;value&quot;:&quot;9. VM Exit 이후 처리&quot;,&quot;line&quot;:493}},&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="1195" height="353" />
<polyline class="edge kind-control style-solid emphasis-normal" points="220.0,184.0 300.0,184.0 300.0,184.0 380.0,184.0" data-evidence="495-495,498-502" />
<rect class="edge-label-bg" x="267.6" y="142.0" width="64.9" height="22" rx="3" />
<text class="edge-label" x="300.0" y="157.0">VM Exit</text>
<polyline class="edge kind-control style-solid emphasis-normal" points="530.0,175.0 610.0,175.0 610.0,95.5 690.0,95.5" data-evidence="504-510,531-531" />
<rect class="edge-label-bg" x="598.2" y="121.2" width="71.6" height="22" rx="3" />
<text class="edge-label" x="634.0" y="136.2">커널 처리 가능</text>
<polyline class="edge kind-control style-solid emphasis-normal" points="840.0,95.5 920.0,95.5 920.0,175.0 1000.0,175.0" data-evidence="518-524,531-531" />
<rect class="edge-label-bg" x="908.2" y="121.2" width="71.6" height="22" rx="3" />
<text class="edge-label" x="944.0" y="136.2">VM Entry</text>
<polyline class="edge kind-control style-solid emphasis-normal" points="530.0,193.0 610.0,193.0 610.0,255.5 690.0,255.5" data-evidence="508-512,533-533" />
<rect class="edge-label-bg" x="578.1" y="210.2" width="111.8" height="22" rx="3" />
<text class="edge-label" x="634.0" y="225.2">KVM_RUN return</text>
<polyline class="edge kind-control style-solid emphasis-normal" points="840.0,255.5 920.0,255.5 920.0,193.0 1000.0,193.0" data-evidence="514-524,533-533" />
<rect class="edge-label-bg" x="908.2" y="210.2" width="71.6" height="22" rx="3" />
<text class="edge-label" x="944.0" y="225.2">VM Entry</text>
<g id="node-guest">
<rect class="node-shape kind-service emphasis-normal role-source" data-evidence="498-501" x="70.0" y="152.0" width="150.0" height="64.0" rx="7" />
<text class="node-label" x="145.0" y="182.0">Guest</text>
</g>
<g id="node-kvm">
<rect class="node-shape kind-service emphasis-primary role-service" data-evidence="495-495,502-504" x="380.0" y="148.5" width="150.0" height="71.0" rx="7" />
<text class="node-label" x="455.0" y="175.5">KVM</text>
<line class="node-detail-divider" x1="394.0" y1="196.5" x2="516.0" y2="196.5" />
<text class="node-detail" x="396.0" y="213.5">Exit Reason</text>
</g>
<g id="node-kvm-kernel-handling">
<rect class="node-shape kind-service emphasis-normal role-service" data-evidence="508-510,531-531" x="690.0" y="60.0" width="150.0" height="71.0" rx="7" />
<text class="node-label" x="765.0" y="87.0">KVM 커널 처리</text>
<line class="node-detail-divider" x1="704.0" y1="108.0" x2="826.0" y2="108.0" />
<text class="node-detail" x="706.0" y="125.0">Kernel</text>
</g>
<g id="node-qemu">
<rect class="node-shape kind-service emphasis-normal role-service" data-evidence="510-516,533-533" x="690.0" y="203.0" width="150.0" height="105.0" rx="7" />
<text class="node-label" x="765.0" y="230.0">QEMU</text>
<line class="node-detail-divider" x1="704.0" y1="251.0" x2="826.0" y2="251.0" />
<text class="node-detail" x="706.0" y="268.0">Userspace</text>
<text class="node-detail" x="706.0" y="284.0">device emulation</text>
<text class="node-detail" x="706.0" y="300.0">KVM_RUN 재호출</text>
</g>
<g id="node-guest-resume">
<rect class="node-shape kind-service emphasis-normal role-sink" data-evidence="521-524,529-529" x="1000.0" y="152.0" width="150.0" height="64.0" rx="7" />
<text class="node-label" x="1075.0" y="182.0">Guest 실행 재개</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.0 KiB