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] ASID: Optimize hvm_flush_guest_tlbs

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] ASID: Optimize hvm_flush_guest_tlbs
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 Jan 2011 07:59:00 -0800
Delivery-date: Mon, 17 Jan 2011 08:08:18 -0800
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@xxxxxxx>
# Date 1294409595 0
# Node ID 82c205df44062aaa6f3ad2d22b5273e18ec3151e
# Parent  0ab058a55c24bd103afa0003c9becad3d9e80d6b
ASID: Optimize hvm_flush_guest_tlbs

In our testing, we found that function hvm_flush_guest_tlbs() is used
very frequently and it will always force asid recycling and will
result a whole tlb flush immediately no matter there are still free
asids or not.  Actually, in this case, just increasing core generation
might be enough and the remaining asids can still be used until
next_asid > max_asid.

Signed-off-by: Wei Wang <wei.wang2@xxxxxxx>
Reviewed-by: Wei Huang <wei.huang2@xxxxxxx>

Simplify the logic and also fix a very minor bug in
hvm_asid_handle_vmenter(), in the case that hvm_asid_flush_core() sets
data->disabled.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/arch/x86/hvm/asid.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff -r 0ab058a55c24 -r 82c205df4406 xen/arch/x86/hvm/asid.c
--- a/xen/arch/x86/hvm/asid.c   Fri Jan 07 13:30:04 2011 +0000
+++ b/xen/arch/x86/hvm/asid.c   Fri Jan 07 14:13:15 2011 +0000
@@ -100,10 +100,7 @@ void hvm_asid_flush_core(void)
         return;
 
     if ( likely(++data->core_asid_generation != 0) )
-    {
-        data->next_asid = 1;
         return;
-    }
 
     /*
      * ASID generations are 64 bit.  Overflow of generations never happens.
@@ -122,10 +119,7 @@ bool_t hvm_asid_handle_vmenter(void)
     /* On erratum #170 systems we must flush the TLB. 
      * Generation overruns are taken here, too. */
     if ( data->disabled )
-    {
-        curr->arch.hvm_vcpu.asid = 0;
-        return 0;
-    }
+        goto disabled;
 
     /* Test if VCPU has valid ASID. */
     if ( curr->arch.hvm_vcpu.asid_generation == data->core_asid_generation )
@@ -133,7 +127,12 @@ bool_t hvm_asid_handle_vmenter(void)
 
     /* If there are no free ASIDs, need to go to a new generation */
     if ( unlikely(data->next_asid > data->max_asid) )
+    {
         hvm_asid_flush_core();
+        data->next_asid = 1;
+        if ( data->disabled )
+            goto disabled;
+    }
 
     /* Now guaranteed to be a free ASID. */
     curr->arch.hvm_vcpu.asid = data->next_asid++;
@@ -144,6 +143,10 @@ bool_t hvm_asid_handle_vmenter(void)
      * generation, and all old ASID allocations are now stale. 
      */
     return (curr->arch.hvm_vcpu.asid == 1);
+
+ disabled:
+    curr->arch.hvm_vcpu.asid = 0;
+    return 0;
 }
 
 /*

_______________________________________________
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] ASID: Optimize hvm_flush_guest_tlbs, Xen patchbot-unstable <=