[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 2/2] xen/arm: p2m: Populate pages for GICv2 mapping in arch_domain_create()
On 17.10.2022 21:12, Andrew Cooper wrote: > --- a/xen/arch/arm/p2m.c > +++ b/xen/arch/arm/p2m.c > @@ -1736,8 +1736,36 @@ void p2m_final_teardown(struct domain *d) > if ( !p2m->domain ) > return; > > - ASSERT(page_list_empty(&p2m->pages)); > - ASSERT(page_list_empty(&d->arch.paging.p2m_freelist)); > + /* > + * On the domain_create() error path only, we can end up here with a > + * non-zero P2M pool. > + * > + * At present, this is a maximum of 16 pages, spread between p2m->pages > + * and the free list. The domain has never been scheduled (it has no > + * vcpus), so there is TLB maintenance to perform; just free everything. > + */ > + if ( !page_list_empty(&p2m->pages) || > + !page_list_empty(&d->arch.paging.p2m_freelist) ) > + { > + struct page_info *pg; > + > + /* > + * There's no sensible "in the domain_create() error path" predicate, > + * so simply sanity check that we don't have unexpected work to do. > + */ > + ASSERT(d->arch.paging.p2m_total_pages <= 16); I guess this isn't sufficient as a sanity check, as the count (contrary to the name of the field) is only representing all pages on p2m_freelist. Jan > + spin_lock(&d->arch.paging.lock); > + > + while ( (pg = page_list_remove_head(&p2m->pages)) ) > + free_domheap_page(pg); > + while ( (pg = page_list_remove_head(&d->arch.paging.p2m_freelist)) ) > + free_domheap_page(pg); > + > + d->arch.paging.p2m_total_pages = 0; > + > + spin_unlock(&d->arch.paging.lock); > + } > > if ( p2m->root ) > free_domheap_pages(p2m->root, P2M_ROOT_ORDER);
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |