From: Yang Shi <yang@os.amperecomputing.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
Robin Murphy <robin.murphy@arm.com>
Cc: Baruch Siach <baruch@tkos.co.il>,
will@kernel.org, ptesarik@suse.com, hch@lst.de,
jiangyutang@os.amperecomputing.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: mm: fix zone_dma_limit calculation
Date: Mon, 2 Dec 2024 08:41:08 -0800 [thread overview]
Message-ID: <c1b5a5de-94b0-4b27-a597-a34e84c3ef08@os.amperecomputing.com> (raw)
In-Reply-To: <Z0oYMXMGYgXoyon7@arm.com>
On 11/29/24 11:38 AM, Catalin Marinas wrote:
> On Fri, Nov 29, 2024 at 06:06:50PM +0000, Robin Murphy wrote:
>> On 2024-11-27 5:49 pm, Catalin Marinas wrote:
>>> If IORT or DT indicate a large mask covering the whole RAM (i.e. no
>>> restrictions), in an ideal world, we should normally extend ZONE_DMA to
>>> the same.
>> That's not right, ZONE_DMA should still be relatively limited in size
>> (unless we really do only have a tiny amount of RAM) - just because a DT
>> dma-ranges property says the system interconnect can carry >32 address bits
>> in general doesn't mean that individual device DMA masks can't still be
>> 32-bit or smaller. IIRC we're still implicitly assuming that if DT does
>> describe an offset range into "high" RAM, it must represent a suitable
>> lowest common denominator for all relevant devices already, and therefore we
>> can get away with sizing ZONE_DMA off it blindly.
> Fine by me to keep ZONE_DMA in the low range always. I was thinking of
> only doing this if ZONE_DMA32 is enabled.
>
>> After staring at it for long enough, I think $SUBJECT patch is actually
>> correct as it is.
> Thanks Robin for having a look. Can I add your reviewed-by?
>
>> In fact I'm now wondering why the fix was put inside
>> max_zone_phys() in the first place, since it's clearly pointless to clamp
>> DMA_BIT_MASK(32) to U32_MAX in the dma32_phys_limit case...
> I came to the same conclusion. I think it might have been some left-over
> from when we had a ZONE_DMA32 in the above 4GB (AMD Seattle?). Than we
> changed it a few times but only focused on this function for setting the
> limits.
>
>> However the commit message is perhaps not as clear as it could be -
>> technically we are correctly *calculating* the appropriate effective
>> zone_dma_limt value within the scope of zone_sizes_init(), we're just
>> failing to properly update the actual zone_dma_limit variable for the
>> benefit of other users.
> I'll have a look next week at rewriting the commit message, unless Yang
> does it first. I'm planning to queue this patch for -rc2.
Hi Catalin and Robin,
Thanks for moving this forward.
How's about the below commit message?
We failed to properly update the actual zone_dma_limit variable. Now it is
the memsize limit in IORT or device tree instead of U32_MAX if the
memsize limit
is greater than U32_MAX.
The zone_dma_limit is used to determine whether GFP_DMA should be used
or not
when allocating DMA buffers. The wrong zone_dma_limit resulted in DMA
allocations
use GFP_DMA even though the devices don't require it then fall into DMA
zone on
node 0. It caused regression on our two sockets systems due to
excessive remote
memory access.
>
next prev parent reply other threads:[~2024-12-02 16:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 17:16 Yang Shi
2024-11-26 6:27 ` Baruch Siach
2024-11-26 17:38 ` Yang Shi
2024-11-27 17:49 ` Catalin Marinas
2024-11-29 18:06 ` Robin Murphy
2024-11-29 19:38 ` Catalin Marinas
2024-12-02 16:41 ` Yang Shi [this message]
2024-12-03 21:20 ` Catalin Marinas
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=c1b5a5de-94b0-4b27-a597-a34e84c3ef08@os.amperecomputing.com \
--to=yang@os.amperecomputing.com \
--cc=baruch@tkos.co.il \
--cc=catalin.marinas@arm.com \
--cc=hch@lst.de \
--cc=jiangyutang@os.amperecomputing.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ptesarik@suse.com \
--cc=robin.murphy@arm.com \
--cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®