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
This commit is contained in:
Mark Johnston 2024-07-31 22:41:28 +00:00
parent b4fb947923
commit 2e2b8afa52

View file

@ -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);
}