From: Nathan Chancellor <nathan@kernel.org>
To: Juergen Gross <jgross@suse.com>
Cc: xen-devel@lists.xenproject.org, x86@kernel.org,
linux-kernel@vger.kernel.org, efault@gmx.de,
"Thomas Gleixner" <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
stable@vger.kernel.org,
"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Subject: Re: [PATCH v2] x86/setup: call early_reserve_memory() earlier
Date: Mon, 20 Sep 2021 20:59:33 -0700 [thread overview]
Message-ID: <YUlYpWhGCxpJ9diw@archlinux-ax161> (raw)
In-Reply-To: <20210920120421.29276-1-jgross@suse.com>
On Mon, Sep 20, 2021 at 02:04:21PM +0200, Juergen Gross wrote:
> Commit a799c2bd29d19c565 ("x86/setup: Consolidate early memory
> reservations") introduced early_reserve_memory() to do all needed
> initial memblock_reserve() calls in one function. Unfortunately the
> call of early_reserve_memory() is done too late for Xen dom0, as in
> some cases a Xen hook called by e820__memory_setup() will need those
> memory reservations to have happened already.
>
> Move the call of early_reserve_memory() before the call of
> e820__memory_setup() in order to avoid such problems.
>
> Cc: stable@vger.kernel.org
> Fixes: a799c2bd29d19c565 ("x86/setup: Consolidate early memory reservations")
> Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>
I had issues on an AMD Ryzen 3 4300G based system with v1. v2 does not
trigger any boot issues on that same machine or an Intel i5-4210U based
system that I also test with.
Tested-by: Nathan Chancellor <nathan@kernel.org>
> ---
> V2:
> - update comment (Jan Beulich, Boris Petkov)
> - move call down in setup_arch() (Mike Galbraith)
> ---
> arch/x86/kernel/setup.c | 26 ++++++++++++++------------
> 1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 79f164141116..40ed44ead063 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -830,6 +830,20 @@ void __init setup_arch(char **cmdline_p)
>
> x86_init.oem.arch_setup();
>
> + /*
> + * Do some memory reservations *before* memory is added to memblock, so
> + * memblock allocations won't overwrite it.
> + *
> + * After this point, everything still needed from the boot loader or
> + * firmware or kernel text should be early reserved or marked not RAM in
> + * e820. All other memory is free game.
> + *
> + * This call needs to happen before e820__memory_setup() which calls the
> + * xen_memory_setup() on Xen dom0 which relies on the fact that those
> + * early reservations have happened already.
> + */
> + early_reserve_memory();
> +
> iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1;
> e820__memory_setup();
> parse_setup_data();
> @@ -876,18 +890,6 @@ void __init setup_arch(char **cmdline_p)
>
> parse_early_param();
>
> - /*
> - * Do some memory reservations *before* memory is added to
> - * memblock, so memblock allocations won't overwrite it.
> - * Do it after early param, so we could get (unlikely) panic from
> - * serial.
> - *
> - * After this point everything still needed from the boot loader or
> - * firmware or kernel text should be early reserved or marked not
> - * RAM in e820. All other memory is free game.
> - */
> - early_reserve_memory();
> -
> #ifdef CONFIG_MEMORY_HOTPLUG
> /*
> * Memory used by the kernel cannot be hot-removed because Linux
> --
> 2.26.2
>
>
next prev parent reply other threads:[~2021-09-21 3:59 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-20 12:04 [PATCH v2] x86/setup: call early_reserve_memory() earlier Juergen Gross
2021-09-21 0:01 ` Marek Marczykowski-Górecki
2021-09-21 3:59 ` Nathan Chancellor [this message]
2021-09-22 17:18 ` [tip: x86/urgent] x86/setup: Call " tip-bot2 for Juergen Gross
2021-11-04 5:38 ` Williams, Dan J
2021-11-04 11:40 ` Borislav Petkov
2021-11-04 17:36 ` Dan Williams
2021-11-15 11:36 ` [tip: x86/urgent] x86/boot: Pull up cmdline preparation and early param parsing tip-bot2 for Borislav Petkov
2021-12-09 14:38 ` John Dorminy
2021-12-09 15:19 ` Borislav Petkov
2021-12-09 15:26 ` Juergen Gross
2021-12-09 15:28 ` Borislav Petkov
2021-12-09 16:29 ` Mike Rapoport
2021-12-09 16:37 ` Borislav Petkov
2021-12-10 11:28 ` Borislav Petkov
2021-12-10 20:11 ` Hugh Dickins
2021-12-11 10:14 ` Borislav Petkov
2021-12-10 20:32 ` Patrick J. Volkerding
2021-12-11 10:29 ` Borislav Petkov
2021-12-11 5:24 ` John Dorminy
2021-12-11 10:30 ` Borislav Petkov
2021-12-13 8:20 ` Mike Rapoport
2021-12-13 9:33 ` Borislav Petkov
[not found] ` <CANGBn69pGb-nscv8tXN1UKDEQGEMWRKuPVPLgg+q2m7V_sBvHw@mail.gmail.com>
2021-12-20 18:49 ` Patrick J. Volkerding
2021-12-20 18:59 ` Borislav Petkov
2021-12-20 19:08 ` Borislav Petkov
2021-12-09 15:49 ` John Dorminy
2021-12-09 16:07 ` Borislav Petkov
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=YUlYpWhGCxpJ9diw@archlinux-ax161 \
--to=nathan@kernel.org \
--cc=bp@alien8.de \
--cc=efault@gmx.de \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marmarek@invisiblethingslab.com \
--cc=mingo@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.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).