Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Feb 2025 09:34:42 GMT
From:      Ruslan Bukin <br@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 6492ef7b832c - main - bhyve: Sleep for a short period after VM_EXITCODE_DEBUG exits
Message-ID:  <202502050934.5159Yg7M025643@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by br:

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

commit 6492ef7b832c9dcb07784aaf752cb71682bd0444
Author:     Ruslan Bukin <br@FreeBSD.org>
AuthorDate: 2025-02-05 09:30:50 +0000
Commit:     Ruslan Bukin <br@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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502050934.5159Yg7M025643>