diff -r cb756381087c xen/arch/x86/hvm/asid.c --- a/xen/arch/x86/hvm/asid.c Thu Jan 06 19:02:36 2011 +0000 +++ b/xen/arch/x86/hvm/asid.c Fri Jan 07 10:59:14 2011 +0100 @@ -68,7 +68,7 @@ void hvm_asid_init(int nasids) * exist that reference earlier generations on this CPU. */ if ( test_and_set_bool(data->initialised) ) - return hvm_asid_flush_core(); + return hvm_asid_flush_core(1); data->max_asid = nasids - 1; data->disabled = (nasids <= 1); @@ -92,7 +92,7 @@ void hvm_asid_flush_vcpu(struct vcpu *v) v->arch.hvm_vcpu.asid_generation = 0; } -void hvm_asid_flush_core(void) +void hvm_asid_flush_core(bool_t force_recycle) { struct hvm_asid_data *data = &this_cpu(hvm_asid_data); @@ -101,7 +101,8 @@ void hvm_asid_flush_core(void) if ( likely(++data->core_asid_generation != 0) ) { - data->next_asid = 1; + if ( force_recycle ) + data->next_asid = 1; return; } @@ -133,7 +134,7 @@ 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(); + hvm_asid_flush_core(1); /* Now guaranteed to be a free ASID. */ curr->arch.hvm_vcpu.asid = data->next_asid++; diff -r cb756381087c xen/include/asm-x86/hvm/asid.h --- a/xen/include/asm-x86/hvm/asid.h Thu Jan 06 19:02:36 2011 +0000 +++ b/xen/include/asm-x86/hvm/asid.h Fri Jan 07 10:59:14 2011 +0100 @@ -30,8 +30,8 @@ void hvm_asid_init(int nasids); /* Invalidate a VCPU's current ASID allocation: forces re-allocation. */ void hvm_asid_flush_vcpu(struct vcpu *v); -/* Flush all ASIDs on this processor core. */ -void hvm_asid_flush_core(void); +/* Increase core generation, force ASID recycling when necessary. */ +void hvm_asid_flush_core(bool_t force_recycle); /* Called before entry to guest context. Checks ASID allocation, returns a * boolean indicating whether all ASIDs must be flushed. */ diff -r cb756381087c xen/include/asm-x86/hvm/hvm.h --- a/xen/include/asm-x86/hvm/hvm.h Thu Jan 06 19:02:36 2011 +0000 +++ b/xen/include/asm-x86/hvm/hvm.h Fri Jan 07 10:59:14 2011 +0100 @@ -227,7 +227,7 @@ static inline void hvm_flush_guest_tlbs( static inline void hvm_flush_guest_tlbs(void) { if ( hvm_enabled ) - hvm_asid_flush_core(); + hvm_asid_flush_core(0); } void hvm_hypercall_page_initialise(struct domain *d,