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

Re: [Xen-devel] [RFC XEN PATCH 05/16] xen/x86: release pmem pages at domain destroy



>>> On 10.10.16 at 02:32, <haozhong.zhang@xxxxxxxxx> wrote:
> --- a/xen/arch/x86/pmem.c
> +++ b/xen/arch/x86/pmem.c
> @@ -282,3 +282,44 @@ int pmem_populate(struct xen_pmemmap_args *args)
>      args->nr_done = i;
>      return rc;
>  }
> +
> +static int pmem_teardown_preemptible(struct domain *d, int *preempted)
> +{
> +    struct page_info *pg, *next;
> +    int rc = 0;
> +
> +    spin_lock(&d->pmem_lock);
> +
> +    page_list_for_each_safe (pg, next, &d->pmem_page_list )
> +    {
> +        BUG_ON(page_get_owner(pg) != d);
> +        BUG_ON(page_state_is(pg, free));
> +
> +        page_list_del(pg, &d->pmem_page_list);
> +        page_set_owner(pg, NULL);
> +        pg->count_info = (pg->count_info & ~PGC_count_mask) | PGC_state_free;
> +
> +        if ( preempted && hypercall_preempt_check() )
> +        {
> +            *preempted = 1;
> +            goto out;
> +        }
> +    }
> +
> + out:
> +    spin_unlock(&d->pmem_lock);
> +    return rc;
> +}
> +
> +int pmem_teardown(struct domain *d)
> +{
> +    int preempted = 0;
> +
> +    ASSERT(d->is_dying);
> +    ASSERT(d != current->domain);
> +
> +    if ( !has_hvm_container_domain(d) || !paging_mode_translate(d) )
> +        return -EINVAL;

Why are these needed?

> +    return pmem_teardown_preemptible(d, &preempted);

I don't see what you have "preempted" for here. You want the
function to return -ERESTART in the preemption case. And I also
don't see what the helper function is good for - the code can
easily live right in this function.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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