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

[Xen-changelog] [xen-3.2-testing] vmx realmode: Only check for pending interrupts every 16th



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1203344097 0
# Node ID e5ddff7a8509a4894be53af402fd6005a9f9e6d7
# Parent  61635a694ba3a58cef48b3b12eb14f490eae2c35
vmx realmode: Only check for pending interrupts every 16th
instruction, since it is a moderately expensive operation.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset:   17041:e7085b40dc08d3bff167bcad05b509da22c64e04
xen-unstable date:        Wed Feb 13 18:09:27 2008 +0000
---
 xen/arch/x86/hvm/vmx/realmode.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff -r 61635a694ba3 -r e5ddff7a8509 xen/arch/x86/hvm/vmx/realmode.c
--- a/xen/arch/x86/hvm/vmx/realmode.c   Mon Feb 18 14:14:38 2008 +0000
+++ b/xen/arch/x86/hvm/vmx/realmode.c   Mon Feb 18 14:14:57 2008 +0000
@@ -781,7 +781,7 @@ void vmx_realmode(struct cpu_user_regs *
     struct vcpu *curr = current;
     struct realmode_emulate_ctxt rm_ctxt;
     unsigned long intr_info = __vmread(VM_ENTRY_INTR_INFO);
-    int i;
+    unsigned int i, emulations = 0;
 
     rm_ctxt.ctxt.regs = regs;
 
@@ -804,11 +804,19 @@ void vmx_realmode(struct cpu_user_regs *
 
     while ( curr->arch.hvm_vmx.vmxemul &&
             !softirq_pending(smp_processor_id()) &&
-            !curr->arch.hvm_vmx.real_mode_io_in_progress &&
-            /* Check for pending interrupts only in proper real mode. */
-            ((curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE) ||
-             !hvm_local_events_need_delivery(curr)) )
+            !curr->arch.hvm_vmx.real_mode_io_in_progress )
+    {
+        /*
+         * Check for pending interrupts only every 16 instructions, because
+         * hvm_local_events_need_delivery() is moderately expensive, and only
+         * in real mode, because we don't emulate protected-mode IDT vectoring.
+         */
+        if ( unlikely(!(++emulations & 15)) &&
+             !(curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE) &&
+             hvm_local_events_need_delivery(curr) )
+            break;
         realmode_emulate_one(&rm_ctxt);
+    }
 
     if ( !curr->arch.hvm_vmx.vmxemul )
     {

_______________________________________________
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®.