mirror of
https://github.com/xen-project/xen.git
synced 2026-10-30 03:00:05 +01:00
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>
This commit is contained in:
1 parent
1b0340715d
commit
4e2631d75c
3 files changed
+7
-49
No files matched your search
@@ -3256,7 +3256,7 @@ static inline int l2e_rw_fault(
|
||||
if ( !__shadow_get_l2e(v, va, &sl2e) )
|
||||
sl2e = l2e_empty();
|
||||
|
||||
l1_mfn = ___shadow_status(d, start_gpfn | nx, PGT_fl1_shadow);
|
||||
l1_mfn = __shadow_status(d, start_gpfn | nx, PGT_fl1_shadow);
|
||||
|
||||
/* Check the corresponding l2e */
|
||||
if (l1_mfn) {
|
||||
|
||||
@@ -1179,19 +1179,21 @@ static inline struct shadow_status *hash_bucket(
|
||||
* its mfn).
|
||||
* It returns the shadow's mfn, or zero if it doesn't exist.
|
||||
*/
|
||||
|
||||
static inline unsigned long ___shadow_status(
|
||||
static inline unsigned long __shadow_status(
|
||||
struct domain *d, unsigned long gpfn, unsigned long stype)
|
||||
{
|
||||
struct shadow_status *p, *x, *head;
|
||||
unsigned long key = gpfn | stype;
|
||||
|
||||
ASSERT(shadow_lock_is_acquired(d));
|
||||
ASSERT(gpfn == (gpfn & PGT_mfn_mask));
|
||||
ASSERT(stype && !(stype & ~PGT_type_mask));
|
||||
|
||||
perfc_incrc(shadow_status_calls);
|
||||
|
||||
x = head = hash_bucket(d, gpfn);
|
||||
p = NULL;
|
||||
|
||||
//SH_VVLOG("lookup gpfn=%08x type=%08x bucket=%p", gpfn, stype, x);
|
||||
shadow_audit(d, 0);
|
||||
|
||||
do
|
||||
@@ -1221,7 +1223,6 @@ static inline unsigned long ___shadow_status(
|
||||
perfc_incrc(shadow_status_hit_head);
|
||||
}
|
||||
|
||||
//SH_VVLOG("lookup gpfn=%p => status=%p", key, head->smfn);
|
||||
return head->smfn;
|
||||
}
|
||||
|
||||
@@ -1230,53 +1231,10 @@ static inline unsigned long ___shadow_status(
|
||||
}
|
||||
while ( x != NULL );
|
||||
|
||||
//SH_VVLOG("lookup gpfn=%p => status=0", key);
|
||||
perfc_incrc(shadow_status_miss);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned long __shadow_status(
|
||||
struct domain *d, unsigned long gpfn, unsigned long stype)
|
||||
{
|
||||
unsigned long mfn = ((current->domain == d)
|
||||
? gmfn_to_mfn(d, gpfn)
|
||||
: INVALID_MFN);
|
||||
|
||||
ASSERT(shadow_lock_is_acquired(d));
|
||||
ASSERT(gpfn == (gpfn & PGT_mfn_mask));
|
||||
ASSERT(stype && !(stype & ~PGT_type_mask));
|
||||
|
||||
if ( VALID_MFN(mfn) && mfn_valid(mfn) &&
|
||||
(stype != PGT_writable_pred) &&
|
||||
((stype == PGT_snapshot)
|
||||
? !mfn_out_of_sync(mfn)
|
||||
: !mfn_is_page_table(mfn)) )
|
||||
{
|
||||
perfc_incrc(shadow_status_shortcut);
|
||||
#ifndef NDEBUG
|
||||
if ( ___shadow_status(d, gpfn, stype) != 0 )
|
||||
{
|
||||
printk("d->id=%d gpfn=%lx mfn=%lx stype=%lx c=%x t=%" PRtype_info " "
|
||||
"mfn_out_of_sync(mfn)=%d mfn_is_page_table(mfn)=%d\n",
|
||||
d->domain_id, gpfn, mfn, stype,
|
||||
mfn_to_page(mfn)->count_info,
|
||||
mfn_to_page(mfn)->u.inuse.type_info,
|
||||
mfn_out_of_sync(mfn), mfn_is_page_table(mfn));
|
||||
BUG();
|
||||
}
|
||||
|
||||
// Undo the affects of the above call to ___shadow_status()'s perf
|
||||
// counters, since that call is really just part of an assertion.
|
||||
//
|
||||
perfc_decrc(shadow_status_calls);
|
||||
perfc_decrc(shadow_status_miss);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ___shadow_status(d, gpfn, stype);
|
||||
}
|
||||
|
||||
/*
|
||||
* Not clear if pull-to-front is worth while for this or not,
|
||||
* as it generally needs to scan the entire bucket anyway.
|
||||
|
||||
@@ -86,7 +86,7 @@ PERFCOUNTER_CPU(shadow_invlpg_faults, "shadow_invlpg's get_user faulted")
|
||||
PERFCOUNTER_CPU(unshadow_l2_count, "unpinned L2 count")
|
||||
|
||||
PERFCOUNTER_CPU(shadow_status_shortcut, "fastpath miss on shadow cache")
|
||||
PERFCOUNTER_CPU(shadow_status_calls, "calls to ___shadow_status")
|
||||
PERFCOUNTER_CPU(shadow_status_calls, "calls to shadow_status")
|
||||
PERFCOUNTER_CPU(shadow_status_miss, "missed shadow cache")
|
||||
PERFCOUNTER_CPU(shadow_status_hit_head, "hits on head of bucket")
|
||||
PERFCOUNTER_CPU(shadow_max_type, "calls to shadow_max_type")
|
||||
|
||||