linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Dave Young <dyoung@redhat.com>
Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Moritz Fischer <mdf@kernel.org>, Will Deacon <will@kernel.org>,
	Ard Biesheuvel <ardb@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	James Morse <james.morse@arm.com>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Hanjun Guo <guohanjun@huawei.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Eric Biederman <ebiederm@xmission.com>,
	Pingfan Liu <piliu@redhat.com>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	kernel-team@android.com
Subject: Re: [PATCH 0/2] arm64: kexec_file_load vs memory reservations
Date: Thu, 13 May 2021 12:07:07 +0100	[thread overview]
Message-ID: <87eeeaopt0.wl-maz@kernel.org> (raw)
In-Reply-To: <20210513031503.GC45898@dhcp-128-65.nay.redhat.com>

[- Bhupesh, as his RH address now bounces]

On Thu, 13 May 2021 04:17:38 +0100,
Dave Young <dyoung@redhat.com> wrote:
> 
> Hi Marc,
> On 05/12/21 at 07:04pm, Marc Zyngier wrote:
> > + Dave Young, which I accidentally missed in my initial post
> > 
> > On Thu, 29 Apr 2021 14:35:31 +0100,
> > Marc Zyngier <maz@kernel.org> wrote:
> > > 
> > > It recently became apparent that using kexec with kexec_file_load() on
> > > arm64 is pretty similar to playing Russian roulette.
> > > 
> > > Depending on the amount of memory, the HW supported and the firmware
> > > interface used, your secondary kernel may overwrite critical memory
> > > regions without which the secondary kernel cannot boot (the GICv3 LPI
> > > tables being a prime example of such reserved regions).
> > > 
> > > It turns out that there is at least two ways for reserved memory
> > > regions to be described to kexec: /proc/iomem for the userspace
> > > implementation, and memblock.reserved for kexec_file. And of course,
> > > our LPI tables are only reserved using the resource tree, leading to
> > > the aforementioned stamping. Similar things could happen with ACPI
> > > tables as well.
> > > 
> > > On my 24xA53 system artificially limited to 256MB of RAM (yes, it
> > > boots with that little memory), trying to kexec a secondary kernel
> > > failed every times. I can only presume that this was mostly tested
> > > using kdump, which preserves the entire kernel memory range.
> > > 
> > > This small series aims at triggering a discussion on what are the
> > > expectations for kexec_file, and whether we should unify the two
> > > reservation mechanisms.
> > > 
> > > And in the meantime, it gets things going...
> > > 
> > > Marc Zyngier (2):
> > >   firmware/efi: Tell memblock about EFI reservations
> > >   ACPI: arm64: Reserve the ACPI tables in memblock
> > > 
> > >  arch/arm64/kernel/acpi.c   |  1 +
> > >  drivers/firmware/efi/efi.c | 23 ++++++++++++++++++++++-
> > >  2 files changed, 23 insertions(+), 1 deletion(-)
> > 
> > Any comment on this?
> > 
> > I've separately started working on using the resource tree to slice
> > and dice the memblocks that are candidate for kexec_file_load(), but
> > I'd like some consensus on whether this is the right way to address
> > the issue.
> > 
> > Without something like this, kexec_file_load() is not usable on arm64,
> > so I'm pretty eager to see the back of this bug.
> 
> The arm64 memory reservation is tricky, I do not think I understand it
> correctly.  Previously there were a lot discussion, Ard and AKASHI
> should know more about it, see if they can provide comments.

I'll let them chime in. It looks like most of the discussions were
around kdump, which doesn't suffer from this issue (the memory is
reserved upfront).

> About the problem you see, another way is to just add an arch weak
> function like powerpc: arch_kexec_locate_mem_hole, and walking resource
> tree for kexec_file_load as well.  But I might be wrong since I did not
> follow up the arm64 specific history.

Right, this would avoid messing with the core code. However, the
problem remains in the sense that there is no clear definition of what
"reserved memory" is in general, and where it is described. For
example, x86 places the ACPI tables in reserved memblocks, while arm64
doesn't (unless we use my second patch).

To reliably use the resource tree, we need to ensure that it contains
all the reservations that appeared in memblock too. And if we can't
have a single reference, then we have to consider the union of the two
trees.

Thoughts?

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-05-13 11:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 13:35 [PATCH 0/2] arm64: kexec_file_load vs memory reservations Marc Zyngier
2021-04-29 13:35 ` [PATCH 1/2] firmware/efi: Tell memblock about EFI reservations Marc Zyngier
2021-05-03 18:56   ` Moritz Fischer
2021-05-13  3:20     ` Dave Young
2021-05-13 11:11       ` Marc Zyngier
2021-04-29 13:35 ` [PATCH 2/2] ACPI: arm64: Reserve the ACPI tables in memblock Marc Zyngier
2021-05-03 18:57   ` Moritz Fischer
2021-05-12 18:04 ` [PATCH 0/2] arm64: kexec_file_load vs memory reservations Marc Zyngier
2021-05-13  3:17   ` Dave Young
2021-05-13 11:07     ` Marc Zyngier [this message]
2021-05-18 11:48 ` Will Deacon
2021-05-18 14:23   ` Bhupesh Sharma
2021-05-19 15:19 ` Catalin Marinas
2021-05-25 16:22   ` Marc Zyngier
2021-06-02 14:22 ` James Morse
2021-06-02 15:59   ` Marc Zyngier
2021-06-02 16:58     ` James Morse

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=87eeeaopt0.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=guohanjun@huawei.com \
    --cc=james.morse@arm.com \
    --cc=kernel-team@android.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mdf@kernel.org \
    --cc=piliu@redhat.com \
    --cc=sudeep.holla@arm.com \
    --cc=takahiro.akashi@linaro.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).