Skip to content

Commit

Permalink
iommu: Disable caching of IOVA rb-tree node
Browse files Browse the repository at this point in the history
Cached rb-tree node is maintained in IOVA allocation/free code.
This node is updated whenever new IOVA allocation is requested or
and IOVA is freed. There is a bug is caching logic which is causing
some freed IOVAs not to be used as during allocation request, free
IOVAs are checked in rb-tree beginning from cached node.
Fix this by traversing whole rb-tree for free node from start during
each IOVA allocation request.

Bug 3697066

Change-Id: I9a3248fd2e39988aefdb54521641f37b22db4b78
Signed-off-by: Ashish Mhetre <[email protected]>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-4.9/+/2874969
Reviewed-by: Krishna Reddy <[email protected]>
Reviewed-by: Sachin Nikam <[email protected]>
GVS: Gerrit_Virtual_Submit <[email protected]>
  • Loading branch information
ashishmhetre8 authored and mobile promotions committed Mar 24, 2023
1 parent c6d8de5 commit 70004e8
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions drivers/iommu/iova.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,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) ||
(iovad->cached32_node == NULL))
return rb_last(&iovad->rbroot);
else {
struct rb_node *prev_node = rb_prev(iovad->cached32_node);
struct iova *curr_iova =
container_of(iovad->cached32_node, struct iova, node);
*limit_pfn = curr_iova->pfn_lo - 1;
return prev_node;
}
return rb_last(&iovad->rbroot);
}

static void
Expand Down

0 comments on commit 70004e8

Please sign in to comment.