vmm: fix restore of TSC offset

After suspend/resume Ubuntu 20.04 and 22.04 installer can hang if
tsc-early clocksource has a big skew.

Reviewed by:		corvink, jhb
Fixes:			a7db532e3a ("vmm: Simplify saving of absolute TSC values in snapshots.")
MFC after:		2 weeks
Sponsored by:		vStack
Differential Revision:	https://reviews.freebsd.org/D38474
This commit is contained in:
Vitaliy Gusev 2023-02-28 12:16:35 +01:00 committed by Corvin Köhne
parent 34f804e547
commit 281b496f22
No known key found for this signature in database
GPG Key ID: D854DA56315E026A

View File

@ -2859,6 +2859,8 @@ vm_snapshot_vcpus(struct vm *vm, struct vm_snapshot_meta *meta)
*/
tsc = now + vcpu->tsc_offset;
SNAPSHOT_VAR_OR_LEAVE(tsc, meta, ret, done);
if (meta->op == VM_SNAPSHOT_RESTORE)
vcpu->tsc_offset = tsc;
}
done: