git: 2e2b8afa52da - main - bhyve: Sleep for a short period after VM_EXITCODE_DEBUG exits
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 31 Jul 2024 23:44:40 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2e2b8afa52da6e2cd08482bcd512e016aa264ddb commit 2e2b8afa52da6e2cd08482bcd512e016aa264ddb Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-07-31 22:41:28 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-07-31 22:41:28 +0000 bhyve: Sleep for a short period after VM_EXITCODE_DEBUG exits As on amd64, APs will repeatedly exit until they are brought online, so this hack helps avoid burning CPU time during guest bootup. Reviewed by: jhb MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D46195 --- usr.sbin/bhyve/aarch64/vmexit.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/usr.sbin/bhyve/aarch64/vmexit.c b/usr.sbin/bhyve/aarch64/vmexit.c index a47df27e54fc..7f0cfe672c55 100644 --- a/usr.sbin/bhyve/aarch64/vmexit.c +++ b/usr.sbin/bhyve/aarch64/vmexit.c @@ -43,6 +43,7 @@ #include <stdbool.h> #include <stdio.h> #include <stdlib.h> +#include <unistd.h> #include <vmmapi.h> @@ -132,6 +133,11 @@ vmexit_debug(struct vmctx *ctx __unused, struct vcpu *vcpu, struct vm_run *vmrun __unused) { gdb_cpu_suspend(vcpu); + /* + * XXX-MJ sleep for a short period to avoid chewing up the CPU in the + * window between activation of the vCPU thread and the STARTUP IPI. + */ + usleep(1000); return (VMEXIT_CONTINUE); }