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-devel

[Xen-devel][Patch] patch for EOI acceleration

To: "Xen-devel@xxxxxxxxxxxxxxxxxxx" <Xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel][Patch] patch for EOI acceleration
From: "Zhang, Yang" <yang.zhang@xxxxxxxxx>
Date: Wed, 5 Aug 2009 10:32:09 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: "Yang, Xiaowei" <xiaowei.yang@xxxxxxxxx>, "Dong, Eddie" <eddie.dong@xxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Tue, 04 Aug 2009 19:33:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcoVdO4xJtUZ6tStRVaoM9Tc71hGuw==
Thread-topic: [Xen-devel][Patch] patch for EOI acceleration

We find mostly apci access is eoi write. 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.

Here is the data

 

CPU%

cycles per APIC access VMEXIT

Times per second

CPU% for APIC Access VMEXIT handle

default

94.46%

7805

75424

5.52%

w/ VEOI

91.14%

3179

76474

2.28%

Default – w/ VEOI

3.33%

 

 

3.24%

 

 

diff -r 8af26fef898c xen/arch/x86/hvm/vmx/vmx.c

--- a/xen/arch/x86/hvm/vmx/vmx.c         Fri Jul 24 12:08:54 2009 +0100

+++ b/xen/arch/x86/hvm/vmx/vmx.c      Tue Jul 28 15:07:07 2009 +0800

@@ -2270,6 +2270,25 @@

     }

 }

 

+static int vmx_handle_eoi_write(void)

+{

+    struct vcpu *curr = current;

+    unsigned long exit_qualification;

+    unsigned long offset;

+    struct vlapic *vlapic = vcpu_vlapic(curr);

+

+    exit_qualification = __vmread(EXIT_QUALIFICATION);

+    offset = exit_qualification & 0xfff;

+

+    if ( ((exit_qualification >> 12) & 0xf) == 1 && offset == APIC_EOI )

+    {  

+        /* EOI write */

+        vlapic_EOI_set(vlapic);

+        return 1;

+    }

+    return 0;

+}

+

 asmlinkage void vmx_vmexit_handler(struct cpu_user_regs *regs)

 {

     unsigned int exit_reason, idtv_info;

@@ -2571,9 +2590,15 @@

 

     case EXIT_REASON_TPR_BELOW_THRESHOLD:

         break;

-

+    case EXIT_REASON_APIC_ACCESS:

+        if ( vmx_handle_eoi_write() )

+        {

+            /* For EOI wirte, skip emulate it */

+            inst_len = __get_instruction_length();

+            __update_guest_eip(inst_len);

+            break;

+        }

     case EXIT_REASON_IO_INSTRUCTION:

-    case EXIT_REASON_APIC_ACCESS:

         if ( !handle_mmio() )

             vmx_inject_hw_exception(TRAP_gp_fault, 0);

         break;

Attachment: accelerate_eoi_write.patch
Description: accelerate_eoi_write.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel][Patch] patch for EOI acceleration, Zhang, Yang <=