iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] iommu/iova: Extend cached node lookup condition
@ 2016-11-11 18:35 Robin Murphy
       [not found] ` <1b035087a5a3ca8de9daf10bf067f3bd5c0e6f61.1478889292.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Robin Murphy @ 2016-11-11 18:35 UTC (permalink / raw)
  To: joro-zLv9SwRftAIdnm+yROfE0A
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

When searching for a free IOVA range, we optimise the tree traversal
by starting from the cached32_node, instead of the last node, when
limit_pfn is equal to dma_32bit_pfn. However, if limit_pfn happens to
be smaller, then we'll go ahead and start from the top even though
dma_32bit_pfn is still a more suitable upper bound. Since this is
clearly a silly thing to do, adjust the lookup condition appropriately.

Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
---
 drivers/iommu/iova.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
index e23001bfcfee..080beca0197d 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -56,7 +56,7 @@ EXPORT_SYMBOL_GPL(init_iova_domain);
 static struct rb_node *
 __get_cached_rbnode(struct iova_domain *iovad, unsigned long *limit_pfn)
 {
-	if ((*limit_pfn != iovad->dma_32bit_pfn) ||
+	if ((*limit_pfn > iovad->dma_32bit_pfn) ||
 		(iovad->cached32_node == NULL))
 		return rb_last(&iovad->rbroot);
 	else {
-- 
2.10.2.dirty

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

* Re: [PATCH RESEND] iommu/iova: Extend cached node lookup condition
       [not found] ` <1b035087a5a3ca8de9daf10bf067f3bd5c0e6f61.1478889292.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
@ 2016-11-15 11:40   ` Joerg Roedel
  0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2016-11-15 11:40 UTC (permalink / raw)
  To: Robin Murphy; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On Fri, Nov 11, 2016 at 06:35:46PM +0000, Robin Murphy wrote:
> When searching for a free IOVA range, we optimise the tree traversal
> by starting from the cached32_node, instead of the last node, when
> limit_pfn is equal to dma_32bit_pfn. However, if limit_pfn happens to
> be smaller, then we'll go ahead and start from the top even though
> dma_32bit_pfn is still a more suitable upper bound. Since this is
> clearly a silly thing to do, adjust the lookup condition appropriately.
> 
> Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
> ---
>  drivers/iommu/iova.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

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

end of thread, other threads:[~2016-11-15 11:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-11 18:35 [PATCH RESEND] iommu/iova: Extend cached node lookup condition Robin Murphy
     [not found] ` <1b035087a5a3ca8de9daf10bf067f3bd5c0e6f61.1478889292.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2016-11-15 11:40   ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).