Commit 07cf216
committed
fix: Call KVM_KVMCLOCK_CTRL not only after pause but also 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 in addition to after
pausing a VM.
[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 07cf216
3 files changed
+23
-20
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 | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
275 | 288 | | |
276 | 289 | | |
277 | 290 | | |
| |||
699 | 712 | | |
700 | 713 | | |
701 | 714 | | |
| 715 | + | |
| 716 | + | |
702 | 717 | | |
703 | 718 | | |
704 | 719 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | 237 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
249 | 241 | | |
250 | 242 | | |
251 | 243 | | |
| |||
263 | 255 | | |
264 | 256 | | |
265 | 257 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | 258 | | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
| 259 | + | |
275 | 260 | | |
276 | 261 | | |
277 | 262 | | |
| |||
322 | 307 | | |
323 | 308 | | |
324 | 309 | | |
325 | | - | |
326 | 310 | | |
327 | 311 | | |
328 | 312 | | |
| |||
0 commit comments