ia64/xen-unstable

changeset 15010:8924215a5f95

[IA64] Always insert entry to VHPT's head, or double TLB miss occurs.

Always insert entry to VHPT head, or TLB miss will occur again although
the translation exists in its collision chain.

Signed-off-by: Zhang xiantao <xiantao.zhang@intel.com>
Signed-off-by: Anthony Xu <anthony.xu@intel.com>
author Alex Williamson <alex.williamson@hp.com>
date Thu May 03 14:01:19 2007 -0600 (2007-05-03)
parents 6cf6f49f26ab
children 948c87ffc582
files xen/arch/ia64/vmx/vtlb.c
line diff
     1.1 --- a/xen/arch/ia64/vmx/vtlb.c	Thu May 03 13:55:28 2007 -0600
     1.2 +++ b/xen/arch/ia64/vmx/vtlb.c	Thu May 03 14:01:19 2007 -0600
     1.3 @@ -150,33 +150,41 @@ static void vmx_vhpt_insert(thash_cb_t *
     1.4      tag = ia64_ttag(ifa);
     1.5      cch = head;
     1.6      while (cch) {    
     1.7 -        if (INVALID_VHPT(cch)) {
     1.8 -            len = cch->len;
     1.9 -            cch->page_flags = pte;
    1.10 -            cch->len = len;
    1.11 -            cch->itir = rr.ps << 2;
    1.12 -            cch->etag = tag;
    1.13 -            return;
    1.14 +        if (INVALID_VHPT(cch))
    1.15 +            break;
    1.16 +        cch = cch->next;
    1.17 +    }
    1.18 +    if (cch) {
    1.19 +        if (cch == head) {
    1.20 +            len = head->len;
    1.21 +        } else {
    1.22 +            local_irq_disable();
    1.23 +            cch->page_flags = head->page_flags;
    1.24 +            cch->itir = head->itir;
    1.25 +            cch->etag  = head->etag;
    1.26 +            len = head->len;
    1.27 +            local_irq_enable();
    1.28          }
    1.29 -        cch = cch->next;
    1.30 +    }
    1.31 +    else{
    1.32 +        if (head->len >= MAX_CCN_DEPTH) {
    1.33 +            thash_recycle_cch(hcb, head);
    1.34 +            cch = cch_alloc(hcb);
    1.35 +        } else {
    1.36 +            cch = __alloc_chain(hcb);
    1.37 +        }
    1.38 +        local_irq_disable();
    1.39 +        *cch = *head;
    1.40 +        head->next = cch;
    1.41 +        len = cch->len+1;
    1.42 +        cch->len = 0;
    1.43 +        local_irq_enable();
    1.44      }
    1.45  
    1.46 -    if(head->len>=MAX_CCN_DEPTH){
    1.47 -        thash_recycle_cch(hcb, head);
    1.48 -        cch = cch_alloc(hcb);
    1.49 -    }
    1.50 -    else{
    1.51 -        cch = __alloc_chain(hcb);
    1.52 -    }
    1.53 -    local_irq_disable();
    1.54 -    *cch = *head;
    1.55      head->page_flags=pte;
    1.56 +    head->len = len;
    1.57      head->itir = rr.ps << 2;
    1.58      head->etag=tag;
    1.59 -    head->next = cch;
    1.60 -    head->len = cch->len+1;
    1.61 -    cch->len = 0;
    1.62 -    local_irq_enable();
    1.63      return;
    1.64  }
    1.65