Linux IOMMU Development
 help / color / mirror / Atom feed
* [PATCH] iommu/iova: Free all CPU rcache for retry when iova alloc failure
@ 2022-03-04  4:46 yf.wang--- via iommu
  2022-03-04  5:00 ` yf.wang--- via iommu
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: yf.wang--- via iommu @ 2022-03-04  4:46 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon, Matthias Brugger,
	open list:IOMMU DRIVERS, open list,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support
  Cc: wsd_upstream, Libo Kang, Yunfei Wang, stable, Ning Li


[-- Attachment #1.1: Type: text/html, Size: 2338 bytes --]

[-- Attachment #1.2: Type: text/plain, Size: 1401 bytes --]

From: Yunfei Wang <yf.wang@mediatek.com>

In alloc_iova_fast function, if an iova alloc request fail,
it will free the iova ranges present in the percpu iova
rcaches and free global iova rcache and then retry, but
flushing CPU iova rcaches only for each online CPU, which
will cause incomplete rcache cleaning, and iova rcaches of
not online CPU cannot be flushed, because iova rcaches may
also lead to fragmentation of iova space, so the next retry
action may still be fail.

Based on the above, so need to flushing all iova rcaches
for each possible CPU, use for_each_possible_cpu instead of
for_each_online_cpu like in free_iova_rcaches function,
so that all rcaches can be completely released to try
replenishing IOVAs.

Signed-off-by: Yunfei Wang <yf.wang@mediatek.com>
Cc: <stable@vger.kernel.org> # 5.4.*
---
 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 b28c9435b898..5a0637cd7bc2 100644
--- a/drivers/iommu/iova.c
+++ b/drivers/iommu/iova.c
@@ -460,7 +460,7 @@ alloc_iova_fast(struct iova_domain *iovad, unsigned long size,
 
 		/* Try replenishing IOVAs by flushing rcache. */
 		flush_rcache = false;
-		for_each_online_cpu(cpu)
+		for_each_possible_cpu(cpu)
 			free_cpu_cached_iovas(cpu, iovad);
 		free_global_cached_iovas(iovad);
 		goto retry;
-- 
2.18.0

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

end of thread, other threads:[~2022-03-07  3:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-04  4:46 [PATCH] iommu/iova: Free all CPU rcache for retry when iova alloc failure yf.wang--- via iommu
2022-03-04  5:00 ` yf.wang--- via iommu
2022-03-04  9:22 ` John Garry via iommu
2022-03-07  3:18   ` yf.wang--- via iommu
2022-03-04 14:03 ` Robin Murphy
2022-03-07  3:32   ` yf.wang--- via iommu
2022-03-07  3:49   ` yf.wang--- via iommu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox