From 4d447b30f7be761b0c2877513e79f484511a00a5 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 1 Nov 2022 01:30:55 +0200 Subject: [PATCH] vmm: do not leak halted_cpus bit after suspension Reported by: bz PR: 267468 Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37227 --- sys/amd64/vmm/vmm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index 8daf2ae2973..dc6e03303b4 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -1424,8 +1424,13 @@ vm_handle_hlt(struct vm *vm, int vcpuid, bool intr_disabled, bool *retu) if (td_ast_pending(td, TDA_SUSPEND)) { vcpu_unlock(vcpu); error = thread_check_susp(td, false); - if (error != 0) + if (error != 0) { + if (vcpu_halted) { + CPU_CLR_ATOMIC(vcpuid, + &vm->halted_cpus); + } return (error); + } vcpu_lock(vcpu); } }