* [PATCH][HVM] save/restore fix
@ 2007-01-27 13:46 Zhai, Edwin
0 siblings, 0 replies; only message in thread
From: Zhai, Edwin @ 2007-01-27 13:46 UTC (permalink / raw)
To: Ian Pratt, Keir Fraser, Tim Deegan; +Cc: xen-devel, edwin.zhai
[PATCH][HVM] save/restore fix
Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
* do not save "down" vcpu's vmcs to avoid system crash
* make hvm_ctxt buffer bigger as all vmcs sit here, otherwise >=4 vcpus cause overflow
diff -r e43ef79379e1 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Fri Jan 26 16:47:47 2007 +0800
+++ b/xen/arch/x86/hvm/hvm.c Sat Jan 27 20:37:58 2007 +0800
@@ -189,9 +189,26 @@ void hvm_domain_destroy(struct domain *d
unmap_domain_page_global((void *)d->arch.hvm_domain.buffered_io_va);
}
+#define HVM_VCPU_CTXT_MAGIC 0x85963130
+void hvm_save_cpu_ctxt(hvm_domain_context_t *h, void *opaque)
+{
+ struct vcpu *v = opaque;
+
+ if ( test_bit(_VCPUF_down, &v->vcpu_flags) ) {
+ hvm_put_32u(h, 0x0);
+ return;
+ }
+
+ hvm_put_32u(h, HVM_VCPU_CTXT_MAGIC);
+ hvm_funcs.save_cpu_ctxt(h, opaque);
+}
+
int hvm_load_cpu_ctxt(hvm_domain_context_t *h, void *opaque, int version)
{
struct vcpu *v = opaque;
+
+ if ( hvm_get_32u(h) != HVM_VCPU_CTXT_MAGIC )
+ return 0;
if ( hvm_funcs.load_cpu_ctxt(h, opaque, version) < 0 )
return -EINVAL;
@@ -208,7 +225,7 @@ int hvm_vcpu_initialise(struct vcpu *v)
int rc;
hvm_register_savevm(v->domain, "xen_hvm_cpu", v->vcpu_id, 1,
- hvm_funcs.save_cpu_ctxt, hvm_load_cpu_ctxt,
+ hvm_save_cpu_ctxt, hvm_load_cpu_ctxt,
(void *)v);
if ( (rc = vlapic_init(v)) != 0 )
diff -r e43ef79379e1 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h Fri Jan 26 16:47:47 2007 +0800
+++ b/xen/include/public/domctl.h Sat Jan 27 20:29:14 2007 +0800
@@ -386,7 +386,7 @@ typedef struct xen_domctl_settimeoffset
typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t;
DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t);
-#define HVM_CTXT_SIZE 6144
+#define HVM_CTXT_SIZE 8192
typedef struct hvm_domain_context {
uint32_t cur;
uint32_t size;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-01-27 13:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-27 13:46 [PATCH][HVM] save/restore fix Zhai, Edwin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.