From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-mips@vger.kernel.org, rppt@kernel.org,
fancer.lancer@gmail.com, guro@fb.com, akpm@linux-foundation.org,
paul@crapouillou.net,
Serge Semin <Sergey.Semin@baikalelectronics.ru>,
Kamal Dasu <kdasu.kdev@gmail.com>,
Yanteng Si <siyanteng@loongson.cn>,
Huacai Chen <chenhuacai@kernel.org>,
"open list:BROADCOM BMIPS MIPS ARCHITECTURE"
<bcm-kernel-feedback-list@broadcom.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] MIPS: BMIPS: Reserve exception base to prevent corruption
Date: Wed, 3 Mar 2021 10:41:34 +0100 [thread overview]
Message-ID: <20210303094134.GA18354@alpha.franken.de> (raw)
In-Reply-To: <4e3640d4-7fc2-96dc-de00-599b3ac80757@gmail.com>
On Tue, Mar 02, 2021 at 05:30:18PM -0800, Florian Fainelli wrote:
>
>
> On 3/2/2021 3:54 PM, Thomas Bogendoerfer wrote:
> > On Mon, Mar 01, 2021 at 08:19:38PM -0800, Florian Fainelli wrote:
> >> BMIPS is one of the few platforms that do change the exception base.
> >> After commit 2dcb39645441 ("memblock: do not start bottom-up allocations
> >> with kernel_end") we started seeing BMIPS boards fail to boot with the
> >> built-in FDT being corrupted.
> >>
> >> Before the cited commit, early allocations would be in the [kernel_end,
> >> RAM_END] range, but after commit they would be within [RAM_START +
> >> PAGE_SIZE, RAM_END].
> >>
> >> The custom exception base handler that is installed by
> >> bmips_ebase_setup() done for BMIPS5000 CPUs ends-up trampling on the
> >> memory region allocated by unflatten_and_copy_device_tree() thus
> >> corrupting the FDT used by the kernel.
> >>
> >> To fix this, we need to perform an early reservation of the custom
> >> exception that is going to be installed and this needs to happen at
> >> plat_mem_setup() time to ensure that unflatten_and_copy_device_tree()
> >> finds a space that is suitable, away from reserved memory.
> >>
> >> Huge thanks to Serget for analysing and proposing a solution to this
> >> issue.
> >>
> >> Fixes: Fixes: 2dcb39645441 ("memblock: do not start bottom-up allocations with kernel_end")
> >> Debugged-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> >> Reported-by: Kamal Dasu <kdasu.kdev@gmail.com>
> >> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> >> ---
> >> Thomas,
> >>
> >> This is intended as a stop-gap solution for 5.12-rc1 and to be picked up
> >> by the stable team for 5.11. We should find a safer way to avoid these
> >> problems for 5.13 maybe.
> >
> > let's try to make it in one ago. Hwo about reserving vector space in
> > cpu_probe, if it's known there and leave the rest to trap_init() ?
> >
> > Below patch got a quick test on IP22 (real hardware) and malta (qemu).
> > Not sure, if I got all BMIPS parts correct, so please check/test.
>
> Works for me here:
perfect, I only forgot about R3k... I'll submit a formal patch submission
later today.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
next prev parent reply other threads:[~2021-03-03 16:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20201217201214.3414100-1-guro@fb.com>
[not found] ` <20201217201214.3414100-2-guro@fb.com>
[not found] ` <23fc1ef9-7342-8bc2-d184-d898107c52b2@gmail.com>
[not found] ` <20210228090041.GO1447004@kernel.org>
[not found] ` <8cbafe95-0f8c-a9b7-2dc9-cded846622fd@gmail.com>
[not found] ` <20210228230811.wdae7oaaf3mbpgwl@mobilestation>
2021-03-01 3:50 ` [PATCH v2 2/2] memblock: do not start bottom-up allocations with kernel_end Florian Fainelli
2021-03-01 9:22 ` Serge Semin
2021-03-02 4:09 ` Florian Fainelli
2021-03-02 13:26 ` Serge Semin
2021-03-02 4:19 ` [PATCH] MIPS: BMIPS: Reserve exception base to prevent corruption Florian Fainelli
2021-03-02 8:09 ` Mike Rapoport
2021-03-02 13:54 ` Serge Semin
2021-03-02 19:04 ` Roman Gushchin
2021-03-02 23:54 ` Thomas Bogendoerfer
2021-03-03 1:30 ` Florian Fainelli
2021-03-03 9:41 ` Thomas Bogendoerfer [this message]
2021-03-03 17:45 ` Maciej W. Rozycki
2021-03-03 18:15 ` Thomas Bogendoerfer
2021-03-03 21:50 ` Maciej W. Rozycki
2021-03-01 9:45 ` [PATCH v2 2/2] memblock: do not start bottom-up allocations with kernel_end Mike Rapoport
2021-03-02 3:55 ` Roman Gushchin
2021-03-02 13:08 ` Serge Semin
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=20210303094134.GA18354@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=Sergey.Semin@baikalelectronics.ru \
--cc=akpm@linux-foundation.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=chenhuacai@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=fancer.lancer@gmail.com \
--cc=guro@fb.com \
--cc=kdasu.kdev@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=paul@crapouillou.net \
--cc=rppt@kernel.org \
--cc=siyanteng@loongson.cn \
/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