All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] xen/swiotlb: fix an issue and improve swiotlb-xen
@ 2019-04-23 10:54 ` Juergen Gross
  0 siblings, 0 replies; 49+ messages in thread
From: Juergen Gross @ 2019-04-23 10:54 UTC (permalink / raw)
  To: xen-devel, linux-kernel, iommu
  Cc: konrad.wilk, boris.ostrovsky, sstabellini, Juergen Gross

While hunting an issue in swiotlb-xen I stumbled over a wrong test
and found some areas for improvement.

Juergen Gross (3):
  xen/swiotlb: fix condition for calling xen_destroy_contiguous_region()
  xen/swiotlb: simplify range_straddles_page_boundary()
  xen/swiotlb: remember having called xen_create_contiguous_region()

 drivers/xen/swiotlb-xen.c | 37 ++++++++++++-------------------------
 1 file changed, 12 insertions(+), 25 deletions(-)

-- 
2.16.4


^ permalink raw reply	[flat|nested] 49+ messages in thread
* Re: [PATCH 3/3] xen/swiotlb: remember having called xen_create_contiguous_region()
@ 2019-04-25  9:07 Juergen Gross
  0 siblings, 0 replies; 49+ messages in thread
From: Juergen Gross @ 2019-04-25  9:07 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Stefano Stabellini, Konrad Rzeszutek Wilk, lkml, iommu,
	xen-devel, Boris Ostrovsky

On 25/04/2019 11:01, Jan Beulich wrote:
>>>> On 23.04.19 at 20:36, <jgross@suse.com> wrote:
>> On 23/04/2019 19:05, Stefano Stabellini wrote:
>>> On Tue, 23 Apr 2019, Juergen Gross wrote:
>>>> Instead of always calling xen_destroy_contiguous_region() in case the
>>>> memory is DMA-able for the used device, do so only in case it has been
>>>> made DMA-able via xen_create_contiguous_region() before.
>>>>
>>>> This will avoid a lot of xen_destroy_contiguous_region() calls for
>>>> 64-bit capable devices.
>>>>
>>>> As the memory in question is owned by swiotlb-xen the PG_owner_priv_1
>>>> flag of the first allocated page can be used for remembering.
>>>
>>> Although the patch looks OK, this sentence puzzles me. Why do you say
>>> that the memory in question is owned by swiotlb-xen? Because it was
>>> returned by xen_alloc_coherent_pages? Both the x86 and the Arm
>>> implementation return fresh new memory, hence, it should be safe to set
>>> the PageOwnerPriv1 flag?
>>>
>>> My concern with this approach is with the semantics of PG_owner_priv_1.
>>> Is a page marked with PG_owner_priv_1 only supposed to be used by the
>>> owner?
>>
>> The owner of the page is free to use the flag.
>>
>> Like Grant pages are marked by the grant driver using this flag. And
>> Xen page tables are using it in PV-guests for indicating a "Pinned"
>> page table.
> 
> Considering the background of the series, isn't such multi-purpose use
> of the flag a possible problem? You're already suspecting a wrong call
> into here. The function finding the flag set (but for another reason)
> might add to the confusion. But I realize there are only so many page
> flags available.

Right.

> Perhaps the freeing function should, first thing, check the handed
> space actually matches the criteria (within dma_mask and contiguous)?

Yes, I think this is a good idea.


Juergen

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

^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2019-04-25  9:14 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23 10:54 [PATCH 0/3] xen/swiotlb: fix an issue and improve swiotlb-xen Juergen Gross
2019-04-23 10:54 ` [Xen-devel] " Juergen Gross
2019-04-23 10:54 ` Juergen Gross
2019-04-23 10:54 ` [PATCH 1/3] xen/swiotlb: fix condition for calling xen_destroy_contiguous_region() Juergen Gross
2019-04-23 10:54   ` [Xen-devel] " Juergen Gross
2019-04-23 10:54   ` Juergen Gross
2019-04-23 14:20   ` Boris Ostrovsky
2019-04-23 14:20     ` [Xen-devel] " Boris Ostrovsky
2019-04-23 14:20     ` Boris Ostrovsky
2019-04-23 14:20     ` Boris Ostrovsky
2019-04-23 14:20   ` Boris Ostrovsky
2019-04-25  8:53   ` [Xen-devel] " Jan Beulich
2019-04-25  8:53     ` Jan Beulich
2019-04-25  8:53     ` Jan Beulich
2019-04-25  8:53     ` Jan Beulich
2019-04-23 10:54 ` Juergen Gross
2019-04-23 10:54 ` [PATCH 2/3] xen/swiotlb: simplify range_straddles_page_boundary() Juergen Gross
2019-04-23 10:54 ` Juergen Gross
2019-04-23 10:54   ` [Xen-devel] " Juergen Gross
2019-04-23 10:54   ` Juergen Gross
2019-04-23 14:25   ` Boris Ostrovsky
2019-04-23 14:25     ` [Xen-devel] " Boris Ostrovsky
2019-04-23 14:25     ` Boris Ostrovsky
2019-04-23 14:25     ` Boris Ostrovsky
2019-04-23 14:25   ` Boris Ostrovsky
2019-04-23 10:54 ` [PATCH 3/3] xen/swiotlb: remember having called xen_create_contiguous_region() Juergen Gross
2019-04-23 10:54 ` Juergen Gross
2019-04-23 10:54   ` [Xen-devel] " Juergen Gross
2019-04-23 10:54   ` Juergen Gross
2019-04-23 10:54   ` Juergen Gross
2019-04-23 14:31   ` Boris Ostrovsky
2019-04-23 14:31     ` [Xen-devel] " Boris Ostrovsky
2019-04-23 14:31     ` Boris Ostrovsky
2019-04-23 14:31     ` Boris Ostrovsky
2019-04-23 14:31   ` Boris Ostrovsky
2019-04-23 17:05   ` Stefano Stabellini
2019-04-23 17:05   ` Stefano Stabellini
2019-04-23 17:05     ` [Xen-devel] " Stefano Stabellini
2019-04-23 17:05     ` Stefano Stabellini
2019-04-23 18:36     ` Juergen Gross
2019-04-23 18:36       ` [Xen-devel] " Juergen Gross
2019-04-23 18:36       ` Juergen Gross
2019-04-25  9:01       ` Jan Beulich
2019-04-25  9:01       ` [Xen-devel] " Jan Beulich
2019-04-25  9:01         ` Jan Beulich
2019-04-25  9:01         ` Jan Beulich
2019-04-25  9:01         ` Jan Beulich
2019-04-23 18:36     ` Juergen Gross
2019-04-25  9:07 Juergen Gross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.