[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 6 of 7] x86/mm: Clean up mem event structures on domain destruction
xen/arch/x86/mm/mem_event.c | 11 +++++++++++ xen/common/domain.c | 3 +++ xen/include/asm-arm/mm.h | 3 ++- xen/include/asm-ia64/mm.h | 3 ++- xen/include/asm-x86/mm.h | 2 ++ 5 files changed, 20 insertions(+), 2 deletions(-) Otherwise we wind up with zombie domains, still holding onto refs to the mem event ring pages. Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx> diff -r 9c6cbbe72dc4 -r 1a76b2f7641b xen/arch/x86/mm/mem_event.c --- a/xen/arch/x86/mm/mem_event.c +++ b/xen/arch/x86/mm/mem_event.c @@ -487,6 +487,17 @@ int do_mem_event_op(int op, uint32_t dom return ret; } +/* Clean up on domain destruction */ +void mem_event_cleanup(struct domain *d) +{ + if ( d->mem_event->paging.ring_page ) + (void)mem_event_disable(d, &d->mem_event->paging); + if ( d->mem_event->access.ring_page ) + (void)mem_event_disable(d, &d->mem_event->access); + if ( d->mem_event->share.ring_page ) + (void)mem_event_disable(d, &d->mem_event->share); +} + int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec, XEN_GUEST_HANDLE(void) u_domctl) { diff -r 9c6cbbe72dc4 -r 1a76b2f7641b xen/common/domain.c --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -480,6 +480,9 @@ int domain_kill(struct domain *d) break; } d->is_dying = DOMDYING_dead; + /* Mem event cleanup has to go here because the rings + * have to be put before we call put_domain. */ + mem_event_cleanup(d); put_domain(d); send_global_virq(VIRQ_DOM_EXC); /* fallthrough */ diff -r 9c6cbbe72dc4 -r 1a76b2f7641b xen/include/asm-arm/mm.h --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -266,7 +266,8 @@ int get_page(struct page_info *page, st machine_to_phys_mapping[(mfn)] = (pfn); \ }) -#define put_gfn(d, g) ((void)0) +#define put_gfn(d, g) ((void)0) +#define mem_event_cleanup(d) ((void)0) #define INVALID_MFN (~0UL) diff -r 9c6cbbe72dc4 -r 1a76b2f7641b xen/include/asm-ia64/mm.h --- a/xen/include/asm-ia64/mm.h +++ b/xen/include/asm-ia64/mm.h @@ -551,7 +551,8 @@ extern u64 translate_domain_pte(u64 ptev gmfn_to_mfn_foreign((_d), (gpfn)) #define get_gfn_untyped(d, gpfn) gmfn_to_mfn(d, gpfn) -#define put_gfn(d, g) ((void)0) +#define put_gfn(d, g) ((void)0) +#define mem_event_cleanup(d) ((void)0) #define __gpfn_invalid(_d, gpfn) \ (lookup_domain_mpa((_d), ((gpfn)<<PAGE_SHIFT), NULL) == INVALID_MFN) diff -r 9c6cbbe72dc4 -r 1a76b2f7641b xen/include/asm-x86/mm.h --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -634,6 +634,8 @@ unsigned int domain_clamp_alloc_bitsize( unsigned long domain_get_maximum_gpfn(struct domain *d); +void mem_event_cleanup(struct domain *d); + extern struct domain *dom_xen, *dom_io, *dom_cow; /* for vmcoreinfo */ /* Definition of an mm lock: spinlock with extra fields for debugging */ _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |