|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 9/9] x86/shadow: adjust TLB flushing in sh_unshadow_for_p2m_change()
Accumulating transient state of d->dirty_cpumask in a local variable is
unnecessary here: The flush is fine to make with the dirty set at the
time of the call. With this, move the invocation to a central place at
the end of the function.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v2: New.
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -3084,6 +3084,7 @@ static void sh_unshadow_for_p2m_change(s
mfn_t omfn = l1e_get_mfn(old);
unsigned int oflags = l1e_get_flags(old);
p2m_type_t p2mt = p2m_flags_to_type(oflags);
+ bool flush = false;
/*
* If there are any shadows, update them. But if shadow_teardown()
@@ -3108,7 +3109,7 @@ static void sh_unshadow_for_p2m_change(s
{
sh_remove_all_shadows_and_parents(d, omfn);
if ( sh_remove_all_mappings(d, omfn, _gfn(gfn)) )
- guest_flush_tlb_mask(d, d->dirty_cpumask);
+ flush = true;
}
break;
@@ -3124,12 +3125,9 @@ static void sh_unshadow_for_p2m_change(s
if ( p2m_is_valid(p2mt) && mfn_valid(omfn) )
{
unsigned int i;
- cpumask_t flushmask;
mfn_t nmfn = l1e_get_mfn(new);
l1_pgentry_t *npte = NULL;
- cpumask_clear(&flushmask);
-
/* If we're replacing a superpage with a normal L1 page, map it */
if ( (l1e_get_flags(new) & _PAGE_PRESENT) &&
!(l1e_get_flags(new) & _PAGE_PSE) &&
@@ -3147,11 +3145,10 @@ static void sh_unshadow_for_p2m_change(s
/* This GFN->MFN mapping has gone away */
sh_remove_all_shadows_and_parents(d, omfn);
if ( sh_remove_all_mappings(d, omfn, _gfn(gfn + i)) )
- cpumask_or(&flushmask, &flushmask, d->dirty_cpumask);
+ flush = true;
}
omfn = mfn_add(omfn, 1);
}
- guest_flush_tlb_mask(d, &flushmask);
if ( npte )
unmap_domain_page(npte);
@@ -3159,6 +3156,9 @@ static void sh_unshadow_for_p2m_change(s
break;
}
+
+ if ( flush )
+ guest_flush_tlb_mask(d, d->dirty_cpumask);
}
#if (SHADOW_OPTIMIZATIONS & SHOPT_FAST_FAULT_PATH)
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |