diff options
author | Mark Johnston <markj@FreeBSD.org> | 2024-07-31 22:40:51 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2024-07-31 22:41:30 +0000 |
commit | 4c5188bbeb88362112fa2891ccb6330f4c429ff3 (patch) | |
tree | 7aa0bb292d421ff486f9526fa8474ee91e859d50 | |
parent | 2e2b8afa52da6e2cd08482bcd512e016aa264ddb (diff) |
bhyve: Assert success in a couple of libvmmapi calls
- In vmexit_smccc(), copy an assertion from amd64.
- In fbsdrun_addcpu(), make sure that our vm_suspend_cpu() call is
succesful.
Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D46197
-rw-r--r-- | usr.sbin/bhyve/aarch64/vmexit.c | 3 | ||||
-rw-r--r-- | usr.sbin/bhyve/bhyverun.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/bhyve/aarch64/vmexit.c b/usr.sbin/bhyve/aarch64/vmexit.c index 7f0cfe672c55..e1a9509d5d12 100644 --- a/usr.sbin/bhyve/aarch64/vmexit.c +++ b/usr.sbin/bhyve/aarch64/vmexit.c @@ -249,7 +249,8 @@ vmexit_smccc(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun) how = VM_SUSPEND_POWEROFF; else how = VM_SUSPEND_RESET; - vm_suspend(ctx, how); + error = vm_suspend(ctx, how); + assert(error == 0 || errno == EALREADY); break; default: break; diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index aca770a92642..f844da90e76c 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -413,7 +413,8 @@ fbsdrun_addcpu(int vcpuid) CPU_SET_ATOMIC(vcpuid, &cpumask); - vm_suspend_cpu(vi->vcpu); + error = vm_suspend_cpu(vi->vcpu); + assert(error == 0); error = pthread_create(&thr, NULL, fbsdrun_start_thread, vi); assert(error == 0); |