ARM_LPAE + VMSPLIT_2G cause swiotlb warning on Raspberry Pi 4

Stefan Wahren stefan.wahren at i2se.com
Wed May 17 03:40:55 PDT 2023


Hi Arnd,

Am 17.05.23 um 09:37 schrieb Arnd Bergmann:
> On Tue, May 16, 2023, at 22:46, Stefan Wahren wrote:
>> Hi,
>> today i wanted to test the new arm/multi_v7_lpae_defconfig on my
>> Raspberry Pi 4 8GB with Linux 6.4-rc2, but it fails everytime to boot
>> properly from SD card:
> 
>> [    1.435024]  warn_slowpath_fmt from swiotlb_map+0x328/0x330
>> [    1.435062]  swiotlb_map from dma_map_page_attrs+0x204/0x328
>> [    1.435100]  dma_map_page_attrs from bcm2835_dma_probe+0x1d8/0x41c
>> [    1.435141]  bcm2835_dma_probe from platform_probe+0x5c/0xbc
> ...
>> So i went back to 6.3, 6.2, 6.1 & 5.15 (enabling the config options
>> manually on top of multi_v7_defconfig), but it shows the same broken
>> behavior.
>>
>> If i switch back to VMSPLIT_3G and keep ARM_LPAE, the system boots
>> properly from SD card.
>>
>> Any ideas what's the issue here or how to investigate further?
> 
> I haven't found the exact problem, but I looked at this and have some
> observations that may help in narrowing it down further:
> 
> - the bcm2835_dma_probe() maps the zero page only to detect and
>    optimize DMA from zero page, failing to map this would not need
>    to be a fatal error here if we can just skip the optimization
> 
> - apparently the zero page here is above the 1GB boundary, which
>    leads to the swiotlb-map call instead of just returning the
>    direct-mapped DMA address. If the zero page is swiotlb translated,
>    the optimization in the dma driver becomes pointless, and
>    other bits are likely also slowed down
> 
> - I suspect that allocating the zero page from low memory would
>    avoid the problem and generally help here, but we still need to
>    understand the rest of the problem. Does this patch avoid the
>    problem?
> --- a/arch/arm/mm/mmu.c
> +++ b/arch/arm/mm/mmu.c
>   @@ -1783,7 +1783,7 @@ void __init paging_init(const struct machine_desc *mdesc)
>          top_pmd = pmd_off_k(0xffff0000);
>   
>          /* allocate the zero page. */
> -       zero_page = early_alloc(PAGE_SIZE);
> +       zero_page = memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
>   
>          bootmem_init();
>

i tried this with ARM_LPAE + VMSPLIT_2G, but i don't see any changes. 
The warnings are still there and the DMA driver still fails:

[    1.420969] ------------[ cut here ]------------
[    1.420994] WARNING: CPU: 2 PID: 1 at include/linux/dma-direct.h:36 
dma_map_page_attrs+0x360/0x368
[    1.421044] Unable to xlate: 0x000000006ffd9000
[    1.421061] Modules linked in:
[    1.421083] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 6.3.0-dirty #12
[    1.421108] Hardware name: BCM2711
[    1.421132]  unwind_backtrace from show_stack+0x10/0x14
[    1.421172]  show_stack from dump_stack_lvl+0x40/0x4c
[    1.421213]  dump_stack_lvl from __warn+0x7c/0x124
[    1.421259]  __warn from warn_slowpath_fmt+0x118/0x174
[    1.421304]  warn_slowpath_fmt from dma_map_page_attrs+0x360/0x368
[    1.421351]  dma_map_page_attrs from bcm2835_dma_probe+0x1d8/0x41c
[    1.421397]  bcm2835_dma_probe from platform_probe+0x5c/0xbc
[    1.421443]  platform_probe from really_probe+0xc8/0x2dc
[    1.421480]  really_probe from __driver_probe_device+0x84/0xe4
[    1.421514]  __driver_probe_device from driver_probe_device+0x30/0x104
[    1.421549]  driver_probe_device from __driver_attach+0x90/0x174
[    1.421582]  __driver_attach from bus_for_each_dev+0x6c/0xb4
[    1.421614]  bus_for_each_dev from bus_add_driver+0xcc/0x1cc
[    1.421644]  bus_add_driver from driver_register+0x7c/0x118
[    1.421677]  driver_register from do_one_initcall+0x40/0x1e0
[    1.421713]  do_one_initcall from kernel_init_freeable+0x1b8/0x220
[    1.421758]  kernel_init_freeable from kernel_init+0x18/0x12c
[    1.421806]  kernel_init from ret_from_fork+0x14/0x1c
[    1.421841] Exception stack(0xf081dfb0 to 0xf081dff8)
[    1.421862] dfa0:                                     00000000 
00000000 00000000 00000000
[    1.421887] dfc0: 00000000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000
[    1.421911] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    1.421929] ---[ end trace 0000000000000000 ]---
[    1.421948] ------------[ cut here ]------------
[    1.421963] WARNING: CPU: 2 PID: 1 at include/linux/dma-direct.h:36 
swiotlb_map+0x1dc/0x3e4
[    1.422006] Unable to xlate: 0x000000006ffd9000
[    1.422022] Modules linked in:
[    1.422041] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G        W 
  6.3.0-dirty #12
[    1.422068] Hardware name: BCM2711
[    1.422085]  unwind_backtrace from show_stack+0x10/0x14
[    1.422121]  show_stack from dump_stack_lvl+0x40/0x4c
[    1.422156]  dump_stack_lvl from __warn+0x7c/0x124
[    1.422199]  __warn from warn_slowpath_fmt+0x118/0x174
[    1.422244]  warn_slowpath_fmt from swiotlb_map+0x1dc/0x3e4
[    1.422292]  swiotlb_map from dma_map_page_attrs+0x210/0x368
[    1.422336]  dma_map_page_attrs from bcm2835_dma_probe+0x1d8/0x41c
[    1.422379]  bcm2835_dma_probe from platform_probe+0x5c/0xbc
[    1.422421]  platform_probe from really_probe+0xc8/0x2dc
[    1.422458]  really_probe from __driver_probe_device+0x84/0xe4
[    1.422492]  __driver_probe_device from driver_probe_device+0x30/0x104
[    1.422526]  driver_probe_device from __driver_attach+0x90/0x174
[    1.422559]  __driver_attach from bus_for_each_dev+0x6c/0xb4
[    1.422590]  bus_for_each_dev from bus_add_driver+0xcc/0x1cc
[    1.422619]  bus_add_driver from driver_register+0x7c/0x118
[    1.422652]  driver_register from do_one_initcall+0x40/0x1e0
[    1.422687]  do_one_initcall from kernel_init_freeable+0x1b8/0x220
[    1.422729]  kernel_init_freeable from kernel_init+0x18/0x12c
[    1.422777]  kernel_init from ret_from_fork+0x14/0x1c
[    1.422812] Exception stack(0xf081dfb0 to 0xf081dff8)
[    1.422832] dfa0:                                     00000000 
00000000 00000000 00000000
[    1.422857] dfc0: 00000000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000
[    1.422881] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    1.422899] ---[ end trace 0000000000000000 ]---
[    1.422924] ------------[ cut here ]------------
[    1.422939] WARNING: CPU: 2 PID: 1 at kernel/dma/swiotlb.c:896 
swiotlb_map+0x3d0/0x3e4
[    1.422981] bcm2835-dma fe007000.dma: swiotlb addr 
0xffffffffffffffff+4096 overflow (mask ffffffff, bus limit ffffffff).
[    1.423011] Modules linked in:
[    1.423029] CPU: 2 PID: 1 Comm: swapper/0 Tainted: G        W 
  6.3.0-dirty #12
[    1.423055] Hardware name: BCM2711
[    1.423071]  unwind_backtrace from show_stack+0x10/0x14
[    1.423106]  show_stack from dump_stack_lvl+0x40/0x4c
[    1.423141]  dump_stack_lvl from __warn+0x7c/0x124
[    1.423184]  __warn from warn_slowpath_fmt+0x118/0x174
[    1.423228]  warn_slowpath_fmt from swiot0x18/0x12c
[    1.423758]  kernel_init from ret_from_fork+0x14/0x1c
[    1.423793] Exception stack(0xf081dfb0 to 0xf081dff8)
[    1.423812] dfa0:                                     00000000 
00000000 00000000 00000000
[    1.423837] dfc0: 00000000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000
[    1.423861] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    1.423879] ---[ end trace 0000000000000000 ]---
[    1.423898] bcm2835-dma fe007000.dma: Failed to map zero page
[    1.423916] bcm2835-dma: probe of fe007000.dma failed with error -12




More information about the linux-arm-kernel mailing list