[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6cdc71dc-c26d-5c59-b7dd-0eb47ab9c861@suse.com>
Date: Tue, 14 Sep 2021 13:06:22 +0200
From: Juergen Gross <jgross@...e.com>
To: Jan Beulich <jbeulich@...e.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, stable@...r.kernel.org,
Marek Marczykowski-Górecki
<marmarek@...isiblethingslab.com>, xen-devel@...ts.xenproject.org,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/setup: call early_reserve_memory() earlier
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@...r.kernel.org
>> Fixes: a799c2bd29d19c565 ("x86/setup: Consolidate early memory reservations")
>> Reported-by: Marek Marczykowski-Górecki <marmarek@...isiblethingslab.com>
>> Signed-off-by: Juergen Gross <jgross@...e.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
>>
>
Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3092 bytes)
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (496 bytes)
Powered by blists - more mailing lists