Re: [PATCH 4/5] iommu: Separate IOVA rcache memories from iova_domain structure
From: John Garry
Date:  Wed Dec 22 2021 - 06:53:18 EST
On 20/12/2021 13:57, Robin Murphy wrote:
Do you have any thoughts on this patch? The decision is whether we 
stick with a single iova domain structure or support this super 
structure for iova domains which support the rcache. I did not try the 
former - it would be do-able but I am not sure on how it would look.
TBH I feel inclined to take the simpler approach of just splitting the 
rcache array to a separate allocation, making init_iova_rcaches() public 
(with a proper return value), and tweaking put_iova_domain() to make 
rcache cleanup conditional. A residual overhead of 3 extra pointers in 
iova_domain doesn't seem like *too* much for non-DMA-API users to bear. 
OK, fine. So I tried as you suggested and it looks ok to me.
I'll send something out at rc1.
Unless you want to try generalising the rcache mechanism completely away 
from IOVA API specifics, it doesn't seem like there's really enough to 
justify the bother of having its own distinct abstraction layer.
Yeah, I don't see that as necessary.
However something which could be useful is to separate the magazine code 
out for other possible users.
Thanks!
John