linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Young <dyoung@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org
Subject: Re: [PATCH] x86/kexec: do not reserve kexec setup_data in kexec e820 table
Date: Mon, 24 Feb 2020 15:14:19 +0800	[thread overview]
Message-ID: <20200224071419.GA18237@dhcp-128-65.nay.redhat.com> (raw)
In-Reply-To: <20200212110424.GA2938@dhcp-128-65.nay.redhat.com>

On 02/12/20 at 07:04pm, Dave Young wrote:
> The e820 table for kexec kernel always takes setup_data as reserved.
> It is reasonable for the setup_data passed by the 1st kernel boot loader,
> for example SETUP_PCI etc.  But SETUP_EFI is used by kexec itself to
> enable EFI in 2nd kernel, also kexec setups it every time. Thus it
> is pointless to reserve kexec prepared setup_data.
> 
> 1st physical boot: no SETUP_EFI
> kexec load new kernel and prepare a SETUP_EFI setup_data, then reboot
>  -> 2nd kernel sees SETUP_EFI, reserves in both e820 and kexec e820
>     another kexec load prepare a new SETUP_EFI, then reboot
>     -> 3rd kernel has two SETUP_EFI ranges reserved
>        -> and so on..
> 
> Thus skip SETUP_EFI while reserving setup_data for kexec kernel.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---
>  arch/x86/kernel/e820.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> --- linux-x86.orig/arch/x86/kernel/e820.c
> +++ linux-x86/arch/x86/kernel/e820.c
> @@ -999,7 +999,9 @@ void __init e820__reserve_setup_data(voi
>  	while (pa_data) {
>  		data = early_memremap(pa_data, sizeof(*data));
>  		e820__range_update(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN);
> -		e820__range_update_kexec(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN);
> +		/* Skip kexec passed setup_data */
> +		if (data->type != SETUP_EFI)
> +			e820__range_update_kexec(pa_data, sizeof(*data)+data->len, E820_TYPE_RAM, E820_TYPE_RESERVED_KERN);
>  
>  		if (data->type == SETUP_INDIRECT &&
>  		    ((struct setup_indirect *)data->data)->type != SETUP_INDIRECT) {

Ping, can someone review this? It caused fragmented memory in kexec
kernel also waste memory.

Thanks
Dave


  reply	other threads:[~2020-02-24  7:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 11:04 [PATCH] x86/kexec: do not reserve kexec setup_data in kexec e820 table Dave Young
2020-02-24  7:14 ` Dave Young [this message]
2020-02-24 10:51 ` [tip: x86/kdump] x86/kexec: Do not reserve EFI setup_data in the " tip-bot2 for Dave Young
2020-02-25  1:49   ` Dave Young

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=20200224071419.GA18237@dhcp-128-65.nay.redhat.com \
    --to=dyoung@redhat.com \
    --cc=bp@alien8.de \
    --cc=kexec@lists.infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).