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

Re: [Xen-devel] [PATCH v3] p2m: use GNTTABOP_unmap_and_duplicate if available



On 04/11/13 15:38, Roger Pau Monne wrote:
> The new GNTTABOP_unmap_and_duplicate operation doesn't zero the
> mapping passed in new_addr, allowing us to perform batch unmaps in p2m
> code without requiring the use of a multicall.

Should the grant maps should be batched in a similar way?

> +int m2p_remove_override_batch(struct page **pages,
> +             struct gnttab_map_grant_ref *kmap_ops, int count)
> +{
> +     struct gnttab_unmap_and_duplicate *unmap_ops = NULL;
> +     int ret = 0, i;
> +
> +     for (i = 0; i < count; i++) {
> +             ret = remove_page_override(pages[i]);
> +             if (ret)
> +                     goto out;
> +     }
> +
> +     if (kmap_ops != NULL) {
> +             struct page *scratch_page = get_balloon_scratch_page();
> +             unsigned long scratch_page_address = (unsigned long)
> +                                     __va(page_to_pfn(scratch_page) << 
> PAGE_SHIFT);
> +             int invcount = 0;
> +
> +             unmap_ops = kcalloc(count, sizeof(unmap_ops[0]), GFP_KERNEL);
> +             if (!unmap_ops) {
> +                     put_balloon_scratch_page();
> +                     ret = -ENOMEM;
> +                     goto out;
> +             }

A memory allocation failure here looks bad as the grants will not be
unmapped which will have an impact on the granter domain.  Either: a)
the unmap ops should be constructed in advance (excluding high mem pages
at that point); or b) this should use a statically allocated per-cpu
array of unmap ops with the batch split as necessary to fit into the
static array.

David

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


 


Rackspace

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