All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "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>,
	xen-devel@lists.xenproject.org, x86@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/setup: call early_reserve_memory() earlier
Date: Tue, 14 Sep 2021 13:06:22 +0200	[thread overview]
Message-ID: <6cdc71dc-c26d-5c59-b7dd-0eb47ab9c861@suse.com> (raw)
In-Reply-To: <b15fa98e-f9a8-abac-2d16-83c29dafc517@suse.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 2975 bytes --]

On 14.09.21 12:03, Jan Beulich wrote:
> On 14.09.2021 11:41, 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() to the beginning of
>> setup_arch() 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>
>> ---
>>   arch/x86/kernel/setup.c | 24 ++++++++++++------------
>>   1 file changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
>> index 79f164141116..f369c51ec580 100644
>> --- a/arch/x86/kernel/setup.c
>> +++ b/arch/x86/kernel/setup.c
>> @@ -757,6 +757,18 @@ dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p)
>>   
>>   void __init setup_arch(char **cmdline_p)
>>   {
>> +	/*
>> +	 * 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.
> 
> Hmm, this part of the comment is not only stale now, but gets actively
> undermined. No idea how likely such a panic() would be, and hence how
> relevant it is to retain this particular property.

Ah, right.

The alternative would be to split it up again. Let's let the x86
maintainers decide which way is the better one.


Juergen

> 
> Jan
> 
>> +	 * 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_X86_32
>>   	memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
>>   
>> @@ -876,18 +888,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
>>
> 


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

  reply	other threads:[~2021-09-14 11:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14  9:41 [PATCH] x86/setup: call early_reserve_memory() earlier Juergen Gross
2021-09-14 10:03 ` Jan Beulich
2021-09-14 11:06   ` Juergen Gross [this message]
2021-09-15 11:00     ` Borislav Petkov
2021-09-16  9:09       ` Mike Rapoport
2021-09-16 10:29         ` Borislav Petkov
2021-09-16 10:31           ` Juergen Gross
2021-09-14 10:49 ` Marek Marczykowski-Górecki
2021-09-16 10:50 ` [tip: x86/urgent] x86/setup: Call " tip-bot2 for Juergen Gross
2021-09-19 16:55   ` Mike Galbraith
2021-09-19 17:04     ` Mike Rapoport
2021-09-20  0:56       ` Mike Galbraith
2021-09-20  9:26         ` Mike Rapoport
2021-09-20  9:38           ` Borislav Petkov
2021-09-20 11:25           ` Mike Galbraith
2021-09-20 11:33             ` Juergen Gross
2021-09-19 17:15     ` Borislav Petkov
2021-09-20  6:00       ` Juergen Gross
2021-09-20  9:46         ` Mike Rapoport
2021-09-20 22:48       ` Nathan Chancellor
2021-09-21  3:38         ` Borislav Petkov
2021-09-21  3:59           ` Nathan Chancellor
2021-09-21  7:36             ` 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=6cdc71dc-c26d-5c59-b7dd-0eb47ab9c861@suse.com \
    --to=jgross@suse.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jbeulich@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.