From: Jiri Bohac <jbohac@suse.cz>
To: x86@kernel.org, "Jason A. Donenfeld" <Jason@zx2c4.com>,
Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
akpm@linux-foundation.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] x86: don't reserve SETUP_RNG_SEED in e820
Date: Wed, 28 Feb 2024 10:45:02 +0100 [thread overview]
Message-ID: <Zd8AnmZHtR4ZGpoq@dwarf.suse.cz> (raw)
In-Reply-To: <ZbmOjKnARGiaYBd5@dwarf.suse.cz>
Adding Andrew Morton - have I been sending this to the wrong people/lists?
On Tue, Feb 20, 2024 at 02:55:27PM +0100, Jiri Bohac wrote:
> SETUP_RNG_SEED in setup_data is supplied by kexec and should
> not be reserved in the e820 map.
>
> Doing so reserves 16 bytes of RAM when booting with kexec.
> (16 bytes because data->len is zeroed by parse_setup_data so only
> sizeof(setup_data) is reserved.)
>
> When kexec is used repeatedly, each boot adds two entries in the
> kexec-provided e820 map as the 16-byte range splits a larger
> range of usable memory. Eventually all of the 128 available entries
> get used up. The next split will result in losing usable memory
> as the new entries cannot be added to the e820 map.
>
> Fixes: 68b8e9713c8e ("x86/setup: Use rng seeds from setup_data")
> Signed-off-by: Jiri Bohac <jbohac@suse.cz>
> ---
> arch/x86/kernel/e820.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
> index 91ade749f184..7be1362a31aa 100644
> --- a/arch/x86/kernel/e820.c
> +++ b/arch/x86/kernel/e820.c
> @@ -1018,10 +1018,12 @@ void __init e820__reserve_setup_data(void)
> e820__range_update(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN);
>
> /*
> - * SETUP_EFI and SETUP_IMA are supplied by kexec and do not need
> - * to be reserved.
> + * SETUP_EFI, SETUP_IMA and SETUP_RNG_SEED are supplied by
> + * kexec and do not need to be reserved.
> */
> - if (data->type != SETUP_EFI && data->type != SETUP_IMA)
> + if (data->type != SETUP_EFI &&
> + data->type != SETUP_IMA &&
> + data->type != SETUP_RNG_SEED)
> e820__range_update_kexec(pa_data,
> sizeof(*data) + data->len,
> E820_TYPE_RAM, E820_TYPE_RESERVED_KERN);
--
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, Prague, Czechia
next prev parent reply other threads:[~2024-02-28 9:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-31 0:04 [PATCH] " Jiri Bohac
2024-02-20 13:55 ` [PATCH RESEND] " Jiri Bohac
2024-02-28 9:45 ` Jiri Bohac [this message]
2024-02-28 10:43 ` Borislav Petkov
2024-02-28 10:28 ` [tip: x86/urgent] x86/e820: Don't " tip-bot2 for Jiri Bohac
2024-03-01 18:12 ` tip-bot2 for Jiri Bohac
2024-03-01 18:37 ` tip-bot2 for Jiri Bohac
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=Zd8AnmZHtR4ZGpoq@dwarf.suse.cz \
--to=jbohac@suse.cz \
--cc=Jason@zx2c4.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@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
all inboxes | Powered by JetHome®