[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-ia64-devel] [PATCH 3/7] vti save-restore: reap ioreq after resume



# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1192528085 -32400
# Node ID 75280d0f64d5946bf0351a9f2cbc178b26696df1
# Parent  c45062957ef2e79bd7e4339fd25c9a1b2f02eea3
reap ioreq after resume. otherwise ioreq is left as STATE_IORESP_READY
so that the domain will be paniced.
PATCHNAME: reap_ioreq_after_restore

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r c45062957ef2 -r 75280d0f64d5 xen/arch/ia64/vmx/vmx_init.c
--- a/xen/arch/ia64/vmx/vmx_init.c      Mon Oct 22 11:47:39 2007 +0900
+++ b/xen/arch/ia64/vmx/vmx_init.c      Tue Oct 16 18:48:05 2007 +0900
@@ -430,7 +430,32 @@ int vmx_setup_platform(struct domain *d)
        return 0;
 }
 
-void vmx_do_launch(struct vcpu *v)
-{
+void vmx_do_resume(struct vcpu *v)
+{
+       ioreq_t *p;
+
        vmx_load_all_rr(v);
-}
+       migrate_timer(&v->arch.arch_vmx.vtm.vtm_timer, v->processor);
+
+       /* stolen from hvm_do_resume() in arch/x86/hvm/hvm.c */
+       /* NB. Optimised for common case (p->state == STATE_IOREQ_NONE). */
+       p = &get_vio(v->domain, v->vcpu_id)->vp_ioreq;
+       while (p->state != STATE_IOREQ_NONE) {
+               switch (p->state) {
+               case STATE_IORESP_READY: /* IORESP_READY -> NONE */
+                       vmx_io_assist(v);
+                       break;
+               case STATE_IOREQ_READY:
+               case STATE_IOREQ_INPROCESS:
+                       /* IOREQ_{READY,INPROCESS} -> IORESP_READY */
+                       wait_on_xen_event_channel(v->arch.arch_vmx.xen_port,
+                                         (p->state != STATE_IOREQ_READY) &&
+                                         (p->state != STATE_IOREQ_INPROCESS));
+                       break;
+               default:
+                       gdprintk(XENLOG_ERR,
+                                "Weird HVM iorequest state %d.\n", p->state);
+                       domain_crash_synchronous();
+               }
+       }
+}
diff -r c45062957ef2 -r 75280d0f64d5 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Mon Oct 22 11:47:39 2007 +0900
+++ b/xen/arch/ia64/xen/domain.c        Tue Oct 16 18:48:05 2007 +0900
@@ -203,11 +203,9 @@ void schedule_tail(struct vcpu *prev)
        context_saved(prev);
        ia64_disable_vhpt_walker();
 
-       if (VMX_DOMAIN(current)) {
-               vmx_do_launch(current);
-               migrate_timer(&current->arch.arch_vmx.vtm.vtm_timer,
-                             current->processor);
-       } else {
+       if (VMX_DOMAIN(current))
+               vmx_do_resume(current);
+       else {
                if (VMX_DOMAIN(prev))
                        ia64_set_iva(&ia64_ivt);
                load_region_regs(current);
diff -r c45062957ef2 -r 75280d0f64d5 xen/include/asm-ia64/vmx.h
--- a/xen/include/asm-ia64/vmx.h        Mon Oct 22 11:47:39 2007 +0900
+++ b/xen/include/asm-ia64/vmx.h        Tue Oct 16 18:48:05 2007 +0900
@@ -34,7 +34,7 @@ extern void vmx_save_state(struct vcpu *
 extern void vmx_save_state(struct vcpu *v);
 extern void vmx_load_state(struct vcpu *v);
 extern int vmx_setup_platform(struct domain *d);
-extern void vmx_do_launch(struct vcpu *v);
+extern void vmx_do_resume(struct vcpu *v);
 extern void vmx_io_assist(struct vcpu *v);
 extern int ia64_hypercall (struct pt_regs *regs);
 extern void vmx_save_state(struct vcpu *v);

Attachment: 16180_75280d0f64d5_reap_ioreq_after_restore.patch
Description: Text Data

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.