[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/3] xen/arm: Clean-up in p2m_init() and p2m_final_teardown()


  • To: Henry Wang <Henry.Wang@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Fri, 20 Jan 2023 11:23:03 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=arm.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=xcFMsURAjmv2DipZImXEQQ2/KV3cXpq9aizwLCqNE4g=; b=Dk3xryFNut0crCc5Jid0glT8iLvh7Xm5RdV0qQrQN0xgPKjuQRyZtlm7UYduoogMljz3a/u02D1rAncngvUnXBmS2DFRFIZOva7cStmKdtBcHcTjQt3M5l14iN14UXmxOB/F4lFeMIxMXRlztXkCl+9PlxRMXsogoxTMnZwQ/soL5zAuoOA4LtDtLkRuj4RQ4UxP8xpgfFV8R14zlSTzVlmAHsMTv7frSwWntvFODell/Q5kCub2MWRf6079uM7dbz7ZL2Qo9F0aJlvMISQKv9hLTPbFxwYOB9PjwfLU7kWyK5FCWMiYKlHtRfLaLOxlu/id0kQEhxaGx6SqNYk91A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CgR91RnMF5haE+FTUBDSUlC1KR+9idpSMuP8Cfu4yPM5i9ebiEd0S6yKqDTpbOtrG8uMJi0XZfRbfYQeFNDXVfrXkyoDYDXWjsLfIHpDyQ8EG9sTCimkxgYPnMobOB3FOpNckUuISa4Z0nILoADFhJc3EZlkwtlavZDOywKesbPF4d46/ISGP4+DjKeoJAcn9MgP6kwLJ8Vwl5YCZjNMJAcZDK6AKv5YuzdJjFw6CZP6dmhrL4HinzmZ122xqGKVWxBqNtBu1XdQ2V91NcmT1hmdBK/tJU4vi7VDlCQ4XT+qwdO2tM6OGPoOJ0flqLuRcFuihAS77hus5+egCQljeg==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Chen <wei.chen@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 20 Jan 2023 10:23:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Henry,

On 16/01/2023 02:58, Henry Wang wrote:
> 
> 
> With the change in previous patch, the initial 16 pages in the P2M
> pool is not necessary anymore. Drop them for code simplification.
> 
> Also the call to p2m_teardown() from arch_domain_destroy() is not
> necessary anymore since the movement of the P2M allocation out of
> arch_domain_create(). Drop the code and the above in-code comment
> mentioning it.
> 
> Signed-off-by: Henry Wang <Henry.Wang@xxxxxxx>
> ---
> I am not entirely sure if I should also drop the "TODO" on top of
> the p2m_set_entry(). Because although we are sure there is no
> p2m pages populated in domain_create() stage now, but we are not
> sure if anyone will add more in the future...Any comments?
> ---
>  xen/arch/arm/include/asm/p2m.h |  4 ----
>  xen/arch/arm/p2m.c             | 20 +-------------------
>  2 files changed, 1 insertion(+), 23 deletions(-)
> 
> diff --git a/xen/arch/arm/include/asm/p2m.h b/xen/arch/arm/include/asm/p2m.h
> index bf5183e53a..cf06d3cc21 100644
> --- a/xen/arch/arm/include/asm/p2m.h
> +++ b/xen/arch/arm/include/asm/p2m.h
> @@ -200,10 +200,6 @@ int p2m_init(struct domain *d);
>   *  - p2m_final_teardown() will be called when domain struct is been
>   *    freed. This *cannot* be preempted and therefore one small
>   *    resources should be freed here.
> - *  Note that p2m_final_teardown() will also call p2m_teardown(), to properly
> - *  free the P2M when failures happen in the domain creation with P2M pages
> - *  already in use. In this case p2m_teardown() is called non-preemptively 
> and
> - *  p2m_teardown() will always return 0.
>   */
>  int p2m_teardown(struct domain *d, bool allow_preemption);
>  void p2m_final_teardown(struct domain *d);
> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> index 7de7d822e9..d41a316d18 100644
> --- a/xen/arch/arm/p2m.c
> +++ b/xen/arch/arm/p2m.c
> @@ -1744,13 +1744,9 @@ void p2m_final_teardown(struct domain *d)
>      /*
>       * No need to call relinquish_p2m_mapping() here because
>       * p2m_final_teardown() is called either after 
> domain_relinquish_resources()
> -     * where relinquish_p2m_mapping() has been called, or from failure path 
> of
> -     * domain_create()/arch_domain_create() where mappings that require
> -     * p2m_put_l3_page() should never be created. For the latter case, also 
> see
> -     * comment on top of the p2m_set_entry() for more info.
> +     * where relinquish_p2m_mapping() has been called.
>       */
> 
> -    BUG_ON(p2m_teardown(d, false));
Because you remove this,
>      ASSERT(page_list_empty(&p2m->pages));
you no longer need this assert, right?

Apart from that:
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

~Michal



 


Rackspace

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