linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Kondratiev <Vladimir.Kondratiev@mobileye.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Andrew Morton <akpm@linux-foundation.org>,
	"linux-riscv@lists.infradead.org"
	<linux-riscv@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [PATCH] riscv: make ZONE_DMA32 optional
Date: Sun, 22 Sep 2024 10:06:59 +0000	[thread overview]
Message-ID: <VI1PR09MB233391A7544336FBD06303CE946E2@VI1PR09MB2333.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <Zu2A1l_cX36sOVcB@infradead.org>

>On Tue, Aug 27, 2024 at 02:36:11PM +0300, Vladimir Kondratiev wrote:
>> It is not necessary any RISCV platform has ZONE_DMA32.

>That is an odd statement.  The point of ZONE_DMA32 is to make sure
>that drivers can always allocate 32-bit DMAable memory, and without
>ZONE_DMA32 that is very hard to provide unless you always have an
>IOMMU.

This is the whole point - there are platforms where you can't allocate 32-bit
dma-able memory.
Unless there's IOMMU or some platform specific tricks,
DMA address is same as physical address.
In my example, platform has DRAM installed at address 32Gbytes.
32-bit devices would not work on such platform, and attempt to allocate
ZONE_DMA32 memory fails and kernel prints warning as in my original post

>ZONE_DMA32 is supposed to contain the 32-bit dma addressable memory,
>not 32-bit physical.

>Take a look at the changes that just went into Linus' tree for that.

I re-evaluated with Linus's tree as of now (commit 88264981f208), same error reported if I don't apply my patch:

[    0.191514] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic allocations
[    0.191524] swapper/0: page allocation failure: order:7, mode:0xcc4(GFP_KERNEL|GFP_DMA32), nodemask=(null),cpuset=/,mem
s_allowed=0
[    0.191546] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.11.0 #2
[    0.191553] Hardware name: ????  (DT)
[    0.191556] Call Trace:
[    0.191560] [<ffffffff800059bc>] dump_backtrace+0x1c/0x24
[    0.191571] [<ffffffff805d1a3c>] show_stack+0x2c/0x38
[    0.191578] [<ffffffff805dc1e6>] dump_stack_lvl+0x52/0x74
[    0.191584] [<ffffffff805dc21c>] dump_stack+0x14/0x1c
[    0.191589] [<ffffffff801a8eec>] warn_alloc+0xf4/0x180
[    0.191598] [<ffffffff801a98e8>] __alloc_pages_noprof+0x970/0xd94
[    0.191605] [<ffffffff8008d2ae>] atomic_pool_expand+0x62/0x1f8
[    0.191615] [<ffffffff8060d6ae>] __dma_atomic_pool_init+0x46/0x9e
[    0.191620] [<ffffffff8060d79c>] dma_atomic_pool_init+0x96/0x11c
[    0.191626] [<ffffffff80002146>] do_one_initcall+0x5c/0x1b2
[    0.191631] [<ffffffff8060127c>] kernel_init_freeable+0x214/0x274
[    0.191636] [<ffffffff805dd9e4>] kernel_init+0x1e/0x10a
[    0.191644] [<ffffffff805e6eba>] ret_from_fork+0xe/0x1c
[    0.191709] Mem-Info:
[    0.191714] active_anon:0 inactive_anon:0 isolated_anon:0
[    0.191714]  active_file:0 inactive_file:0 isolated_file:0
[    0.191714]  unevictable:0 dirty:0 writeback:0
[    0.191714]  slab_reclaimable:26 slab_unreclaimable:742
[    0.191714]  mapped:0 shmem:0 pagetables:65
[    0.191714]  sec_pagetables:0 bounce:0
[    0.191714]  kernel_misc_reclaimable:0
[    0.191714]  free:1014355 free_pcp:0 free_cma:0
[    0.191727] 0 total pagecache pages
[    0.191730] 1048576 pages RAM
[    0.191733] 0 pages HighMem/MovableOnly
[    0.191735] 30264 pages reserved
[    0.191743] DMA: failed to allocate 496 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocation



  reply	other threads:[~2024-09-22 10:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27 11:36 Vladimir Kondratiev
2024-08-27 23:10 ` Drew Fustini
2024-09-20  8:58   ` Palmer Dabbelt
2024-09-20 13:18     ` Drew Fustini
2024-09-23  9:46       ` Ben Dooks
2024-09-20 14:04 ` Christoph Hellwig
2024-09-22 10:06   ` Vladimir Kondratiev [this message]
2024-09-24  6:39     ` Christoph Hellwig
2024-09-30  9:55 ` Alexandre Ghiti
2024-10-06 10:44   ` Vladimir Kondratiev
2024-10-06 10:55     ` [PATCH v1] " Vladimir Kondratiev
2024-10-06 22:58       ` Drew Fustini
2024-10-07  5:41       ` Christoph Hellwig
2024-10-07  6:17         ` Vladimir Kondratiev
2024-10-07  6:22           ` Christoph Hellwig
2024-10-07 11:39             ` Nick Kossifidis
2024-10-07 13:03             ` Vladimir Kondratiev
2024-10-07 12:17     ` [PATCH] " Ben Dooks

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=VI1PR09MB233391A7544336FBD06303CE946E2@VI1PR09MB2333.eurprd09.prod.outlook.com \
    --to=vladimir.kondratiev@mobileye.com \
    --cc=akpm@linux-foundation.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox