[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 18/20] x86/shadow: Alter sh_{remove_all_mappings, rm_mappings_from_l1}() to take a domain
This allows the removal an improper use of d->vcpu[0] from toolstack context Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Tim Deegan <tim@xxxxxxx> --- xen/arch/x86/mm/shadow/common.c | 13 ++++++------- xen/arch/x86/mm/shadow/multi.c | 3 +-- xen/arch/x86/mm/shadow/multi.h | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index 30580ee..d24859e 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -2436,13 +2436,12 @@ int sh_remove_write_access_from_sl1p(struct domain *d, mfn_t gmfn, /* Remove all mappings of a guest frame from the shadow tables. * Returns non-zero if we need to flush TLBs. */ -static int sh_remove_all_mappings(struct vcpu *v, mfn_t gmfn) +static int sh_remove_all_mappings(struct domain *d, mfn_t gmfn) { - struct domain *d = v->domain; struct page_info *page = mfn_to_page(gmfn); /* Dispatch table for getting per-type functions */ - static const hash_vcpu_callback_t callbacks[SH_type_unused] = { + static const hash_domain_callback_t callbacks[SH_type_unused] = { NULL, /* none */ SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2), /* l1_32 */ SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, 2), /* fl1_32 */ @@ -2484,7 +2483,7 @@ static int sh_remove_all_mappings(struct vcpu *v, mfn_t gmfn) /* Brute-force search of all the shadows, by walking the hash */ perfc_incr(shadow_mappings_bf); - hash_vcpu_foreach(v, callback_mask, callbacks, gmfn); + hash_domain_foreach(d, callback_mask, callbacks, gmfn); /* If that didn't catch the mapping, something is very wrong */ if ( !sh_check_page_has_no_refs(page) ) @@ -3383,7 +3382,7 @@ static void sh_unshadow_for_p2m_change(struct domain *d, unsigned long gfn, if ( (p2m_is_valid(p2mt) || p2m_is_grant(p2mt)) && mfn_valid(mfn) ) { sh_remove_all_shadows_and_parents(d, mfn); - if ( sh_remove_all_mappings(v, mfn) ) + if ( sh_remove_all_mappings(d, mfn) ) flush_tlb_mask(d->domain_dirty_cpumask); } } @@ -3418,7 +3417,7 @@ static void sh_unshadow_for_p2m_change(struct domain *d, unsigned long gfn, { /* This GFN->MFN mapping has gone away */ sh_remove_all_shadows_and_parents(d, omfn); - if ( sh_remove_all_mappings(v, omfn) ) + if ( sh_remove_all_mappings(d, omfn) ) cpumask_or(&flushmask, &flushmask, d->domain_dirty_cpumask); } @@ -3634,7 +3633,7 @@ int shadow_track_dirty_vram(struct domain *d, dirty = 1; /* TODO: Heuristics for finding the single mapping of * this gmfn */ - flush_tlb |= sh_remove_all_mappings(d->vcpu[0], mfn); + flush_tlb |= sh_remove_all_mappings(d, mfn); } else { diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c index 7705674..288c7d5 100644 --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -4315,10 +4315,9 @@ int sh_rm_write_access_from_l1(struct domain *d, mfn_t sl1mfn, } -int sh_rm_mappings_from_l1(struct vcpu *v, mfn_t sl1mfn, mfn_t target_mfn) +int sh_rm_mappings_from_l1(struct domain *d, mfn_t sl1mfn, mfn_t target_mfn) /* Excises all mappings to guest frame from this shadow l1 table */ { - struct domain *d = v->domain; shadow_l1e_t *sl1e; int done = 0; int flags; diff --git a/xen/arch/x86/mm/shadow/multi.h b/xen/arch/x86/mm/shadow/multi.h index 1af9225..935e12d 100644 --- a/xen/arch/x86/mm/shadow/multi.h +++ b/xen/arch/x86/mm/shadow/multi.h @@ -65,7 +65,7 @@ SHADOW_INTERNAL_NAME(sh_rm_write_access_from_l1, GUEST_LEVELS) (struct domain *d, mfn_t sl1mfn, mfn_t readonly_mfn); extern int SHADOW_INTERNAL_NAME(sh_rm_mappings_from_l1, GUEST_LEVELS) - (struct vcpu *v, mfn_t sl1mfn, mfn_t target_mfn); + (struct domain *d, mfn_t sl1mfn, mfn_t target_mfn); extern void SHADOW_INTERNAL_NAME(sh_clear_shadow_entry, GUEST_LEVELS) -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |