[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()


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 18 Oct 2022 09:08:30 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=avymgcjJ6uBY8Le7K1Sv9JaeDNUpZldvNkHynNp/vEo=; b=TS+baY4iWVWkMwwMHHs+/tsTX0KMmlpUB0s6aE5B8qFUYrrAyhwxsAXPkPpcl+FpVBok6buLmXzBhRE0v+vGIUNFMmJNAnDOVzwOPZxe1Hy/OdFlpkTzJQqQa68C6m1Sf/OL0bHDTXmzoY6NdadUNKRqDYxmf7tA13bWIGW7Uf7If4qfBYWlrLkee0UQqSHoXcjIdo6hoel+uomFbGwV/00y92b7PB92sTaf1yp0SOX/yPjbAlGoyzUCQom+jIU72cwzZV+r+kqOf2JXsN/H/mZwI9K2RWA1Aq8kF2ShYfjX8iKmQm1CmEG92bfSJ3H9jbK3YFKutTjH4Btg/HeyoA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eJDyt0PH+VsV8bFrmx0JrNdrFKX+vOIUxeEZsNlQ8d6U9s8PM0sux2QFuYgvcmTuS5FJ4NST0SOoSCmbV9eLLDZiLeRS1XNTjIaIOQut4vXnXUrD8S8pmS/sy+DuYwbtNKjw+Gguq1Qa43EOIq6Z2/pBopSAK/6nHvKO80iDd088WkGTEJW89wJquV/mBG65mg6A+fLAMLOMJB6MRH4JyBOhCiJefQINZCuXItbTtyLOhICe49epRSGJnkzEvLcLXBEX9n8NuP5d5Zki6qUZ41a9k1e1wpthVW4Vak/2e8QQm48jZsgWtDnS7er3G6DbPR/+bwrnUf7d5a87Ud29lQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Henry Wang <Henry.Wang@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 18 Oct 2022 07:08:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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);




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.