From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
To: Oreoluwa Babatunde <quic_obabatun@quicinc.com>,
ysato@users.sourceforge.jp, dalias@libc.org
Cc: akpm@linux-foundation.org, linux-sh@vger.kernel.org,
linux-kernel@vger.kernel.org, robh+dt@kernel.org,
kernel@quicinc.com, Rob Herring <robh@kernel.org>,
Rob Landley <rob@landley.net>
Subject: Re: [PATCH v2] sh: Call paging_init() earlier in the init sequence
Date: Thu, 02 May 2024 12:29:47 +0200 [thread overview]
Message-ID: <b00e0adc72815e465cf32fc5505445cfceeeca84.camel@physik.fu-berlin.de> (raw)
In-Reply-To: <72ec7831604326e852eb228072b1d817bab829fb.camel@physik.fu-berlin.de>
Hi Oreoluwa,
On Wed, 2024-05-01 at 19:18 +0200, John Paul Adrian Glaubitz wrote:
> Hi Oreoluwa,
>
> On Tue, 2024-04-23 at 16:31 -0700, Oreoluwa Babatunde wrote:
> > The unflatten_device_tree() function contains a call to
> > memblock_alloc(). This is a problem because this allocation is done
> > before any of the reserved memory is set aside in paging_init().
> > This means that there is a possibility for memblock to allocate from
> > any of the memory regions that are supposed to be set aside as reserved.
> >
> > Hence, move the call to paging_init() to be earlier in the init
> > sequence so that the reserved memory regions are set aside before any
> > allocations are done using memblock.
>
> I was just about to merge your patch when I ran a git blame on the code in
> arch/sh/kernel/setup.c and noticed the following commit by Rich Felker:
>
> commit eb6b6930a70faefe04479a71088cc10366782d9a
> Author: Rich Felker <dalias@libc.org>
> Date: Mon Jul 31 01:27:50 2017 -0400
>
> sh: fix memory corruption of unflattened device tree
>
> unflatten_device_tree() makes use of memblock allocation, and
> therefore must be called before paging_init() migrates the memblock
> allocation data to the bootmem framework. Otherwise the record of the
> allocation for the expanded device tree will be lost, and will
> eventually be clobbered when allocated for another use.
>
> Signed-off-by: Rich Felker <dalias@libc.org>
>
> It looks like that the call to unflatten_device_tree() before paging_init()
> is intentional and needed for the device tree to be preserved in memory
> after running paging_init().
>
> @Geert: Do you have any comments on this patch?
> @Rob: Could you test this patch on your J2 board and report back?
I'm skipping this patch for v6.10 now for the aforementioned reasons.
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
next prev parent reply other threads:[~2024-05-02 10:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 23:31 Oreoluwa Babatunde
2024-04-24 4:47 ` John Paul Adrian Glaubitz
2024-04-24 8:45 ` Markus Elfring
2024-04-24 10:24 ` John Paul Adrian Glaubitz
2024-04-24 11:06 ` [v2] " Markus Elfring
2024-04-29 9:03 ` [PATCH v2] " John Paul Adrian Glaubitz
2024-04-29 16:28 ` Oreoluwa Babatunde
2024-04-29 17:26 ` John Paul Adrian Glaubitz
2024-04-29 17:54 ` Oreoluwa Babatunde
2024-05-01 17:18 ` John Paul Adrian Glaubitz
2024-05-02 10:29 ` John Paul Adrian Glaubitz [this message]
2024-05-07 21:42 ` Oreoluwa Babatunde
2024-05-07 22:41 ` John Paul Adrian Glaubitz
2024-05-20 18:03 ` Oreoluwa Babatunde
2024-05-20 18:24 ` John Paul Adrian Glaubitz
2024-05-20 18:49 ` Oreoluwa Babatunde
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=b00e0adc72815e465cf32fc5505445cfceeeca84.camel@physik.fu-berlin.de \
--to=glaubitz@physik.fu-berlin.de \
--cc=akpm@linux-foundation.org \
--cc=dalias@libc.org \
--cc=kernel@quicinc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=quic_obabatun@quicinc.com \
--cc=rob@landley.net \
--cc=robh+dt@kernel.org \
--cc=robh@kernel.org \
--cc=ysato@users.sourceforge.jp \
/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®