All of lore.kernel.org
 help / color / mirror / Atom feed
From: atish.patra@wdc.com (Atish Patra)
To: linux-riscv@lists.infradead.org
Subject: Memory allocation failure using GFP_DMA32 in 4.19-rc2
Date: Mon, 10 Sep 2018 18:13:07 -0700	[thread overview]
Message-ID: <de897a8b-4961-247e-e90c-c5132bddf125@wdc.com> (raw)
In-Reply-To: <20180910135231.GA19320@infradead.org>

On 9/10/18 6:52 AM, Christoph Hellwig wrote:
> On Fri, Sep 07, 2018 at 02:50:52PM -0700, Atish Patra wrote:
>> Hi,
>> I got Radeon HD6450 GPU with Microsemi expansion board working on 4.17
>> kernel + all required out of tree patches (drivers/dma). However, I moved to
>> 4.19-rc2 and faces following error. It seems that kernel couldn't allocate
>> memory using GFP_DMA32. Other than this, kernel can boot and even detect
>> SATA devices.
> 
> Please take a look at /proc/zoneinfo how much memory there is in
> ZONE_DMA32.  Or send the file out if it looks too confusing.
> 
>>
>> | * | 1847e725 DMA cleanups (by Palmer Dabbelt 5 months ago)
>> | * | ee247f86 riscv: support for broken PCIe controllers (by Wesley W.
>> Terpstra 6 months ago)
>> | * | 9b994793 riscv: add DMA mappings suitable for a pure 64-bit system (by
>> Palmer Dabbelt 7 months ago)
>>
>> Any suggestions/pointers what might be wrong ?
> 
> None of the above should be needed for mainline.  Also try without them.
> 

I found the issue. /proc/zoneinfo did not report any available memory 
for DMA32 as there was no memory zone allocated for DMA32 during 
setup_bootmem().

Relevant dmesg output (with additional debug message)

[    0.000000] zone_sizes_init: DMA32 zone 0x280 nrmal zone 0x280000
[    0.000000] free_area_init_nodes: start pfn [0x80200]
[    0.000000] free_area_init_nodes: end pfn [0x80200] for zone = [DMA32   ]
[    0.000000] free_area_init_nodes: end pfn [0x280000] for zone = 
[Normal  ]
[    0.000000] Zone ranges:
[    0.000000]   DMA32    empty
[    0.000000]   Normal   [mem 0x0000000080200000-0x000000027fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080200000-0x000000027fffffff]
[    0.000000] Initmem setup node 0 [mem 
0x0000000080200000-0x000000027fffffff]

The above issue can be fixed by your patch which was present in one of 
the wip-dma branch.

https://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux.git/commit/?h=wip-dma&id=004baee3b83c7ce1c70ff0b7a15fbc3946278af4

diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index f0d2070866d4..df3d0159f73b 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -172,7 +172,7 @@ static void __init setup_bootmem(void)
  	BUG_ON(mem_size == 0);

  	set_max_mapnr(PFN_DOWN(mem_size));
-	max_low_pfn = pfn_base + PFN_DOWN(mem_size);
+	max_low_pfn = memblock_end_of_DRAM();

  #ifdef CONFIG_BLK_DEV_INITRD
  	setup_initrd();

However, the 4.19-rc2 kernel merged following patch from you. Strangely, 
both patches had exact same commit text and commit date but completely 
different code.

https://groups.google.com/a/groups.riscv.org/forum/#!topic/patches/7frysy0xc6g

I am not sure if both are required or the 1st one was never meant to be 
be merged but that one solves the problem at hand. Perhaps, the issue 
can be fixed in a different way ?

Regards
Atish

  reply	other threads:[~2018-09-11  1:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-07 21:50 Memory allocation failure using GFP_DMA32 in 4.19-rc2 Atish Patra
2018-09-10 13:52 ` Christoph Hellwig
2018-09-11  1:13   ` Atish Patra [this message]
2018-09-11  6:16     ` Christoph Hellwig
2018-09-11 18:31       ` Atish Patra
2018-09-20  5:26       ` Palmer Dabbelt
2018-09-20  5:53         ` Atish Patra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=de897a8b-4961-247e-e90c-c5132bddf125@wdc.com \
    --to=atish.patra@wdc.com \
    --cc=linux-riscv@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.