Thread (3 messages) 3 messages, 2 authors, 2019-07-24

Re: [PATCH kernel] powerpc/pseries/iommu: Add cond_resched() for huge updates

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2019-07-24 03:53:12

Alexey Kardashevskiy [off-list ref] writes:
Mapping ~5.000.000 TCEs currently takes about 40s; this is the amount
required for a 300GB VM with 64k IOMMU page size. Anything bigger than
this produces RCU stall warnings.
OK. Are we sure we're not doing anything stupid in that code to make it
go that slowly?
quoted hunk ↗ jump to hunk
This adds cond_resched() to allow the scheduler to do context switching
when it decides to.

This loop is called from dma_set_mask() which is a sleepable context.

Signed-off-by: Alexey Kardashevskiy <redacted>
---
 arch/powerpc/platforms/pseries/iommu.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index 889dc2e44b89..2b8de822272f 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -459,6 +459,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn,
 static int tce_setrange_multi_pSeriesLP_walk(unsigned long start_pfn,
 		unsigned long num_pfn, void *arg)
 {
+	cond_resched();
 	return tce_setrange_multi_pSeriesLP(start_pfn, num_pfn, arg);
 }
Why there and not in tce_setrange_multi_pSeriesLP() ?

I'm not sure what the maximum granularity walk_system_ram_range() will
ever call us with is.

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help