FAILED: patch "[PATCH] dma/pool: create dma atomic pool only if dma zone has managed" failed to apply to 5.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a674e48c5443d12a8a43c3ac42367aa39505d506 Mon Sep 17 00:00:00 2001
From: Baoquan He <[email protected]>
Date: Fri, 14 Jan 2022 14:07:41 -0800
Subject: [PATCH] dma/pool: create dma atomic pool only if dma zone has managed
pages
Currently three dma atomic pools are initialized as long as the relevant kernel codes are built in. While in kdump kernel of x86_64, this is not right when trying to create atomic_pool_dma, because there's no managed pages in DMA zone. In the case, DMA zone only has low 1M memory presented and locked down by memblock allocator. So no pages are added into buddy of DMA zone. Please check commit f1d4d47c5851 ("x86/setup:
Always reserve the first 1M of RAM").
Then in kdump kernel of x86_64, it always prints below failure message:
DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
swapper/0: page allocation failure: order:5, mode:0xcc1(GFP_KERNEL|GFP_DMA), nodemask=(null),cpuset=/,mems_allowed=0
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.13.0-0.rc5.20210611git929d931f2b40.42.fc35.x86_64 #1 Hardware name: Dell Inc. PowerEdge R910/0P658H, BIOS 2.12.0 06/04/2018 Call Trace: dump_stack+0x7f/0xa1 warn_alloc.cold+0x72/0xd6 __alloc_pages_slowpath.constprop.0+0xf29/0xf50 __alloc_pages+0x24d/0x2c0 alloc_page_interleave+0x13/0xb0 atomic_pool_expand+0x118/0x210 __dma_atomic_pool_init+0x45/0x93 dma_atomic_pool_init+0xdb/0x176 do_one_initcall+0x67/0x320 kernel_init_freeable+0x290/0x2dc kernel_init+0xa/0x111 ret_from_fork+0x22/0x30 Mem-Info: ...... DMA: failed to allocate 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocation DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
Here, let's check if DMA zone has managed pages, then create atomic_pool_dma if yes. Otherwise just skip it.
kernel/dma/pool.c +2 -2
@@ -203,7 +203,7 @@ static int __init dma_atomic_pool_init(void) GFP_KERNEL);if (!atomic_pool_kernel) ret = -ENOMEM ; -if (IS_ENABLED (CONFIG_ZONE_DMA )) { +if (has_managed_dma ()) { atomic_pool_dma =__dma_atomic_pool_init (atomic_pool_size,GFP_KERNEL |GFP_DMA );if (!atomic_pool_dma)
@@ -226,7 +226,7 @@ static inline struct gen_pool *dma_guess_pool(struct gen_pool *prev, gfp_t gfp)if (prev ==NULL ) {if (IS_ENABLED (CONFIG_ZONE_DMA32 ) && (gfp &GFP_DMA32 ))return atomic_pool_dma32; -if (IS_ENABLED (CONFIG_ZONE_DMA ) && (gfp &GFP_DMA )) +if (atomic_pool_dma && (gfp &GFP_DMA ))return atomic_pool_dma;return atomic_pool_kernel; }
Quoted 9 lines · On 1/23/22 8:29 AM, [email protected] wrote:
The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
Hi,
FWIIW :
We picked up the suspect "Fixes" commit :
2020-10-01 | x86/kdump: Always reserve the low 1M when the crashkernel option is specified
In an LTS update: 5.4.68, and I do not see the issue reported in the summary : "DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations " , when a kdump is invoked. We test kdump quite regularly on a variety of platforms.
Baoquan's series may not be needed in 5.4.LTS.
Quoted 87 lines
------------------ original commit in Linus's tree ------------------
From
a674e48c5443d12a8a43c3ac42367aa39505d506Mon Sep 17 00:00:00 2001
From: Baoquan He <[email protected]>
Date: Fri, 14 Jan 2022 14:07:41 -0800
Subject: [PATCH] dma/pool: create dma atomic pool only if dma zone has managed
pagesCurrently three dma atomic pools are initialized as long as the relevant kernel codes are built in. While in kdump kernel of
x86_64, this is not right when trying to createatomic_pool_dma, because there's no managed pages in DMA zone. In the case, DMA zone only has low 1M memory presented and locked down by memblock allocator. So no pages are added into buddy of DMA zone. Please check commitf1d4d47c5851("x86/setup:
Always reserve the first 1M of RAM").Then in kdump kernel of
x86_64, it always prints below failure message:DMA: preallocated 128 KiB
GFP_KERNELpool for atomic allocations
swapper/0: page allocation failure: order:5, mode:0xcc1(GFP_KERNEL|GFP_DMA), nodemask=(null),cpuset=/,mems_allowed=0CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.13.0-0.rc5.20210611git929d931f2b40.42.fc35.x86_64 #1 Hardware name: Dell Inc. PowerEdge R910/0P658H, BIOS 2.12.0 06/04/2018 Call Trace: dump_stack+0x7f/0xa1 warn_alloc.cold+0x72/0xd6 __alloc_pages_slowpath.constprop.0+0xf29/0xf50 __alloc_pages+0x24d/0x2c0 alloc_page_interleave+0x13/0xb0 atomic_pool_expand+0x118/0x210 __dma_atomic_pool_init+0x45/0x93 dma_atomic_pool_init+0xdb/0x176 do_one_initcall+0x67/0x320 kernel_init_freeable+0x290/0x2dc kernel_init+0xa/0x111 ret_from_fork+0x22/0x30 Mem-Info: ...... DMA: failed to allocate 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocation DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocationsHere, let's check if DMA zone has managed pages, then create
atomic_pool_dmaif yes. Otherwise just skip it.Fixes 6f599d84231f ("x86/kdump: Always reserve the low 1M when the crashkernel option is specified")Signed-off-by Baoquan He <[email protected]>Reviewed-by Christoph Hellwig <[email protected]>Acked-by John Donnelly <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Cc Marek Szyprowski <[email protected]>Cc Robin Murphy <[email protected]>Cc Borislav Petkov <[email protected]>Cc Christoph Lameter <[email protected]>Cc David Laight <[email protected]>Cc David Rientjes <[email protected]>Cc Hyeonggon Yoo <[email protected]>Cc Joonsoo Kim <[email protected]>Cc Pekka Enberg <[email protected]>Cc Vlastimil Babka <[email protected]>Cc <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Linus Torvalds <[email protected]>kernel/dma/pool.c +2
-2@@ -203,7 +203,7 @@ static int __init dma_atomic_pool_init(void) GFP_KERNEL);if (!atomic_pool_kernel) ret = -ENOMEM ; -if (IS_ENABLED (CONFIG_ZONE_DMA )) { +if (has_managed_dma ()) { atomic_pool_dma =__dma_atomic_pool_init (atomic_pool_size,GFP_KERNEL |GFP_DMA );if (!atomic_pool_dma)@@ -226,7 +226,7 @@ static inline struct gen_pool *dma_guess_pool(struct gen_pool *prev, gfp_t gfp)if (prev ==NULL ) {if (IS_ENABLED (CONFIG_ZONE_DMA32 ) && (gfp &GFP_DMA32 ))return atomic_pool_dma32; -if (IS_ENABLED (CONFIG_ZONE_DMA ) && (gfp &GFP_DMA )) +if (atomic_pool_dma && (gfp &GFP_DMA ))return atomic_pool_dma;return atomic_pool_kernel; }
Greg KH
maintainerQuoted 19 lines · On Mon, Jan 24, 2022 at 08:37:43AM -0600, [email protected] wrote:
Quoted 9 lines · On 1/23/22 8:29 AM, [email protected] wrote:
The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
Hi,
FWIIW :
We picked up the suspect "Fixes" commit :
Quoted 7 lines
2020-10-01 | x86/kdump: Always reserve the low 1M when the crashkernel option is specified
In an LTS update: 5.4.68, and I do not see the issue reported in the summary : "DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations" , when a kdump is invoked. We test kdump quite regularly on a variety of platforms.
That commit was in 5.4.69, not .68. Or am I confused here?
that is why the 5.4 FAILED email was sent.
thanks,
greg k-h