WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86 vmx: Accelerate VLAPIC EOI writes

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86 vmx: Accelerate VLAPIC EOI writes
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 06 Aug 2009 05:35:20 -0700
Delivery-date: Thu, 06 Aug 2009 05:36:35 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1249477366 -3600
# Node ID 194c2be92084631e660e8bcd34cc7cda5d7de87b
# Parent  cd46b418d1719fa8654b5355ffe1f675de99549f
x86 vmx: Accelerate VLAPIC EOI writes

Our testing indicates that most apic accesses are eoi writes. This
patch accelerate guest EOI emulation utilizing HW VM Exit
information.

Without this patch, xentrace shows the apci access average tsc costs
is ~7.8k in our case and it down to ~3k with it. We also save 3% cpu
in our case.

From: Yang Zhang <yang.zhang@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/vmx/vmx.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletion(-)

diff -r cd46b418d171 -r 194c2be92084 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Wed Aug 05 13:50:36 2009 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Wed Aug 05 14:02:46 2009 +0100
@@ -2270,6 +2270,26 @@ static void vmx_vmexit_ud_intercept(stru
     }
 }
 
+static int vmx_handle_eoi_write(void)
+{
+    unsigned long exit_qualification = __vmread(EXIT_QUALIFICATION);
+
+    /*
+     * 1. Must be a linear access data write.
+     * 2. Data write must be to the EOI register.
+     */
+    if ( (((exit_qualification >> 12) & 0xf) == 1) &&
+         ((exit_qualification & 0xfff) == APIC_EOI) )
+    {
+        int inst_len = __get_instruction_length(); /* Safe: APIC data write */
+        __update_guest_eip(inst_len);
+        vlapic_EOI_set(vcpu_vlapic(current));
+        return 1;
+    }
+
+    return 0;
+}
+
 asmlinkage void vmx_vmexit_handler(struct cpu_user_regs *regs)
 {
     unsigned int exit_reason, idtv_info;
@@ -2572,8 +2592,12 @@ asmlinkage void vmx_vmexit_handler(struc
     case EXIT_REASON_TPR_BELOW_THRESHOLD:
         break;
 
+    case EXIT_REASON_APIC_ACCESS:
+        if ( !vmx_handle_eoi_write() && !handle_mmio() )
+            vmx_inject_hw_exception(TRAP_gp_fault, 0);
+        break;
+
     case EXIT_REASON_IO_INSTRUCTION:
-    case EXIT_REASON_APIC_ACCESS:
         if ( !handle_mmio() )
             vmx_inject_hw_exception(TRAP_gp_fault, 0);
         break;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86 vmx: Accelerate VLAPIC EOI writes, Xen patchbot-unstable <=