ia64/xen-unstable

changeset 14855:ef5da9ca0171

[IA64] Fix ptc.g race

If one vcpu is executing ptc.g, while the other vcpu is executing itc,
the VHPT(VTLB) entry which should be purged may unexpectedly survive.
Then issue happens.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
author Alex Williamson <alex.williamson@hp.com>
date Tue Apr 24 09:07:24 2007 -0600 (2007-04-24)
parents 039daabebad5
children 9313d0ce09f8
files xen/arch/ia64/vmx/vtlb.c
line diff
     1.1 --- a/xen/arch/ia64/vmx/vtlb.c	Fri Apr 13 16:07:48 2007 +0100
     1.2 +++ b/xen/arch/ia64/vmx/vtlb.c	Tue Apr 24 09:07:24 2007 -0600
     1.3 @@ -168,6 +168,7 @@ static void vmx_vhpt_insert(thash_cb_t *
     1.4      else{
     1.5          cch = __alloc_chain(hcb);
     1.6      }
     1.7 +    local_irq_disable();
     1.8      *cch = *head;
     1.9      head->page_flags=pte;
    1.10      head->itir = rr.ps << 2;
    1.11 @@ -175,6 +176,7 @@ static void vmx_vhpt_insert(thash_cb_t *
    1.12      head->next = cch;
    1.13      head->len = cch->len+1;
    1.14      cch->len = 0;
    1.15 +    local_irq_enable();
    1.16      return;
    1.17  }
    1.18  
    1.19 @@ -424,14 +426,14 @@ void vtlb_insert(VCPU *v, u64 pte, u64 i
    1.20      else {
    1.21          cch = __alloc_chain(hcb);
    1.22      }
    1.23 -    *cch = *hash_table;
    1.24 -    hash_table->page_flags = pte;
    1.25 -    hash_table->itir=itir;
    1.26 -    hash_table->etag=tag;
    1.27 +    cch->page_flags = pte;
    1.28 +    cch->itir = itir;
    1.29 +    cch->etag = tag;
    1.30 +    cch->next = hash_table->next;
    1.31 +    wmb();
    1.32      hash_table->next = cch;
    1.33 -    hash_table->len = cch->len + 1;
    1.34 -    cch->len = 0;
    1.35 -    return ;
    1.36 +    hash_table->len += 1;
    1.37 +    return;
    1.38  }
    1.39  
    1.40