[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55b35087-064d-8188-2373-0dd94ffef2b6@suse.com>
Date: Wed, 29 May 2019 12:21:41 +0200
From: Juergen Gross <jgross@...e.com>
To: Jan Beulich <JBeulich@...e.com>
Cc: Stefano Stabellini <sstabellini@...nel.org>,
iommu@...ts.linux-foundation.org,
xen-devel <xen-devel@...ts.xenproject.org>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [Xen-devel] [PATCH v2 3/3] xen/swiotlb: remember having called
xen_create_contiguous_region()
On 29/05/2019 11:57, Jan Beulich wrote:
>>>> On 29.05.19 at 11:04, <jgross@...e.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
Powered by blists - more mailing lists