[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] ASID: Optimize hvm_flush_guest_tlbs
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |