The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4d447b30f7be761b0c2877513e79f484511a00a5

commit 4d447b30f7be761b0c2877513e79f484511a00a5
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2022-10-31 23:30:55 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2022-11-01 18:44:42 +0000

    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 8daf2ae29737..dc6e03303b44 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);
                }
        }

Reply via email to