Patch "arm64: Fix swiotlb fallback allocation" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
arm64: Fix swiotlb fallback allocation
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
arm64-fix-swiotlb-fallback-allocation.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
524dabe1c68e0bca25ce7b108099e5d89472a101Mon Sep 17 00:00:00 2001
From: Alexander Graf <[email protected]>
Date: Mon, 16 Jan 2017 12:46:33 +0100
Subject: arm64: Fix swiotlb fallback allocation
From: Alexander Graf <[email protected]>
commit 524dabe1c68e0bca25ce7b108099e5d89472a101 upstream.
Commit b67a8b29df introduced logic to skip swiotlb allocation when all memory is DMA accessible anyway.
While this is a great idea, __dma_alloc still calls swiotlb code unconditionally to allocate memory when there is no CMA memory available. The swiotlb code is called to ensure that we at least try get_free_pages().
Without initialization, swiotlb allocation code tries to access io_tlb_list which is NULL. That results in a stack trace like this:
Unable to handle kernel NULL pointer dereference at virtual address 00000000 [...] [<ffff00000845b908>] swiotlb_tbl_map_single+0xd0/0x2b0 [<ffff00000845be94>] swiotlb_alloc_coherent+0x10c/0x198 [<ffff000008099dc0>] __dma_alloc+0x68/0x1a8 [<ffff000000a1b410>] drm_gem_cma_create+0x98/0x108 [drm] [<ffff000000abcaac>] drm_fbdev_cma_create_with_funcs+0xbc/0x368 [drm_kms_helper] [<ffff000000abcd84>] drm_fbdev_cma_create+0x2c/0x40 [drm_kms_helper] [<ffff000000abc040>] drm_fb_helper_initial_config+0x238/0x410 [drm_kms_helper] [<ffff000000abce88>] drm_fbdev_cma_init_with_funcs+0x98/0x160 [drm_kms_helper] [<ffff000000abcf90>] drm_fbdev_cma_init+0x40/0x58 [drm_kms_helper] [<ffff000000b47980>] vc4_kms_load+0x90/0xf0 [vc4] [<ffff000000b46a94>] vc4_drm_bind+0xec/0x168 [vc4] [...]
Thankfully swiotlb code just learned how to not do allocations with the FORCE_NO option. This patch configures the swiotlb code to use that if we decide not to initialize the swiotlb framework.
--- arch/arm64/mm/init.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/mm/init.c +2 -0
@@ -403,6 +403,8 @@ void __init mem_init(void) {if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >>PAGE_SHIFT ))swiotlb_init (1 ); +else + swiotlb_force =SWIOTLB_NO_FORCE ;set_max_mapnr (pfn_to_page (max_pfn) - mem_map);
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/arm64-fix-swiotlb-fallback-allocation.patch
Hi Greg,
Quoted 68 lines · On Mon, Jan 23, 2017 at 5:02 PM, <[email protected]> wrote:
This is a note to let you know that I've just added the patch titled
arm64: Fix swiotlb fallback allocation
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summaryThe filename of the patch is:
arm64-fix-swiotlb-fallback-allocation.patch
and it can be found in the queue-4.9 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From
524dabe1c68e0bca25ce7b108099e5d89472a101Mon Sep 17 00:00:00 2001
From: Alexander Graf <[email protected]>
Date: Mon, 16 Jan 2017 12:46:33 +0100
Subject: arm64: Fix swiotlb fallback allocationFrom: Alexander Graf <[email protected]>
commit
524dabe1c68e0bca25ce7b108099e5d89472a101upstream.Commit
b67a8b29dfintroduced logic to skip swiotlb allocation when all memory is DMA accessible anyway.While this is a great idea,
__dma_allocstill calls swiotlb code unconditionally to allocate memory when there is no CMA memory available. The swiotlb code is called to ensure that we at least tryget_free_pages().Without initialization, swiotlb allocation code tries to access
io_tlb_listwhich is NULL. That results in a stack trace like this:Unable to handle kernel NULL pointer dereference at virtual address 00000000 [...] [<ffff00000845b908>] swiotlb_tbl_map_single+0xd0/0x2b0 [<ffff00000845be94>] swiotlb_alloc_coherent+0x10c/0x198 [<ffff000008099dc0>] __dma_alloc+0x68/0x1a8 [<ffff000000a1b410>] drm_gem_cma_create+0x98/0x108 [drm] [<ffff000000abcaac>] drm_fbdev_cma_create_with_funcs+0xbc/0x368 [drm_kms_helper] [<ffff000000abcd84>] drm_fbdev_cma_create+0x2c/0x40 [drm_kms_helper] [<ffff000000abc040>] drm_fb_helper_initial_config+0x238/0x410 [drm_kms_helper] [<ffff000000abce88>] drm_fbdev_cma_init_with_funcs+0x98/0x160 [drm_kms_helper] [<ffff000000abcf90>] drm_fbdev_cma_init+0x40/0x58 [drm_kms_helper] [<ffff000000b47980>] vc4_kms_load+0x90/0xf0 [vc4] [<ffff000000b46a94>] vc4_drm_bind+0xec/0x168 [vc4] [...]Thankfully swiotlb code just learned how to not do allocations with the
FORCE_NOoption. This patch configures the swiotlb code to use that if we decide not to initialize the swiotlb framework.Fixes b67a8b29df ("arm64: mm: only initialize swiotlb when necessary")Signed-off-by Alexander Graf <[email protected]>CC Jisheng Zhang <[email protected]>CC Geert Uytterhoeven <[email protected]>CC Konrad Rzeszutek Wilk <[email protected]>Signed-off-by Catalin Marinas <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/arm64/mm/init.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/mm/init.c void __init mem_init(void) · line 407
Quoted 5 lines
arch/arm64/mm/init.c +2
-0@@ -403,6 +403,8 @@ void __init mem_init(void) {if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >>PAGE_SHIFT ))swiotlb_init (1 ); +else + swiotlb_force =SWIOTLB_NO_FORCE ;
The above definition depends on:
commit ae7871be189cb411 ("swiotlb: Convert swiotlb_force from int to enum") commit fff5d99225107f5f ("swiotlb: Add swiotlb=noforce debug option")
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Catalin Marinas
maintainerQuoted 77 lines · Geert Uytterhoeven
Quoted 68 lines · On Mon, Jan 23, 2017 at 5:02 PM, <[email protected]> wrote:
This is a note to let you know that I've just added the patch titled
arm64: Fix swiotlb fallback allocation
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summaryThe filename of the patch is:
arm64-fix-swiotlb-fallback-allocation.patch
and it can be found in the queue-4.9 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From
524dabe1c68e0bca25ce7b108099e5d89472a101Mon Sep 17 00:00:00 2001
From: Alexander Graf <[email protected]>
Date: Mon, 16 Jan 2017 12:46:33 +0100
Subject: arm64: Fix swiotlb fallback allocationFrom: Alexander Graf <[email protected]>
commit
524dabe1c68e0bca25ce7b108099e5d89472a101upstream.Commit
b67a8b29dfintroduced logic to skip swiotlb allocation when all memory is DMA accessible anyway.While this is a great idea,
__dma_allocstill calls swiotlb code unconditionally to allocate memory when there is no CMA memory available. The swiotlb code is called to ensure that we at least tryget_free_pages().Without initialization, swiotlb allocation code tries to access
io_tlb_listwhich is NULL. That results in a stack trace like this:Unable to handle kernel NULL pointer dereference at virtual address 00000000 [...] [<ffff00000845b908>] swiotlb_tbl_map_single+0xd0/0x2b0 [<ffff00000845be94>] swiotlb_alloc_coherent+0x10c/0x198 [<ffff000008099dc0>] __dma_alloc+0x68/0x1a8 [<ffff000000a1b410>] drm_gem_cma_create+0x98/0x108 [drm] [<ffff000000abcaac>] drm_fbdev_cma_create_with_funcs+0xbc/0x368 [drm_kms_helper] [<ffff000000abcd84>] drm_fbdev_cma_create+0x2c/0x40 [drm_kms_helper] [<ffff000000abc040>] drm_fb_helper_initial_config+0x238/0x410 [drm_kms_helper] [<ffff000000abce88>] drm_fbdev_cma_init_with_funcs+0x98/0x160 [drm_kms_helper] [<ffff000000abcf90>] drm_fbdev_cma_init+0x40/0x58 [drm_kms_helper] [<ffff000000b47980>] vc4_kms_load+0x90/0xf0 [vc4] [<ffff000000b46a94>] vc4_drm_bind+0xec/0x168 [vc4] [...]Thankfully swiotlb code just learned how to not do allocations with the
FORCE_NOoption. This patch configures the swiotlb code to use that if we decide not to initialize the swiotlb framework.Fixes b67a8b29df ("arm64: mm: only initialize swiotlb when necessary")Signed-off-by Alexander Graf <[email protected]>CC Jisheng Zhang <[email protected]>CC Geert Uytterhoeven <[email protected]>CC Konrad Rzeszutek Wilk <[email protected]>Signed-off-by Catalin Marinas <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/arm64/mm/init.c | 2 ++ 1 file changed, 2 insertions(+)arch/arm64/mm/init.c void __init mem_init(void) · line 407
Quoted 5 lines
arch/arm64/mm/init.c +2
-0@@ -403,6 +403,8 @@ void __init mem_init(void) {if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >>PAGE_SHIFT ))swiotlb_init (1 ); +else + swiotlb_force =SWIOTLB_NO_FORCE ;The above definition depends on:
Quoted 2 lines
commit
ae7871be189cb411("swiotlb: Convertswiotlb_forcefrom int to enum") commitfff5d99225107f5f("swiotlb: Add swiotlb=noforce debug option")
If these are not suitable for stable (too big, new feature), we can just drop the arm64 commit from 4.9-stable (and we could fix it in a different way).
Signature · 1 line
Catalin
Greg KH
maintainerQuoted 78 lines · Catalin Marinas
Quoted 77 lines · Geert Uytterhoeven
Quoted 68 lines · On Mon, Jan 23, 2017 at 5:02 PM, <[email protected]> wrote:
This is a note to let you know that I've just added the patch titled
arm64: Fix swiotlb fallback allocation
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summaryThe filename of the patch is:
arm64-fix-swiotlb-fallback-allocation.patch
and it can be found in the queue-4.9 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From
524dabe1c68e0bca25ce7b108099e5d89472a101Mon Sep 17 00:00:00 2001
From: Alexander Graf <[email protected]>
Date: Mon, 16 Jan 2017 12:46:33 +0100
Subject: arm64: Fix swiotlb fallback allocationFrom: Alexander Graf <[email protected]>
commit
524dabe1c68e0bca25ce7b108099e5d89472a101upstream.Commit
b67a8b29dfintroduced logic to skip swiotlb allocation when all memory is DMA accessible anyway.While this is a great idea,
__dma_allocstill calls swiotlb code unconditionally to allocate memory when there is no CMA memory available. The swiotlb code is called to ensure that we at least tryget_free_pages().Without initialization, swiotlb allocation code tries to access
io_tlb_listwhich is NULL. That results in a stack trace like this:Unable to handle kernel NULL pointer dereference at virtual address 00000000 [...] [<ffff00000845b908>] swiotlb_tbl_map_single+0xd0/0x2b0 [<ffff00000845be94>] swiotlb_alloc_coherent+0x10c/0x198 [<ffff000008099dc0>] __dma_alloc+0x68/0x1a8 [<ffff000000a1b410>] drm_gem_cma_create+0x98/0x108 [drm] [<ffff000000abcaac>] drm_fbdev_cma_create_with_funcs+0xbc/0x368 [drm_kms_helper] [<ffff000000abcd84>] drm_fbdev_cma_create+0x2c/0x40 [drm_kms_helper] [<ffff000000abc040>] drm_fb_helper_initial_config+0x238/0x410 [drm_kms_helper] [<ffff000000abce88>] drm_fbdev_cma_init_with_funcs+0x98/0x160 [drm_kms_helper] [<ffff000000abcf90>] drm_fbdev_cma_init+0x40/0x58 [drm_kms_helper] [<ffff000000b47980>] vc4_kms_load+0x90/0xf0 [vc4] [<ffff000000b46a94>] vc4_drm_bind+0xec/0x168 [vc4] [...]Thankfully swiotlb code just learned how to not do allocations with the
FORCE_NOoption. This patch configures the swiotlb code to use that if we decide not to initialize the swiotlb framework.Fixes b67a8b29df ("arm64: mm: only initialize swiotlb when necessary")Signed-off-by Alexander Graf <[email protected]>CC Jisheng Zhang <[email protected]>CC Geert Uytterhoeven <[email protected]>CC Konrad Rzeszutek Wilk <[email protected]>Signed-off-by Catalin Marinas <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/arm64/mm/init.c | 2 ++ 1 file changed, 2 insertions(+)arch/arm64/mm/init.c void __init mem_init(void) · line 407
Quoted 5 lines
arch/arm64/mm/init.c +2
-0@@ -403,6 +403,8 @@ void __init mem_init(void) {if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >>PAGE_SHIFT ))swiotlb_init (1 ); +else + swiotlb_force =SWIOTLB_NO_FORCE ;The above definition depends on:
Quoted 6 lines
Quoted 2 lines
commit
ae7871be189cb411("swiotlb: Convertswiotlb_forcefrom int to enum") commitfff5d99225107f5f("swiotlb: Add swiotlb=noforce debug option")If these are not suitable for stable (too big, new feature), we can just drop the arm64 commit from 4.9-stable (and we could fix it in a different way).
Those look fine, I've queued them up now (took a bit of manual work), and will let the autobuilder have fun with it...
thanks,
greg k-h