Commit 91c18a6
committed
refactor: VirtIO MMIO persistence logic
VirtIO MMIO restore logic activates the device the moment we restore the
device state, if the device was activated when snapshotted. Move the
activation responsibility to the logic the restores the MMIO transport.
The reason for this change is that that's how it will be done for the
PCI transport. Unifying this will allow us reusing the same types for
restoring the non-transport state of devices.
Note that we needed to change the way Net devices are saved/restored.
RxBuffer type of Net devices holds RX descriptors that we have parsed
from the Queue ahead of time. The way we restored this info was
manipulating the queue to re-parse the RX descriptors during the restore
phase. However, we need the device to be activated to do so, which now
isn't. So, instead of storing this info inside the snapshot make sure we
have flushed everything before taking the snapshot.
Also, simplify a bit the types that we use for serializing/deserializing
the state of a device.
Signed-off-by: Babis Chalios <[email protected]>1 parent 9400d39 commit 91c18a6
File tree
8 files changed
+106
-239
lines changed- src/vmm/src
- device_manager
- devices/virtio
- balloon
- block
- virtio
- net
- rng
- vsock
8 files changed
+106
-239
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | 98 | | |
101 | 99 | | |
102 | 100 | | |
| |||
154 | 152 | | |
155 | 153 | | |
156 | 154 | | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
176 | 167 | | |
177 | 168 | | |
178 | 169 | | |
| |||
202 | 193 | | |
203 | 194 | | |
204 | 195 | | |
205 | | - | |
206 | 196 | | |
207 | 197 | | |
208 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
20 | 29 | | |
21 | 30 | | |
22 | 31 | | |
23 | 32 | | |
24 | | - | |
25 | 33 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | 114 | | |
124 | 115 | | |
125 | 116 | | |
| |||
132 | 123 | | |
133 | 124 | | |
134 | 125 | | |
135 | | - | |
| 126 | + | |
136 | 127 | | |
137 | 128 | | |
138 | 129 | | |
| |||
227 | 218 | | |
228 | 219 | | |
229 | 220 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
| 221 | + | |
234 | 222 | | |
235 | 223 | | |
236 | 224 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
930 | 930 | | |
931 | 931 | | |
932 | 932 | | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
933 | 946 | | |
934 | 947 | | |
935 | 948 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 33 | | |
55 | 34 | | |
56 | 35 | | |
| |||
62 | 41 | | |
63 | 42 | | |
64 | 43 | | |
65 | | - | |
66 | | - | |
| 44 | + | |
67 | 45 | | |
68 | 46 | | |
69 | 47 | | |
70 | 48 | | |
71 | 49 | | |
72 | 50 | | |
73 | 51 | | |
74 | | - | |
75 | | - | |
76 | 52 | | |
77 | 53 | | |
78 | 54 | | |
| |||
108 | 84 | | |
109 | 85 | | |
110 | 86 | | |
111 | | - | |
112 | 87 | | |
113 | 88 | | |
114 | 89 | | |
| |||
153 | 128 | | |
154 | 129 | | |
155 | 130 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | 131 | | |
176 | 132 | | |
177 | 133 | | |
| |||
215 | 171 | | |
216 | 172 | | |
217 | 173 | | |
218 | | - | |
219 | 174 | | |
220 | 175 | | |
221 | 176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 28 | + | |
36 | 29 | | |
37 | 30 | | |
38 | 31 | | |
| |||
72 | 65 | | |
73 | 66 | | |
74 | 67 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | 68 | | |
79 | 69 | | |
80 | 70 | | |
| |||
99 | 89 | | |
100 | 90 | | |
101 | 91 | | |
102 | | - | |
| 92 | + | |
103 | 93 | | |
104 | 94 | | |
105 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | 56 | | |
59 | 57 | | |
60 | 58 | | |
| |||
123 | 121 | | |
124 | 122 | | |
125 | 123 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 124 | + | |
134 | 125 | | |
135 | 126 | | |
136 | 127 | | |
| |||
193 | 184 | | |
194 | 185 | | |
195 | 186 | | |
196 | | - | |
197 | 187 | | |
198 | 188 | | |
199 | 189 | | |
| |||
0 commit comments