From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Nick Kossifidis <mick@ics.forth.gr>
Cc: Rob Herring <robh+dt@kernel.org>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Frank Rowand <frowand.list@gmail.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
linux-riscv <linux-riscv@lists.infradead.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] riscv: Remove non-standard linux,elfcorehdr handling
Date: Wed, 16 Jun 2021 09:56:05 +0200 [thread overview]
Message-ID: <CAMuHMdVRcN+y0kwxxEH8UGo6bRT9SvxRSLU8VzWJFx=yLQ5S0g@mail.gmail.com> (raw)
In-Reply-To: <bdfbf7cc997a10a94331d77332dbe88e@mailhost.ics.forth.gr>
Hi Nick,
On Wed, Jun 16, 2021 at 1:19 AM Nick Kossifidis <mick@ics.forth.gr> wrote:
> Στις 2021-06-15 22:54, Rob Herring έγραψε:
> > On Tue, Jun 15, 2021 at 12:40 PM Nick Kossifidis <mick@ics.forth.gr>
> > wrote:
> >> Στις 2021-06-15 21:17, Geert Uytterhoeven έγραψε:
> >> > RISC-V uses platform-specific code to locate the elf core header in
> >> > memory. However, this does not conform to the standard
> >> > "linux,elfcorehdr" DT bindings, as it relies on a reserved memory node
> >> > with the "linux,elfcorehdr" compatible value, instead of on a
> >> > "linux,elfcorehdr" property under the "/chosen" node.
> >> >
> >> > The non-compliant code can just be removed, as the standard behavior is
> >> > already implemented by platform-agnostic handling in the FDT core code.
> >> >
> >> > Fixes: 5640975003d0234d ("RISC-V: Add crash kernel support")
> >> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >>
> >> NACK
> >>
> >> There is nothing standard about "linux,elfcorehdr", it's an
> >
> > It is and it is documented which is more than we can say for
> > "linux,elfcorehdr" as a node.
> >
>
> Standard stuff goes on /drivers/of, not on /arch/arm64. The
... which is what I'm fixing ;-)
Once in a while, new code is added where it's used, and moved to
common code later.
> reserved-memory binding I use is on /drivers/of, is definitely a
> standard / documented binding and the only issue here is that the
> compatible string I used matched that property from arm64.
It's always a good idea to document your compatible strings, and run
your patches through the devicetree list, exactly to avoid issues
like this.
> >> arm64-specific property on /chosen and it's suboptimal, it gets the
> >> addr/length of ELF core of the previous kernel through that property
> >> and
> >> then goes on to reserve that region at:
> >> https://elixir.bootlin.com/linux/v5.13-rc6/source/arch/arm64/mm/init.c#L155
> >>
> >> Why on earth is this cleaner than just defining a reserved-region in
> >> the
> >> first place (a standard binding) with and hook up a callback with
> >> RESERVEDMEM_OF_DECLARE for it to also initialize elfcorehdr_addr/size
> >> ?
> >> If you don't like the compatible string I'm ok to change it, but this
> >> patch breaks kdump on riscv since that region won't be reserved any
> >> more
> >> and kernel will corrupt it.
> >
> > I might agree if we were designing this all from scratch, but we're
> > not. We've got powerpc doing /memreserve/ + kernel cmdline, arm64
> > using chosen, and RiscV a 3rd way.
> >
>
> I get it and I'd also like to consolidate things, but forcing riscv to
> use a suboptimal approach just because arm64 uses it doesn't make sense
> either, the goal should be for all to use the best possible approach
> (disclaimer: I'm not saying my approach is the best possible, I'm saying
> it's cleaner than arm64's).
>
> > What happens when/if RiscV wants to add an IMA buffer? That's no
> > different than this case. The 2 architectures supporting it both use
> > /chosen. Specifying an initrd is no different either.
>
> Those two are already on drivers/of/fdt.c and drivers/of/kexec.c, it's
> also interesting to note that for both of them, including
> "linux,elfcorehdr", the newly added drivers/of/kexec.c adds an entry to
> the fdt's memory reservation map when creating the fdt for the next
> kernel, so they are all basically reserved regions. Why this was chosen
> (a property on /chosen + an entry on the reservation map), effectively
> adding each region twice on the fdt, instead of just adding a
> reserved-memory node for each one beats me. Note that in case of arm64
> this is not what happens on kexec-tools, which is probably the reason
> why arm64 still reserves them in any case.
I can't comment on the duplication on arm64, but to me, /chosen
sounds like the natural place for both "linux,elfcorehdr" and
"linux,usable-memory-range". First rule of DT is "DT describes
hardware, not software policy", with /chosen describing some software
configuration.
> Anyway I guess switching arm64 to reserved-memory is too much to ask
> since they would have to also change kexec-tools, handle different
> versions etc, and although I don't like it consolidation is more
> important than a duplicate region on the fdt, so let's go with
> "linux,elfcorehdr" on /chosen + entry on the reservation map. I'll
> update my kexec-tools patch instead.
OK, thanks!
But do you need the entry on the reservation map?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
next prev parent reply other threads:[~2021-06-16 7:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-15 18:17 [PATCH 0/3] Add generic-support for linux,elfcorehdr and fix riscv Geert Uytterhoeven
2021-06-15 18:17 ` [PATCH 1/3] of: fdt: Add generic support for parsing elf core header properties Geert Uytterhoeven
2021-06-15 19:54 ` Rob Herring
2021-06-15 23:28 ` Nick Kossifidis
2021-06-16 7:58 ` Geert Uytterhoeven
2021-06-15 18:17 ` [PATCH 2/3] riscv: Remove non-standard linux,elfcorehdr handling Geert Uytterhoeven
2021-06-15 18:40 ` Nick Kossifidis
2021-06-15 19:54 ` Rob Herring
2021-06-15 23:19 ` Nick Kossifidis
2021-06-16 7:56 ` Geert Uytterhoeven [this message]
2021-06-16 10:43 ` Nick Kossifidis
2021-06-16 14:47 ` Rob Herring
2021-07-01 2:52 ` Palmer Dabbelt
2021-07-02 15:56 ` Nick Kossifidis
2021-06-15 18:17 ` [PATCH 3/3] arm64: kdump: Remove custom linux,elfcorehdr parsing Geert Uytterhoeven
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='CAMuHMdVRcN+y0kwxxEH8UGo6bRT9SvxRSLU8VzWJFx=yLQ5S0g@mail.gmail.com' \
--to=geert@linux-m68k.org \
--cc=aou@eecs.berkeley.edu \
--cc=catalin.marinas@arm.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mick@ics.forth.gr \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=robh+dt@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).