ia64/xen-unstable

changeset 8816:1c69197d29b7

Delete old 'shortcut' function __shadow_status() and
rename the core function ___shadow_status() to take its
place.

The 'fast path quick test' was ridiculously bloated and
didn't work for PGT_fl1_shadow pages.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Feb 09 18:35:15 2006 +0100 (2006-02-09)
parents ee9691e23dbe
children 754079886035
files xen/arch/x86/shadow.c xen/include/asm-x86/shadow.h xen/include/xen/perfc_defn.h
line diff
     1.1 --- a/xen/arch/x86/shadow.c	Thu Feb 09 17:42:51 2006 +0100
     1.2 +++ b/xen/arch/x86/shadow.c	Thu Feb 09 18:35:15 2006 +0100
     1.3 @@ -3256,7 +3256,7 @@ static inline int l2e_rw_fault(
     1.4      if ( !__shadow_get_l2e(v, va, &sl2e) )
     1.5          sl2e = l2e_empty();
     1.6  
     1.7 -    l1_mfn = ___shadow_status(d, start_gpfn | nx, PGT_fl1_shadow);
     1.8 +    l1_mfn = __shadow_status(d, start_gpfn | nx, PGT_fl1_shadow);
     1.9  
    1.10      /* Check the corresponding l2e */
    1.11      if (l1_mfn) {
     2.1 --- a/xen/include/asm-x86/shadow.h	Thu Feb 09 17:42:51 2006 +0100
     2.2 +++ b/xen/include/asm-x86/shadow.h	Thu Feb 09 18:35:15 2006 +0100
     2.3 @@ -1179,19 +1179,21 @@ static inline struct shadow_status *hash
     2.4   *      its mfn).
     2.5   *      It returns the shadow's mfn, or zero if it doesn't exist.
     2.6   */
     2.7 -
     2.8 -static inline unsigned long ___shadow_status(
     2.9 +static inline unsigned long __shadow_status(
    2.10      struct domain *d, unsigned long gpfn, unsigned long stype)
    2.11  {
    2.12      struct shadow_status *p, *x, *head;
    2.13      unsigned long key = gpfn | stype;
    2.14  
    2.15 +    ASSERT(shadow_lock_is_acquired(d));
    2.16 +    ASSERT(gpfn == (gpfn & PGT_mfn_mask));
    2.17 +    ASSERT(stype && !(stype & ~PGT_type_mask));
    2.18 +
    2.19      perfc_incrc(shadow_status_calls);
    2.20  
    2.21      x = head = hash_bucket(d, gpfn);
    2.22      p = NULL;
    2.23  
    2.24 -    //SH_VVLOG("lookup gpfn=%08x type=%08x bucket=%p", gpfn, stype, x);
    2.25      shadow_audit(d, 0);
    2.26  
    2.27      do
    2.28 @@ -1221,7 +1223,6 @@ static inline unsigned long ___shadow_st
    2.29                  perfc_incrc(shadow_status_hit_head);
    2.30              }
    2.31  
    2.32 -            //SH_VVLOG("lookup gpfn=%p => status=%p", key, head->smfn);
    2.33              return head->smfn;
    2.34          }
    2.35  
    2.36 @@ -1230,53 +1231,10 @@ static inline unsigned long ___shadow_st
    2.37      }
    2.38      while ( x != NULL );
    2.39  
    2.40 -    //SH_VVLOG("lookup gpfn=%p => status=0", key);
    2.41      perfc_incrc(shadow_status_miss);
    2.42      return 0;
    2.43  }
    2.44  
    2.45 -static inline unsigned long __shadow_status(
    2.46 -    struct domain *d, unsigned long gpfn, unsigned long stype)
    2.47 -{
    2.48 -    unsigned long mfn = ((current->domain == d)
    2.49 -                          ? gmfn_to_mfn(d, gpfn)
    2.50 -                          : INVALID_MFN);
    2.51 -
    2.52 -    ASSERT(shadow_lock_is_acquired(d));
    2.53 -    ASSERT(gpfn == (gpfn & PGT_mfn_mask));
    2.54 -    ASSERT(stype && !(stype & ~PGT_type_mask));
    2.55 -
    2.56 -    if ( VALID_MFN(mfn) && mfn_valid(mfn) &&
    2.57 -         (stype != PGT_writable_pred) &&
    2.58 -         ((stype == PGT_snapshot)
    2.59 -          ? !mfn_out_of_sync(mfn)
    2.60 -          : !mfn_is_page_table(mfn)) )
    2.61 -    {
    2.62 -        perfc_incrc(shadow_status_shortcut);
    2.63 -#ifndef NDEBUG
    2.64 -        if ( ___shadow_status(d, gpfn, stype) != 0 )
    2.65 -        {
    2.66 -            printk("d->id=%d gpfn=%lx mfn=%lx stype=%lx c=%x t=%" PRtype_info " "
    2.67 -                   "mfn_out_of_sync(mfn)=%d mfn_is_page_table(mfn)=%d\n",
    2.68 -                   d->domain_id, gpfn, mfn, stype,
    2.69 -                   mfn_to_page(mfn)->count_info,
    2.70 -                   mfn_to_page(mfn)->u.inuse.type_info,
    2.71 -                   mfn_out_of_sync(mfn), mfn_is_page_table(mfn));
    2.72 -            BUG();
    2.73 -        }
    2.74 -
    2.75 -        // Undo the affects of the above call to ___shadow_status()'s perf
    2.76 -        // counters, since that call is really just part of an assertion.
    2.77 -        //
    2.78 -        perfc_decrc(shadow_status_calls);
    2.79 -        perfc_decrc(shadow_status_miss);
    2.80 -#endif
    2.81 -        return 0;
    2.82 -    }
    2.83 -
    2.84 -    return ___shadow_status(d, gpfn, stype);
    2.85 -}
    2.86 -
    2.87  /*
    2.88   * Not clear if pull-to-front is worth while for this or not,
    2.89   * as it generally needs to scan the entire bucket anyway.
     3.1 --- a/xen/include/xen/perfc_defn.h	Thu Feb 09 17:42:51 2006 +0100
     3.2 +++ b/xen/include/xen/perfc_defn.h	Thu Feb 09 18:35:15 2006 +0100
     3.3 @@ -86,7 +86,7 @@ PERFCOUNTER_CPU(shadow_invlpg_faults,   
     3.4  PERFCOUNTER_CPU(unshadow_l2_count,      "unpinned L2 count")
     3.5  
     3.6  PERFCOUNTER_CPU(shadow_status_shortcut, "fastpath miss on shadow cache")
     3.7 -PERFCOUNTER_CPU(shadow_status_calls,    "calls to ___shadow_status")
     3.8 +PERFCOUNTER_CPU(shadow_status_calls,    "calls to shadow_status")
     3.9  PERFCOUNTER_CPU(shadow_status_miss,     "missed shadow cache")
    3.10  PERFCOUNTER_CPU(shadow_status_hit_head, "hits on head of bucket")
    3.11  PERFCOUNTER_CPU(shadow_max_type,        "calls to shadow_max_type")