On 27.08.2024 09:03, Baruch Siach wrote: > On Tue, Aug 27 2024, Marek Szyprowski wrote: >> On 27.08.2024 06:52, Baruch Siach wrote: >>> Hi Marek, >>> >>> Thanks for your report. >>> >>> On Mon, Aug 26 2024, Marek Szyprowski wrote: >>>> On 11.08.2024 09:09, Baruch Siach wrote: >>>>> From: Catalin Marinas <catalin.marinas@xxxxxxx> >>>>> >>>>> Hardware DMA limit might not be power of 2. When RAM range starts above >>>>> 0, say 4GB, DMA limit of 30 bits should end at 5GB. A single high bit >>>>> can not encode this limit. >>>>> >>>>> Use plain address for DMA zone limit. >>>>> >>>>> Since DMA zone can now potentially span beyond 4GB physical limit of >>>>> DMA32, make sure to use DMA zone for GFP_DMA32 allocations in that case. >>>>> >>>>> Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx> >>>>> Co-developed-by: Baruch Siach <baruch@xxxxxxxxxx> >>>>> Signed-off-by: Baruch Siach <baruch@xxxxxxxxxx> >>>>> --- >>>> This patch landed recently in linux-next as commit ba0fb44aed47 >>>> ("dma-mapping: replace zone_dma_bits by zone_dma_limit"). During my >>>> tests I found that it introduces the following warning on ARM64/Rockchip >>>> based Odroid M1 board (arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts): >>> Does this warning go away if you revert both 3be9b846896d and ba0fb44aed47? >> Yes, linux-next with above mentioned commits reverted works fine. >> >> >>> Upstream rockchip DTs have no dma-ranges property. Is that the case for >>> your platform as well? >>> >>> Can you share kernel report of DMA zones and swiotlb? On my platform I get: >>> >>> [ 0.000000] Zone ranges: >>> [ 0.000000] DMA [mem 0x0000000800000000-0x000000083fffffff] >>> [ 0.000000] DMA32 empty >>> [ 0.000000] Normal [mem 0x0000000840000000-0x0000000fffffffff] >>> ... >>> [ 0.000000] software IO TLB: area num 8. >>> [ 0.000000] software IO TLB: mapped [mem 0x000000083be38000-0x000000083fe38000] (64MB) >>> >>> What do you get at your end? >> On ba0fb44aed47 I got: >> >> [ 0.000000] NUMA: No NUMA configuration found >> [ 0.000000] NUMA: Faking a node at [mem >> 0x0000000000200000-0x00000001ffffffff] >> [ 0.000000] NUMA: NODE_DATA [mem 0x1ff7a0600-0x1ff7a2fff] >> [ 0.000000] Zone ranges: >> [ 0.000000] DMA [mem 0x0000000000200000-0x00000001ffffffff] >> [ 0.000000] DMA32 empty >> [ 0.000000] Normal empty >> [ 0.000000] Movable zone start for each node >> [ 0.000000] Early memory node ranges >> [ 0.000000] node 0: [mem 0x0000000000200000-0x00000000083fffff] >> [ 0.000000] node 0: [mem 0x0000000009400000-0x00000000efffffff] >> [ 0.000000] node 0: [mem 0x00000001f0000000-0x00000001ffffffff] >> [ 0.000000] Initmem setup node 0 [mem >> 0x0000000000200000-0x00000001ffffffff] >> [ 0.000000] On node 0, zone DMA: 512 pages in unavailable ranges >> [ 0.000000] On node 0, zone DMA: 4096 pages in unavailable ranges >> [ 0.000000] cma: Reserved 96 MiB at 0x00000001f0000000 on node -1 >> >> ... >> >> [ 0.000000] software IO TLB: SWIOTLB bounce buffer size adjusted to 3MB >> [ 0.000000] software IO TLB: area num 4. >> [ 0.000000] software IO TLB: mapped [mem >> 0x00000001fac00000-0x00000001fb000000] (4MB) >> >> On the fa3c109a6d30 (parent commit of the $subject) I got: >> >> [ 0.000000] NUMA: No NUMA configuration found >> [ 0.000000] NUMA: Faking a node at [mem >> 0x0000000000200000-0x00000001ffffffff] >> [ 0.000000] NUMA: NODE_DATA [mem 0x1ff7a0600-0x1ff7a2fff] >> [ 0.000000] Zone ranges: >> [ 0.000000] DMA [mem 0x0000000000200000-0x00000000ffffffff] >> [ 0.000000] DMA32 empty >> [ 0.000000] Normal [mem 0x0000000100000000-0x00000001ffffffff] >> [ 0.000000] Movable zone start for each node >> [ 0.000000] Early memory node ranges >> [ 0.000000] node 0: [mem 0x0000000000200000-0x00000000083fffff] >> [ 0.000000] node 0: [mem 0x0000000009400000-0x00000000efffffff] >> [ 0.000000] node 0: [mem 0x00000001f0000000-0x00000001ffffffff] >> [ 0.000000] Initmem setup node 0 [mem >> 0x0000000000200000-0x00000001ffffffff] >> [ 0.000000] On node 0, zone DMA: 512 pages in unavailable ranges >> [ 0.000000] On node 0, zone DMA: 4096 pages in unavailable ranges >> [ 0.000000] cma: Reserved 96 MiB at 0x00000000ea000000 on node -1 >> >> ... >> >> [ 0.000000] software IO TLB: area num 4. >> [ 0.000000] software IO TLB: mapped [mem >> 0x00000000e6000000-0x00000000ea000000] (64MB) >> >> It looks that for some reasons $subject patch changes the default zone >> and swiotlb configuration. > Does this fix the issue? > > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c > index bfb10969cbf0..7fcd0aaa9bb6 100644 > --- a/arch/arm64/mm/init.c > +++ b/arch/arm64/mm/init.c > @@ -116,6 +116,9 @@ static void __init arch_reserve_crashkernel(void) > > static phys_addr_t __init max_zone_phys(phys_addr_t zone_limit) > { > + if (memblock_start_of_DRAM() < U32_MAX) > + zone_limit = min(zone_limit, U32_MAX); > + > return min(zone_limit, memblock_end_of_DRAM() - 1) + 1; > } > Yes, this fixes my issue. Thanks! Fell free to add: Reported-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> Tested-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx> Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland