linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* + arm-move-arm_dma_limit-to-setup_dma_zone.patch added to -mm tree
       [not found] <CAKv+Gu_QCJn5UGyM4zEPLvkTPMnfwTM2qKYnBU42vEPwwt6-Dg@mail.gmail.com>
@ 2014-05-19 19:51 ` Andrew Morton
  2014-05-21  6:50 ` Vladimir Murzin
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2014-05-19 19:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, 18 May 2014 22:49:16 -0700 Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:

> Gents,
> 
> I noticed this patch turning up in -next:
> http://ozlabs.org/~akpm/mmots/broken-out/arm-move-arm_dma_limit-to-setup_dma_zone.patch
> 
> which I think is incorrect. More specifically, it replaces a reference
> to arm_dma_limit, which is defined as either
> 
> arch/arm/mm/init.c:177:         arm_dma_limit = PHYS_OFFSET +
> arm_dma_zone_size - 1;
> 
> or
> 
> arch/arm/mm/init.c:179:         arm_dma_limit = 0xffffffff;
> 
> with 'arm_dma_pfn_limit << PAGE_SHIFT', which means the bottom
> PAGE_SHIFT '1' bytes are lost.

That patch has been floating about in "stuck" state for months.

I think I'll drop it.  Vladimir, please resend something if you think
it still should be addressed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* + arm-move-arm_dma_limit-to-setup_dma_zone.patch added to -mm tree
       [not found] <CAKv+Gu_QCJn5UGyM4zEPLvkTPMnfwTM2qKYnBU42vEPwwt6-Dg@mail.gmail.com>
  2014-05-19 19:51 ` + arm-move-arm_dma_limit-to-setup_dma_zone.patch added to -mm tree Andrew Morton
@ 2014-05-21  6:50 ` Vladimir Murzin
  2014-05-21 10:56   ` Ard Biesheuvel
  1 sibling, 1 reply; 3+ messages in thread
From: Vladimir Murzin @ 2014-05-21  6:50 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Ard

On 5/19/14, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> Gents,
>
> I noticed this patch turning up in -next:
> http://ozlabs.org/~akpm/mmots/broken-out/arm-move-arm_dma_limit-to-setup_dma_zone.patch
>
> which I think is incorrect. More specifically, it replaces a reference
> to arm_dma_limit, which is defined as either
>
> arch/arm/mm/init.c:177:         arm_dma_limit = PHYS_OFFSET +
> arm_dma_zone_size - 1;
>
> or
>
> arch/arm/mm/init.c:179:         arm_dma_limit = 0xffffffff;
>
> with 'arm_dma_pfn_limit << PAGE_SHIFT', which means the bottom
> PAGE_SHIFT '1' bytes are lost.
>

Do not we lost even more with
dma_contiguous_reserve
     dma_contiguous_reserve_area
...
        /* Sanitise input arguments */
        alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
        base = ALIGN(base, alignment);
        size = ALIGN(size, alignment);
        limit &= ~(alignment - 1);

Vladimir

> Relevant part of patch quoted below.
>
> Regards,
> Ard.
>
>
>
>
> diff -puN arch/arm/mm/init.c~arm-move-arm_dma_limit-to-setup_dma_zone
> arch/arm/mm/init.c
> --- a/arch/arm/mm/init.c~arm-move-arm_dma_limit-to-setup_dma_zone
> +++ a/arch/arm/mm/init.c
> @@ -328,7 +329,8 @@ void __init arm_memblock_init(struct mem
>   * reserve memory for DMA contigouos allocations,
>   * must come from DMA area inside low memory
>   */
> - dma_contiguous_reserve(min(arm_dma_limit, arm_lowmem_limit));
> +
(min((phys_addr_t)arm_dma_pfn_limit << PAGE_SHIFT,
> +   arm_lowmem_limit));
>
>   arm_memblock_steal_permitted = false;
>   memblock_dump_all();
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* + arm-move-arm_dma_limit-to-setup_dma_zone.patch added to -mm tree
  2014-05-21  6:50 ` Vladimir Murzin
@ 2014-05-21 10:56   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2014-05-21 10:56 UTC (permalink / raw)
  To: linux-arm-kernel

On 21 May 2014 08:50, Vladimir Murzin <murzin.v@gmail.com> wrote:
> Hi Ard
>
> On 5/19/14, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>> Gents,
>>
>> I noticed this patch turning up in -next:
>> http://ozlabs.org/~akpm/mmots/broken-out/arm-move-arm_dma_limit-to-setup_dma_zone.patch
>>
>> which I think is incorrect. More specifically, it replaces a reference
>> to arm_dma_limit, which is defined as either
>>
>> arch/arm/mm/init.c:177:         arm_dma_limit = PHYS_OFFSET +
>> arm_dma_zone_size - 1;
>>
>> or
>>
>> arch/arm/mm/init.c:179:         arm_dma_limit = 0xffffffff;
>>
>> with 'arm_dma_pfn_limit << PAGE_SHIFT', which means the bottom
>> PAGE_SHIFT '1' bytes are lost.
>>
>
> Do not we lost even more with
> dma_contiguous_reserve
>      dma_contiguous_reserve_area
> ...
>         /* Sanitise input arguments */
>         alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
>         base = ALIGN(base, alignment);
>         size = ALIGN(size, alignment);
>         limit &= ~(alignment - 1);
>

That's interesting. It looks like there may be a mismatch here: we
pass an inclusive limit where the callee expects it to be exclusive,
resulting in the top 4 megabytes of the DMA zone to be lost (for
pageblock_order == MAX_ORDER-1). I.e., if arm_dma_zone == SZ_64M, we
will end up calling __memblock_alloc_base() with a limit of 60 megs.

@Russell: care to share your thought on this?

-- 
Ard.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-21 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAKv+Gu_QCJn5UGyM4zEPLvkTPMnfwTM2qKYnBU42vEPwwt6-Dg@mail.gmail.com>
2014-05-19 19:51 ` + arm-move-arm_dma_limit-to-setup_dma_zone.patch added to -mm tree Andrew Morton
2014-05-21  6:50 ` Vladimir Murzin
2014-05-21 10:56   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).