Message ID | 20210318174414.684630-2-leobras.c@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [1/1] powerpc/kernel/iommu: Use largepool as a last resort when !largealloc | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (87d76f542a24ecfa797e9bd3bb56c0f19aabff57) |
snowpatch_ozlabs/build-ppc64le | success | Build succeeded |
snowpatch_ozlabs/build-ppc64be | success | Build succeeded |
snowpatch_ozlabs/build-ppc64e | success | Build succeeded |
snowpatch_ozlabs/build-pmac32 | success | Build succeeded |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 15 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
Hello, FYI: This patch was reviewed when it was part of another patchset: http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20200817234033.442511-4-leobras.c@gmail.com/ On Thu, 2021-03-18 at 14:44 -0300, Leonardo Bras wrote: > As of today, doing iommu_range_alloc() only for !largealloc (npages <= 15) > will only be able to use 3/4 of the available pages, given pages on > largepool not being available for !largealloc. > > This could mean some drivers not being able to fully use all the available > pages for the DMA window. > > Add pages on largepool as a last resort for !largealloc, making all pages > of the DMA window available. > > Signed-off-by: Leonardo Bras <leobras.c@gmail.com> > Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> > --- > arch/powerpc/kernel/iommu.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c > index 3329ef045805..ae6ad8dca605 100644 > --- a/arch/powerpc/kernel/iommu.c > +++ b/arch/powerpc/kernel/iommu.c > @@ -255,6 +255,15 @@ static unsigned long iommu_range_alloc(struct device *dev, > pass++; > goto again; > > > + } else if (pass == tbl->nr_pools + 1) { > + /* Last resort: try largepool */ > + spin_unlock(&pool->lock); > + pool = &tbl->large_pool; > + spin_lock(&pool->lock); > + pool->hint = pool->start; > + pass++; > + goto again; > + > } else { > /* Give up */ > spin_unlock_irqrestore(&(pool->lock), flags);
On Thu, 18 Mar 2021 14:44:17 -0300, Leonardo Bras wrote: > As of today, doing iommu_range_alloc() only for !largealloc (npages <= 15) > will only be able to use 3/4 of the available pages, given pages on > largepool not being available for !largealloc. > > This could mean some drivers not being able to fully use all the available > pages for the DMA window. > > [...] Applied to powerpc/next. [1/1] powerpc/kernel/iommu: Use largepool as a last resort when !largealloc https://git.kernel.org/powerpc/c/fc5590fd56c9608f317729b59a56dad2a75d633f cheers
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index 3329ef045805..ae6ad8dca605 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -255,6 +255,15 @@ static unsigned long iommu_range_alloc(struct device *dev, pass++; goto again; + } else if (pass == tbl->nr_pools + 1) { + /* Last resort: try largepool */ + spin_unlock(&pool->lock); + pool = &tbl->large_pool; + spin_lock(&pool->lock); + pool->hint = pool->start; + pass++; + goto again; + } else { /* Give up */ spin_unlock_irqrestore(&(pool->lock), flags);