mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Wandun <chenwandun1@gmail.com>,
	linux-mm@kvack.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Mike Rapoport <rppt@kernel.org>, Rob Herring <robh@kernel.org>,
	Saravana Kannan <saravanak@kernel.org>,
	Oreoluwa Babatunde <oreoluwa.babatunde@oss.qualcomm.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2 2/2] of: reserved_mem: allocate and map the reserved_mem array early
Date: Wed, 14 Oct 2026 10:04:52 +0200	[thread overview]
Message-ID: <15f70a45-a754-488c-8ba3-9e63bb956033@samsung.com> (raw)
In-Reply-To: <42cdc3f4-95f7-4efa-be23-b3fafae84109@gmail.com>

On 10.10.2026 08:40, Wandun wrote:
> On 10/9/26 19:27, Marek Szyprowski wrote:
>> On 09.10.2026 04:16, Wandun wrote:
>>> On 10/8/26 23:24, Marek Szyprowski wrote:
>>>> Get rid of the static, limited-size reserved_mem array and replace it
>>>> with array allocated by memblock_alloc_raw() and accessed through a
>>>> temporary early_memremap() mapping. Such mapping is needed for some
>>>> architectures (like ARM64), where linear map is not yet available during
>>>> early boot scan. Having a single, writeable array with all reserved
>>>> regions removes the need to perform two step initialization introduced
>>>> by commit 8a6e02d0c00e ("of: reserved_mem: Restructure how the reserved
>>>> memory regions are processed"), so all regions can be processed
>>>> directly during the early scan again.
>>> One concern about the ordering here: the new memblock_alloc_raw() for the
>>> reserved_mem array runs *before* the static ("reg") regions are reserved,
>>> so the array can be allocated from inside one of them which makes the
>>> subsequent static region reservation fail.
>> Well, that's what Sashiko already reported. It will be trivial to process
>> 'static' regions before doing the reserved_mem allocation, but this in turn
>> returns us to the point of not being able to handle their reservation
>> failures. I wonder what's worse...
> Indeed, every option has its pros and cons.
>
> Could we reconsider the approach from my v2 series [1]:
> record the nodes whose early reservation failed in an reserve_failed_nodes
> array, and have the late scan skip them.
>
> As I understand it, this handles the vast majority of cases. And if
> the number of failed nodes exceeds the reserve_failed_nodes array size,
> the system is already misbehaving and the DTS configuration itself
> needs to be revisited; even in that case, the v2 approach behaves exactly
> the same as the current code, so nothing gets worse.
Frankly speaking I would only keep the information if any of the early reservation
failed or not and just print information that "Early reservation of some memory
regions failed - system might be unstable, please fix Your device-tree". I see no
point over-engineering this more for no visible benefit.

I will send v3 of this patchset with such assumption.
> Also, IIUC, setting a memblock flag may split memblock regions, and since
> memblock cannot resize before paging_init(), that would increase the chance
> of a panic.
The memblock flags are already set for each reserved region, so adding one more
flags probably won't increase significantly the number of memblock entries.
Adjacent regions with same flags are already being merged by the memblock layer,
so many adjacent reserved regions might be covered by a single memblock entry.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


  reply	other threads:[~2026-10-14  8:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261008152449eucas1p29758be26c325084093c14cfa9b8b2d04@eucas1p2.samsung.com>
2026-10-08 15:23 ` [PATCH v2 0/2] of: reserved_mem: use dynamically allocated reserved_mem array Marek Szyprowski
     [not found]   ` <CGME20261008152450eucas1p18776bd3641d591541c75f768295d79a8@eucas1p1.samsung.com>
2026-10-08 15:24     ` [PATCH v2 1/2] of: reserved_mem: group allocation helpers together Marek Szyprowski
     [not found]   ` <CGME20261008152450eucas1p1d5517eadc2c1d684ff6d4ddc010f6331@eucas1p1.samsung.com>
2026-10-08 15:24     ` [PATCH v2 2/2] of: reserved_mem: allocate and map the reserved_mem array early Marek Szyprowski
2026-10-09  2:16       ` Wandun
2026-10-09 11:27         ` Marek Szyprowski
2026-10-10  6:40           ` Wandun
2026-10-14  8:04             ` Marek Szyprowski [this message]
2026-10-09  5:20       ` kernel test robot
2026-10-10  1:49       ` kernel test robot

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=15f70a45-a754-488c-8ba3-9e63bb956033@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=chenwandun1@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oreoluwa.babatunde@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=rppt@kernel.org \
    --cc=saravanak@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®