On Mon, Sep 03, 2018 at 03:46:57PM +0100, Andrew Cooper wrote:
> This is the first step in making the destroy path idepotent, and using it in

"idempotent".

> place of the ad-hoc cleanup paths in the create path.
> 
> To begin with, the trivial free operations are broken out.  The rest of the
> cleanup code will be moved as it is demonstrated (or made) to be idempotent.
> 
> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
> ---
> CC: Jan Beulich <jbeul...@suse.com>
> CC: Wei Liu <wei.l...@citrix.com>
> CC: Roger Pau Monné <roger....@citrix.com>
> CC: Stefano Stabellini <sstabell...@kernel.org>
> CC: Julien Grall <julien.gr...@arm.com>
> ---
>  xen/common/domain.c | 29 ++++++++++++++++++++++-------
>  1 file changed, 22 insertions(+), 7 deletions(-)
> 
> diff --git a/xen/common/domain.c b/xen/common/domain.c
> index 43ab926..2253c2d 100644
> --- a/xen/common/domain.c
> +++ b/xen/common/domain.c
> @@ -260,6 +260,23 @@ static int __init parse_extra_guest_irqs(const char *s)
>  }
>  custom_param("extra_guest_irqs", parse_extra_guest_irqs);
>  
> +/*
> + * Destroy a domain once all references to it have been dropped.  Used either
> + * from the RCU path, or from the domain_create() error path before the 
> domain
> + * is inserted into the domlist.
> + */
> +static void __domain_destroy(struct domain *d)
> +{
> +    BUG_ON(!d->is_dying);
> +    BUG_ON(atomic_read(&d->refcnt) != DOMAIN_DESTROYED);
> +
> +    xfree(d->pbuf);

With this changed to XFREE here:

Reviewed-by: Wei Liu <wei.l...@citrix.com>

> +
> +    free_cpumask_var(d->dirty_cpumask);

On making things idempotent: this function seems to be a candidate.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to