The branch main has been updated by br:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6492ef7b832c9dcb07784aaf752cb71682bd0444

commit 6492ef7b832c9dcb07784aaf752cb71682bd0444
Author:     Ruslan Bukin <b...@freebsd.org>
AuthorDate: 2025-02-05 09:30:50 +0000
Commit:     Ruslan Bukin <b...@freebsd.org>
CommitDate: 2025-02-05 09:30:58 +0000

    bhyve: Sleep for a short period after VM_EXITCODE_DEBUG exits
    
    Apply 2e2b8afa52da6 for RISC-V:
    
    As on amd64 and aarch64 APs will repeatedly exit until they are
    brought online, so this hack helps avoid burning CPU time during
    guest bootup.
    
    Reviewed by:    corvink, markj
    Differential Revision:  https://reviews.freebsd.org/D48811
---
 usr.sbin/bhyve/riscv/vmexit.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/usr.sbin/bhyve/riscv/vmexit.c b/usr.sbin/bhyve/riscv/vmexit.c
index e2efd53bdede..233dba9f3c7f 100644
--- a/usr.sbin/bhyve/riscv/vmexit.c
+++ b/usr.sbin/bhyve/riscv/vmexit.c
@@ -47,6 +47,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 #include <vmmapi.h>
 
@@ -135,6 +136,12 @@ vmexit_debug(struct vmctx *ctx __unused, struct vcpu *vcpu 
__unused,
     struct vm_run *vmrun __unused)
 {
 
+       /*
+        * XXX-MJ sleep for a short period to avoid chewing up the CPU in the
+        * window between activation of the vCPU thread and the
+        * SBI_HSM_HART_START request.
+        */
+       usleep(1000);
        return (VMEXIT_CONTINUE);
 }
 

Reply via email to