Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115640492
D40573.id123445.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D40573.id123445.diff
View Options
diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c
--- a/usr.sbin/bhyve/bhyverun.c
+++ b/usr.sbin/bhyve/bhyverun.c
@@ -553,17 +553,31 @@
assert(error == 0);
}
-static int
+static void
fbsdrun_deletecpu(int vcpu)
{
+ static pthread_mutex_t resetcpu_mtx = PTHREAD_MUTEX_INITIALIZER;
+ static pthread_cond_t resetcpu_cond = PTHREAD_COND_INITIALIZER;
+ pthread_mutex_lock(&resetcpu_mtx);
if (!CPU_ISSET(vcpu, &cpumask)) {
fprintf(stderr, "Attempting to delete unknown cpu %d\n", vcpu);
exit(4);
}
- CPU_CLR_ATOMIC(vcpu, &cpumask);
- return (CPU_EMPTY(&cpumask));
+ CPU_CLR(vcpu, &cpumask);
+
+ if (vcpu != BSP) {
+ pthread_cond_signal(&resetcpu_cond);
+ pthread_mutex_unlock(&resetcpu_mtx);
+ pthread_exit(NULL);
+ /* NOTREACHED */
+ }
+
+ while (!CPU_EMPTY(&cpumask)) {
+ pthread_cond_wait(&resetcpu_cond, &resetcpu_mtx);
+ }
+ pthread_mutex_unlock(&resetcpu_mtx);
}
static int
@@ -818,9 +832,6 @@
return (VMEXIT_ABORT);
}
-static pthread_mutex_t resetcpu_mtx = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t resetcpu_cond = PTHREAD_COND_INITIALIZER;
-
static int
vmexit_suspend(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun)
{
@@ -834,19 +845,6 @@
fbsdrun_deletecpu(vcpuid);
- if (vcpuid != BSP) {
- pthread_mutex_lock(&resetcpu_mtx);
- pthread_cond_signal(&resetcpu_cond);
- pthread_mutex_unlock(&resetcpu_mtx);
- pthread_exit(NULL);
- }
-
- pthread_mutex_lock(&resetcpu_mtx);
- while (!CPU_EMPTY(&cpumask)) {
- pthread_cond_wait(&resetcpu_cond, &resetcpu_mtx);
- }
- pthread_mutex_unlock(&resetcpu_mtx);
-
switch (how) {
case VM_SUSPEND_RESET:
exit(0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 27, 10:17 AM (12 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17805205
Default Alt Text
D40573.id123445.diff (1 KB)
Attached To
Mode
D40573: bhyve: Refactor vmexit_suspend() a bit
Attached
Detach File
Event Timeline
Log In to Comment