git: 38acc80a5b69 - stable/13 - bhyve: fix restore of kernel structs
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Mar 2023 10:29:24 UTC
The branch stable/13 has been updated by corvink:
URL: https://cgit.FreeBSD.org/src/commit/?id=38acc80a5b696a0f9d029b5de209b6a2045332cd
commit 38acc80a5b696a0f9d029b5de209b6a2045332cd
Author: Vitaliy Gusev <gusev.vitaliy@gmail.com>
AuthorDate: 2023-02-28 10:32:49 +0000
Commit: Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2023-03-17 10:26:33 +0000
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
(cherry picked from commit 8104fc31a234bad1ba68910f66876395fc58ebdc)
---
sys/amd64/include/vmm.h | 2 --
sys/amd64/include/vmm_snapshot.h | 3 +--
sys/amd64/vmm/amd/svm.c | 10 ----------
sys/amd64/vmm/intel/vmx.c | 7 -------
sys/amd64/vmm/vmm.c | 4 ----
usr.sbin/bhyve/snapshot.c | 1 -
6 files changed, 1 insertion(+), 26 deletions(-)
diff --git a/sys/amd64/include/vmm.h b/sys/amd64/include/vmm.h
index cb883bb0e143..95f5597f7e1a 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
@@ -2415,15 +2415,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)
{
@@ -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
@@ -4093,12 +4093,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)
{
@@ -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 8cdf57608055..1b5e6946d785 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 },