Re: [Xen-devel] [PATCH v2 3/3] xen/swiotlb: remember having called xen_create_contiguous_region()
From: Jan Beulich
Date: Wed May 29 2019 - 06:01:06 EST
>>> 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