linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Oreoluwa Babatunde <oreoluwa.babatunde@oss.qualcomm.com>,
	ye.li@oss.nxp.com,  kernel@oss.qualcomm.com,
	saravanak@google.com, akpm@linux-foundation.org,
	 david@redhat.com, lorenzo.stoakes@oracle.com,
	Liam.Howlett@oracle.com,  vbabka@suse.cz, rppt@kernel.org,
	surenb@google.com, mhocko@suse.com,  robin.murphy@arm.com,
	devicetree@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, iommu@lists.linux.dev,
	 quic_c_gdjako@quicinc.com
Subject: Re: [PATCH] of: reserved_mem: Allow reserved_mem framework detect "cma=" kernel param
Date: Thu, 18 Dec 2025 08:42:43 -0600	[thread overview]
Message-ID: <CAL_JsqK5QEZfyRTDY4z88mX_eYENibea1ZM8H_bEfCCsOOwY4A@mail.gmail.com> (raw)
In-Reply-To: <99dc91c9-59fd-47c5-b1d9-157bda86ad59@samsung.com>

On Thu, Dec 18, 2025 at 3:55 AM Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
>
> On 10.12.2025 15:07, Rob Herring wrote:
> > On Tue, Dec 9, 2025 at 6:20 PM Oreoluwa Babatunde
> > <oreoluwa.babatunde@oss.qualcomm.com> wrote:
> >> When initializing the default cma region, the "cma=" kernel parameter
> >> takes priority over a DT defined linux,cma-default region. Hence, give
> >> the reserved_mem framework the ability to detect this so that the DT
> >> defined cma region can skip initialization accordingly.
> > Please explain here why this is a new problem. Presumably the
> > RESERVEDMEM_OF_DECLARE hook after commit xxxx gets called before the
> > early_param hook. And why is it now earlier?
> >
> > I don't really like the state/ordering having to be worried about in 2 places.
>
> I also don't like this spaghetti, but it originates from
> commit 8a6e02d0c00e ("of: reserved_mem: Restructure how the reserved
> memory regions are processed") and the first fixup for it: 2c223f7239f3
> ("of: reserved_mem: Restructure call site for
> dma_contiguous_early_fixup()").

Honestly, this code wasn't great before. Every time it is touched it
breaks someone.

> It looks that it is really hard to make reserved memory
> initialization fully dynamic assuming that the cma related fixups have
> to be known before populating kernel memory pages tables. I also advised
> in
> https://lore.kernel.org/all/be70bdc4-bddd-4afe-8574-7e0889fd381c@samsung.com/
> to simply increase the size of the static table to make it large enough for the sane use cases, but
> it turned out that this approach was already discussed and rejected:
> https://lore.kernel.org/all/1650488954-26662-1-git-send-email-quic_pdaly@quicinc.com/

I guess the question is what's a sane limit? After 128, are we going
to accept 256? I really suspect we are just enabling some further
abuse of /reserved-memory downstream. For example, I could imagine
there's micromanaging the location of media/graphics buffers so they
end up in specific DRAM banks to optimize accesses. No one ever wants
to detail why they want/need more regions.

> Maybe it would make sense to revert the mentioned changes and get back
> to such simple approach - to make the size of the static table
> configurable in the Kconfig?

I'd rather not resort to a kconfig option.

We could go back to processing all the regions at the beginning
(growing the static size), and then just shrinking allocation. Or
maybe it could just be freed entirely. I don't think we really need to
keep the state around forever.

Rob


      reply	other threads:[~2025-12-18 14:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20251210002053eucas1p1d1408ad0fb49a49bf4371687f8df7395@eucas1p1.samsung.com>
2025-12-10  0:20 ` Oreoluwa Babatunde
2025-12-10 14:07   ` Rob Herring
2025-12-16 22:21     ` Oreoluwa Babatunde
2025-12-12 11:19   ` kernel test robot
2025-12-12 11:19   ` kernel test robot
2025-12-16  3:09   ` Joy Zou
     [not found]   ` <X-TH#1.CAL_JsqL6VVQ7K_ZAbHJ8Gb7ei_jusLx6wRn=AdOVgV50dX0ejQ@mail.gmail.com>
2025-12-18  9:55     ` Marek Szyprowski
2025-12-18 14:42       ` Rob Herring [this message]

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=CAL_JsqK5QEZfyRTDY4z88mX_eYENibea1ZM8H_bEfCCsOOwY4A@mail.gmail.com \
    --to=robh@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=devicetree@vger.kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=kernel@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=m.szyprowski@samsung.com \
    --cc=mhocko@suse.com \
    --cc=oreoluwa.babatunde@oss.qualcomm.com \
    --cc=quic_c_gdjako@quicinc.com \
    --cc=robin.murphy@arm.com \
    --cc=rppt@kernel.org \
    --cc=saravanak@google.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=ye.li@oss.nxp.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