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

[Xen-changelog] [xen-unstable] [HVM] No need to call hvm_do_resume() on every vm entry.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 6f72d00fc1ece1473df04b8b53b9cb458d704f9b
# Parent  637eace6d5c64c52d6f8b521720aedb89e47c0a7
[HVM] No need to call hvm_do_resume() on every vm entry.
Original patch from Xin Li <xin.b.li@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c              |   11 ++++++++---
 xen/arch/x86/hvm/platform.c         |    3 ++-
 xen/arch/x86/hvm/svm/x86_32/exits.S |    3 ---
 xen/arch/x86/hvm/svm/x86_64/exits.S |    2 --
 xen/arch/x86/hvm/vmx/x86_32/exits.S |    3 ---
 xen/arch/x86/hvm/vmx/x86_64/exits.S |    2 --
 xen/include/xen/event.h             |    7 +++++++
 7 files changed, 17 insertions(+), 14 deletions(-)

diff -r 637eace6d5c6 -r 6f72d00fc1ec xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Mon Oct 23 11:20:37 2006 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Mon Oct 23 11:46:41 2006 +0100
@@ -237,12 +237,17 @@ void hvm_do_resume(struct vcpu *v)
     }
 
     p = &get_vio(v->domain, v->vcpu_id)->vp_ioreq;
-    wait_on_xen_event_channel(v->arch.hvm.xen_port,
+    wait_on_xen_event_channel(v->arch.hvm_vcpu.xen_port,
                               p->state != STATE_IOREQ_READY &&
                               p->state != STATE_IOREQ_INPROCESS);
-    if ( p->state == STATE_IORESP_READY )
+    switch ( p->state )
+    {
+    case STATE_IORESP_READY:
         hvm_io_assist(v);
-    if ( p->state != STATE_INVALID ) {
+        break;
+    case STATE_INVALID:
+        break;
+    default:
         printf("Weird HVM iorequest state %d.\n", p->state);
         domain_crash(v->domain);
     }
diff -r 637eace6d5c6 -r 6f72d00fc1ec xen/arch/x86/hvm/platform.c
--- a/xen/arch/x86/hvm/platform.c       Mon Oct 23 11:20:37 2006 +0100
+++ b/xen/arch/x86/hvm/platform.c       Mon Oct 23 11:46:41 2006 +0100
@@ -727,7 +727,8 @@ static void hvm_send_assist_req(struct v
         domain_crash(v->domain);
         return;
     }
-    wmb();
+
+    prepare_wait_on_xen_event_channel(v->arch.hvm_vcpu.xen_port);
     p->state = STATE_IOREQ_READY;
     notify_via_xen_event_channel(v->arch.hvm_vcpu.xen_port);
 }
diff -r 637eace6d5c6 -r 6f72d00fc1ec xen/arch/x86/hvm/svm/x86_32/exits.S
--- a/xen/arch/x86/hvm/svm/x86_32/exits.S       Mon Oct 23 11:20:37 2006 +0100
+++ b/xen/arch/x86/hvm/svm/x86_32/exits.S       Mon Oct 23 11:46:41 2006 +0100
@@ -139,9 +139,6 @@ ENTRY(svm_asm_do_resume)
 ENTRY(svm_asm_do_resume)
 svm_test_all_events:
         GET_CURRENT(%ebx)
-        pushl %ebx
-        call hvm_do_resume
-        addl $4, %esp
 /*test_all_events:*/
         xorl %ecx,%ecx
         notl %ecx
diff -r 637eace6d5c6 -r 6f72d00fc1ec xen/arch/x86/hvm/svm/x86_64/exits.S
--- a/xen/arch/x86/hvm/svm/x86_64/exits.S       Mon Oct 23 11:20:37 2006 +0100
+++ b/xen/arch/x86/hvm/svm/x86_64/exits.S       Mon Oct 23 11:46:41 2006 +0100
@@ -153,8 +153,6 @@ ENTRY(svm_asm_do_resume)
 ENTRY(svm_asm_do_resume)
 svm_test_all_events:
         GET_CURRENT(%rbx)
-        movq %rbx, %rdi
-        call hvm_do_resume
 /*test_all_events:*/
         cli                             # tests must not race interrupts
 /*test_softirqs:*/
diff -r 637eace6d5c6 -r 6f72d00fc1ec xen/arch/x86/hvm/vmx/x86_32/exits.S
--- a/xen/arch/x86/hvm/vmx/x86_32/exits.S       Mon Oct 23 11:20:37 2006 +0100
+++ b/xen/arch/x86/hvm/vmx/x86_32/exits.S       Mon Oct 23 11:46:41 2006 +0100
@@ -97,9 +97,6 @@ vmx_process_softirqs:
         ALIGN
 ENTRY(vmx_asm_do_vmentry)
         GET_CURRENT(%ebx)
-        pushl %ebx
-        call hvm_do_resume
-        addl $4, %esp
         cli                             # tests must not race interrupts
 
         movl VCPU_processor(%ebx),%eax
diff -r 637eace6d5c6 -r 6f72d00fc1ec xen/arch/x86/hvm/vmx/x86_64/exits.S
--- a/xen/arch/x86/hvm/vmx/x86_64/exits.S       Mon Oct 23 11:20:37 2006 +0100
+++ b/xen/arch/x86/hvm/vmx/x86_64/exits.S       Mon Oct 23 11:46:41 2006 +0100
@@ -106,8 +106,6 @@ vmx_process_softirqs:
         ALIGN
 ENTRY(vmx_asm_do_vmentry)
         GET_CURRENT(%rbx)
-        movq %rbx, %rdi
-        call hvm_do_resume
         cli                             # tests must not race interrupts
 
         movl  VCPU_processor(%rbx),%eax
diff -r 637eace6d5c6 -r 6f72d00fc1ec xen/include/xen/event.h
--- a/xen/include/xen/event.h   Mon Oct 23 11:20:37 2006 +0100
+++ b/xen/include/xen/event.h   Mon Oct 23 11:46:41 2006 +0100
@@ -70,4 +70,11 @@ void notify_via_xen_event_channel(int lp
         do_softirq();                                                   \
     } while ( 0 )
 
+#define prepare_wait_on_xen_event_channel(port)                         \
+    do {                                                                \
+        set_bit(_VCPUF_blocked_in_xen, &current->vcpu_flags);           \
+        raise_softirq(SCHEDULE_SOFTIRQ);                                \
+        mb(); /* set blocked status /then/ caller does his work */      \
+    } while ( 0 )
+
 #endif /* __XEN_EVENT_H__ */

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


 


Rackspace

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