Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147291662
D38477.id116991.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D38477.id116991.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
@@ -1488,8 +1488,28 @@
assert(error == 0);
}
+ /* Allocate per-VCPU resources. */
+ mt_vmm_info = calloc(guest_ncpus, sizeof(*mt_vmm_info));
+
+ /*
+ * Add all vCPUs.
+ */
+ for (int vcpu = 0; vcpu < guest_ncpus; vcpu++) {
+ bool suspend = (vcpu != BSP);
+#ifdef BHYVE_SNAPSHOT
+ if (restore_file != NULL)
+ suspend = true;
+#endif
+ spinup_vcpu(ctx, vcpu, suspend);
+ }
+
#ifdef BHYVE_SNAPSHOT
+ /* initialize mutex/cond variables */
+ init_snapshot();
+
if (restore_file != NULL) {
+ vm_vcpu_pause(ctx);
+
fprintf(stdout, "Pausing pci devs...\r\n");
if (vm_pause_user_devs() != 0) {
fprintf(stderr, "Failed to pause PCI device state.\n");
@@ -1564,36 +1584,18 @@
#endif
#ifdef BHYVE_SNAPSHOT
- if (restore_file != NULL)
- destroy_restore_state(&rstate);
-
- /* initialize mutex/cond variables */
- init_snapshot();
-
/*
* checkpointing thread for communication with bhyvectl
*/
if (init_checkpoint_thread(ctx) < 0)
printf("Failed to start checkpoint thread!\r\n");
- if (restore_file != NULL)
+ if (restore_file != NULL) {
+ destroy_restore_state(&rstate);
vm_restore_time(ctx);
-#endif
-
- /* Allocate per-VCPU resources. */
- mt_vmm_info = calloc(guest_ncpus, sizeof(*mt_vmm_info));
-
- /*
- * Add all vCPUs.
- */
- for (int vcpu = 0; vcpu < guest_ncpus; vcpu++) {
- bool suspend = (vcpu != BSP);
-#ifdef BHYVE_SNAPSHOT
- if (restore_file != NULL)
- suspend = false;
-#endif
- spinup_vcpu(ctx, vcpu, suspend);
+ vm_vcpu_resume(ctx);
}
+#endif
/*
* Head off to the main event dispatch loop
diff --git a/usr.sbin/bhyve/snapshot.h b/usr.sbin/bhyve/snapshot.h
--- a/usr.sbin/bhyve/snapshot.h
+++ b/usr.sbin/bhyve/snapshot.h
@@ -106,4 +106,8 @@
int load_restore_file(const char *filename, struct restore_state *rstate);
+void vm_vcpu_pause(struct vmctx *ctx);
+void vm_vcpu_resume(struct vmctx *ctx);
+
+
#endif
diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c
--- a/usr.sbin/bhyve/snapshot.c
+++ b/usr.sbin/bhyve/snapshot.c
@@ -1290,7 +1290,7 @@
pthread_mutex_unlock(&vcpu_lock);
}
-static void
+void
vm_vcpu_pause(struct vmctx *ctx)
{
@@ -1302,7 +1302,7 @@
pthread_mutex_unlock(&vcpu_lock);
}
-static void
+void
vm_vcpu_resume(struct vmctx *ctx)
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 10, 5:59 PM (2 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29504311
Default Alt Text
D38477.id116991.diff (2 KB)
Attached To
Mode
D38477: bhyve: Resume fails due to invalid guest state if guest_ncpus > 1
Attached
Detach File
Event Timeline
Log In to Comment