aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaliy Gusev <gusev.vitaliy@gmail.com>2023-02-28 10:32:49 +0000
committerCorvin Köhne <corvink@FreeBSD.org>2023-02-28 12:37:53 +0000
commit8104fc31a234bad1ba68910f66876395fc58ebdc (patch)
tree9674b8848889a6f9c126beae82219d0f235653db
parent281b496f22d1d666b2ef1e54985432627ec434a4 (diff)
downloadsrc-8104fc31a234bad1ba68910f66876395fc58ebdc.tar.gz
src-8104fc31a234bad1ba68910f66876395fc58ebdc.zip
bhyve: fix restore of kernel structs
vmx_snapshot() and svm_snapshot() do not save any data and error occurs at resume: Restoring kernel structs... vm_restore_kern_struct: Kernel struct size was 0 for: vmx Failed to restore kernel structs. Reviewed by: corvink, markj Fixes: 39ec056e6dbd89e26ee21d2928dbd37335de0ebc ("vmm: Rework snapshotting of CPU-specific per-vCPU data.") MFC after: 2 weeks Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38476
-rw-r--r--sys/amd64/include/vmm.h2
-rw-r--r--sys/amd64/include/vmm_snapshot.h3
-rw-r--r--sys/amd64/vmm/amd/svm.c10
-rw-r--r--sys/amd64/vmm/intel/vmx.c7
-rw-r--r--sys/amd64/vmm/vmm.c4
-rw-r--r--usr.sbin/bhyve/snapshot.c1
6 files changed, 1 insertions, 26 deletions
diff --git a/sys/amd64/include/vmm.h b/sys/amd64/include/vmm.h
index bd6510b92527..4d6242a8134d 100644
--- a/sys/amd64/include/vmm.h
+++ b/sys/amd64/include/vmm.h
@@ -184,7 +184,6 @@ typedef struct vmspace * (*vmi_vmspace_alloc)(vm_offset_t min, vm_offset_t max);
typedef void (*vmi_vmspace_free)(struct vmspace *vmspace);
typedef struct vlapic * (*vmi_vlapic_init)(void *vcpui);
typedef void (*vmi_vlapic_cleanup)(struct vlapic *vlapic);
-typedef int (*vmi_snapshot_t)(void *vmi, struct vm_snapshot_meta *meta);
typedef int (*vmi_snapshot_vcpu_t)(void *vcpui, struct vm_snapshot_meta *meta);
typedef int (*vmi_restore_tsc_t)(void *vcpui, uint64_t now);
@@ -210,7 +209,6 @@ struct vmm_ops {
vmi_vlapic_cleanup vlapic_cleanup;
/* checkpoint operations */
- vmi_snapshot_t snapshot;
vmi_snapshot_vcpu_t vcpu_snapshot;
vmi_restore_tsc_t restore_tsc;
};
diff --git a/sys/amd64/include/vmm_snapshot.h b/sys/amd64/include/vmm_snapshot.h
index d08f980e7988..c4d7fc4d4371 100644
--- a/sys/amd64/include/vmm_snapshot.h
+++ b/sys/amd64/include/vmm_snapshot.h
@@ -47,8 +47,7 @@
struct vmctx;
enum snapshot_req {
- STRUCT_VMX,
- STRUCT_VIOAPIC,
+ STRUCT_VIOAPIC = 1,
STRUCT_VM,
STRUCT_VLAPIC,
VM_MEM,
diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c
index ee1154ef85b6..d995b68ebdc6 100644
--- a/sys/amd64/vmm/amd/svm.c
+++ b/sys/amd64/vmm/amd/svm.c
@@ -2416,15 +2416,6 @@ svm_vlapic_cleanup(struct vlapic *vlapic)
#ifdef BHYVE_SNAPSHOT
static int
-svm_snapshot(void *vmi, struct vm_snapshot_meta *meta)
-{
- if (meta->op == VM_SNAPSHOT_RESTORE)
- flush_by_asid();
-
- return (0);
-}
-
-static int
svm_vcpu_snapshot(void *vcpui, struct vm_snapshot_meta *meta)
{
struct svm_vcpu *vcpu;
@@ -2656,7 +2647,6 @@ const struct vmm_ops vmm_ops_amd = {
.vlapic_init = svm_vlapic_init,
.vlapic_cleanup = svm_vlapic_cleanup,
#ifdef BHYVE_SNAPSHOT
- .snapshot = svm_snapshot,
.vcpu_snapshot = svm_vcpu_snapshot,
.restore_tsc = svm_restore_tsc,
#endif
diff --git a/sys/amd64/vmm/intel/vmx.c b/sys/amd64/vmm/intel/vmx.c
index fa94c707001c..91406f0614ce 100644
--- a/sys/amd64/vmm/intel/vmx.c
+++ b/sys/amd64/vmm/intel/vmx.c
@@ -4094,12 +4094,6 @@ vmx_vlapic_cleanup(struct vlapic *vlapic)
#ifdef BHYVE_SNAPSHOT
static int
-vmx_snapshot(void *vmi, struct vm_snapshot_meta *meta)
-{
- return (0);
-}
-
-static int
vmx_vcpu_snapshot(void *vcpui, struct vm_snapshot_meta *meta)
{
struct vmcs *vmcs;
@@ -4254,7 +4248,6 @@ const struct vmm_ops vmm_ops_intel = {
.vlapic_init = vmx_vlapic_init,
.vlapic_cleanup = vmx_vlapic_cleanup,
#ifdef BHYVE_SNAPSHOT
- .snapshot = vmx_snapshot,
.vcpu_snapshot = vmx_vcpu_snapshot,
.restore_tsc = vmx_restore_tsc,
#endif
diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c
index 794ec5ab6597..36a129e8ec8f 100644
--- a/sys/amd64/vmm/vmm.c
+++ b/sys/amd64/vmm/vmm.c
@@ -254,7 +254,6 @@ DEFINE_VMMOPS_IFUNC(void, vmspace_free, (struct vmspace *vmspace))
DEFINE_VMMOPS_IFUNC(struct vlapic *, vlapic_init, (void *vcpui))
DEFINE_VMMOPS_IFUNC(void, vlapic_cleanup, (struct vlapic *vlapic))
#ifdef BHYVE_SNAPSHOT
-DEFINE_VMMOPS_IFUNC(int, snapshot, (void *vmi, struct vm_snapshot_meta *meta))
DEFINE_VMMOPS_IFUNC(int, vcpu_snapshot, (void *vcpui,
struct vm_snapshot_meta *meta))
DEFINE_VMMOPS_IFUNC(int, restore_tsc, (void *vcpui, uint64_t now))
@@ -2917,9 +2916,6 @@ vm_snapshot_req(struct vm *vm, struct vm_snapshot_meta *meta)
int ret = 0;
switch (meta->dev_req) {
- case STRUCT_VMX:
- ret = vmmops_snapshot(vm->cookie, meta);
- break;
case STRUCT_VMCX:
ret = vm_snapshot_vcpu(vm, meta);
break;
diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c
index 0c9e32abd326..6143f6f3a489 100644
--- a/usr.sbin/bhyve/snapshot.c
+++ b/usr.sbin/bhyve/snapshot.c
@@ -155,7 +155,6 @@ static const struct vm_snapshot_dev_info snapshot_devs[] = {
static const struct vm_snapshot_kern_info snapshot_kern_structs[] = {
{ "vhpet", STRUCT_VHPET },
{ "vm", STRUCT_VM },
- { "vmx", STRUCT_VMX },
{ "vioapic", STRUCT_VIOAPIC },
{ "vlapic", STRUCT_VLAPIC },
{ "vmcx", STRUCT_VMCX },