Commit 64f27a2
committed
fix: Move KVM_KVMCLOCK_CTRL from after pause to before resume
KVM_KVMCLOCK_CTRL ioctl sets `pvclock_set_guest_stopped_request` flag of
`kvm_vcpu_arch` [1]. On the next guest time update, if the flag is set,
KVM ORs in `PVCLOCK_GUEST_STOPPED` and `kvm_setup_guest_pvclock()`
pushes the `hv_clock` into the guest's pvclock page [2]. If the
`hv_clock` has not been written to the guest's pvclock page when taking
a snapshot, it is not saved in the snapshot memory (i.e.
`PVCLOCK_GUEST_STOPPED` isn't set in resumed VMs). So we should call
KVM_KVMCLOCK_CTRL ioctl before resuming a VM rather than after pausing a
VM. That covers both the pause-and-resume case and the
restore-and-resume case.
[1]: https://elixir.bootlin.com/linux/v6.16.3/source/arch/x86/kvm/x86.c#L5734
[2]: https://elixir.bootlin.com/linux/v6.16.3/source/arch/x86/kvm/x86.c#L3286-L3295
Signed-off-by: Takahiro Itazuri <[email protected]>1 parent cc20162 commit 64f27a2
2 files changed
+14
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
| 236 | + | |
249 | 237 | | |
250 | 238 | | |
251 | 239 | | |
| |||
263 | 251 | | |
264 | 252 | | |
265 | 253 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | 254 | | |
277 | 255 | | |
278 | 256 | | |
| |||
322 | 300 | | |
323 | 301 | | |
324 | 302 | | |
325 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
326 | 312 | | |
327 | 313 | | |
328 | 314 | | |
| |||
0 commit comments