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

Re: [Xen-devel] [PATCH v2 3/3] xen/swiotlb: remember having called xen_create_contiguous_region()



>>> On 29.05.19 at 11:04, <jgross@xxxxxxxx> wrote:
> @@ -345,8 +346,11 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t 
> size, void *vaddr,
>       size = 1UL << (order + XEN_PAGE_SHIFT);
>  
>       if (!WARN_ON((dev_addr + size - 1 > dma_mask) ||
> -                  range_straddles_page_boundary(phys, size)))
> +                  range_straddles_page_boundary(phys, size)) &&
> +         PageXenRemapped(virt_to_page(vaddr))) {
>               xen_destroy_contiguous_region(phys, order);
> +             ClearPageXenRemapped(virt_to_page(vaddr));
> +     }

To be symmetric with setting the flag only after having made the region
contiguous, and to avoid (perhaps just theoretical) races, wouldn't it be
better to clear the flag before calling xen_destroy_contiguous_region()?
Even better would be a TestAndClear...() operation.

Jan



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

 


Rackspace

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