From: Greg Kroah-Hartman Date: Mon, 20 Mar 2017 10:09:44 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v4.4.56~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2bbbffa6ee4eca215a4ea31a17ca66502371710b;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: dmaengine-iota-ioat_alloc_chan_resources-should-not-perform-sleeping-allocations.patch --- diff --git a/queue-4.9/dmaengine-iota-ioat_alloc_chan_resources-should-not-perform-sleeping-allocations.patch b/queue-4.9/dmaengine-iota-ioat_alloc_chan_resources-should-not-perform-sleeping-allocations.patch new file mode 100644 index 00000000000..96f2e4cc48f --- /dev/null +++ b/queue-4.9/dmaengine-iota-ioat_alloc_chan_resources-should-not-perform-sleeping-allocations.patch @@ -0,0 +1,53 @@ +From 21d25f6a4217e755906cb548b55ddab39d0e88b9 Mon Sep 17 00:00:00 2001 +From: Krister Johansen +Date: Wed, 4 Jan 2017 01:22:52 -0800 +Subject: dmaengine: iota: ioat_alloc_chan_resources should not perform sleeping allocations. + +From: Krister Johansen + +commit 21d25f6a4217e755906cb548b55ddab39d0e88b9 upstream. + +On a kernel with DEBUG_LOCKS, ioat_free_chan_resources triggers an +in_interrupt() warning. With PROVE_LOCKING, it reports detecting a +SOFTIRQ-safe to SOFTIRQ-unsafe lock ordering in the same code path. + +This is because dma_generic_alloc_coherent() checks if the GFP flags +permit blocking. It allocates from different subsystems if blocking is +permitted. The free path knows how to return the memory to the correct +allocator. If GFP_KERNEL is specified then the alloc and free end up +going through cma_alloc(), which uses mutexes. + +Given that ioat_free_chan_resources() can be called in interrupt +context, ioat_alloc_chan_resources() must specify GFP_NOWAIT so that the +allocations do not block and instead use an allocator that uses +spinlocks. + +Signed-off-by: Krister Johansen +Acked-by: Dave Jiang +Signed-off-by: Vinod Koul +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/dma/ioat/init.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/dma/ioat/init.c ++++ b/drivers/dma/ioat/init.c +@@ -691,7 +691,7 @@ static int ioat_alloc_chan_resources(str + /* doing 2 32bit writes to mmio since 1 64b write doesn't work */ + ioat_chan->completion = + dma_pool_zalloc(ioat_chan->ioat_dma->completion_pool, +- GFP_KERNEL, &ioat_chan->completion_dma); ++ GFP_NOWAIT, &ioat_chan->completion_dma); + if (!ioat_chan->completion) + return -ENOMEM; + +@@ -701,7 +701,7 @@ static int ioat_alloc_chan_resources(str + ioat_chan->reg_base + IOAT_CHANCMP_OFFSET_HIGH); + + order = IOAT_MAX_ORDER; +- ring = ioat_alloc_ring(c, order, GFP_KERNEL); ++ ring = ioat_alloc_ring(c, order, GFP_NOWAIT); + if (!ring) + return -ENOMEM; + diff --git a/queue-4.9/series b/queue-4.9/series index 3253da6f618..599fe307cc1 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -39,3 +39,4 @@ bpf-detect-identical-ptr_to_map_value_or_null-registers.patch bpf-fix-state-equivalence.patch bpf-fix-regression-on-verifier-pruning-wrt-map-lookups.patch bpf-fix-mark_reg_unknown_value-for-spilled-regs-on-map-value-marking.patch +dmaengine-iota-ioat_alloc_chan_resources-should-not-perform-sleeping-allocations.patch