On 29/05/2019 11:57, Jan Beulich wrote:
>>>> On 29.05.19 at 11:04, <jgr...@suse.com> 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.

I like that idea.


Juergen

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

Reply via email to