All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Borislav Petkov <bp@alien8.de>, John Dorminy <jdorminy@redhat.com>
Cc: tip-bot2@linutronix.de, anjaneya.chagam@intel.com,
	dan.j.williams@intel.com, linux-kernel@vger.kernel.org,
	linux-tip-commits@vger.kernel.org, stable@vger.kernel.org,
	x86@kernel.org, Hugh Dickins <hughd@google.com>,
	"Patrick J. Volkerding" <volkerdi@gmail.com>,
	Mike Rapoport <rppt@kernel.org>
Subject: Re: [tip: x86/urgent] x86/boot: Pull up cmdline preparation and early param parsing
Date: Thu, 9 Dec 2021 16:26:55 +0100	[thread overview]
Message-ID: <50f25412-d616-1cc6-f07f-a29d80b4bd3b@suse.com> (raw)
In-Reply-To: <YbIeYIM6JEBgO3tG@zn.tnic>


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

On 09.12.21 16:19, Borislav Petkov wrote:
> + Hugh and Patrick.
> 
> On Thu, Dec 09, 2021 at 09:38:10AM -0500, John Dorminy wrote:
>> Greetings;
>>
>> It seems that this patch causes a mem= parameter to the kernel to have no effect, unfortunately...
>>
>> As far as I understand, the x86 mem parameter handler parse_memopt() (called by parse_early_param()) relies on being called after e820__memory_setup(): it simply removes any memory above the specified limit at that moment, allowing memory to later be hotplugged without regard for the initial limit. However, the initial non-hotplugged memory must already have been set up, in e820__memory_setup(), so that it can be removed in parse_memopt(); if parse_early_param() is called before e820__memory_setup(), as this change does, the parameter ends up having no effect.
>>
>> I apologize that I don't know how to fix this, but I'm happy to test patches.
> 
> Yeah, people have been reporting boot failures with mem= on the cmdline.
> 
> I think I see why, can you try this one:

Sigh. This will break Xen PV. Again. The comment above the call of
early_reserve_memory() tells you why.

Juergen

> 
> ---
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 6a190c7f4d71..6db971e61e4b 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -862,6 +862,8 @@ void __init setup_arch(char **cmdline_p)
>   	 */
>   	x86_configure_nx();
>   
> +	e820__memory_setup();
> +
>   	/*
>   	 * This parses early params and it needs to run before
>   	 * early_reserve_memory() because latter relies on such settings
> @@ -884,7 +886,6 @@ void __init setup_arch(char **cmdline_p)
>   	early_reserve_memory();
>   
>   	iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1;
> -	e820__memory_setup();
>   	parse_setup_data();
>   
>   	copy_edd();
> ---
> 
> Leaving in the rest for the newly added folks.
> 
>> Typical dmesg output showing the lack of effect, built from the prior change and this change:
>>
>> With a git tree synced to 8d48bf8206f77aa8687f0e241e901e5197e52423^ (working):
>> [    0.000000] Command line: BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-5.16.0-rc1 root=UUID=a4f7bd84-4f29-40bc-8c98-f4a72d0856c4 ro net.ifnames=0 crashkernel=128M mem=4G
>> ...
>> [    0.000000] BIOS-provided physical RAM map:
>> [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009abff] usable
>> [    0.000000] BIOS-e820: [mem 0x000000000009ac00-0x000000000009ffff] reserved
>> [    0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
>> [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000007dd3afff] usable
>> [    0.000000] BIOS-e820: [mem 0x000000007dd3b000-0x000000007deeffff] reserved
>> [    0.000000] BIOS-e820: [mem 0x000000007def0000-0x000000007e0d3fff] ACPI NVS
>> [    0.000000] BIOS-e820: [mem 0x000000007e0d4000-0x000000007f367fff] reserved
>> [    0.000000] BIOS-e820: [mem 0x000000007f368000-0x000000007f7fffff] ACPI NVS
>> [    0.000000] BIOS-e820: [mem 0x0000000080000000-0x000000008fffffff] reserved
>> [    0.000000] BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed3ffff] reserved
>> [    0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
>> [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000207fffffff] usable
>> [    0.000000] e820: remove [mem 0x100000000-0xfffffffffffffffe] usable
>> [    0.000000] NX (Execute Disable) protection: active
>> [    0.000000] user-defined physical RAM map:
>> [    0.000000] user: [mem 0x0000000000000000-0x000000000009abff] usable
>> [    0.000000] user: [mem 0x000000000009ac00-0x000000000009ffff] reserved
>> [    0.000000] user: [mem 0x00000000000e0000-0x00000000000fffff] reserved
>> [    0.000000] user: [mem 0x0000000000100000-0x000000007dd3afff] usable
>> [    0.000000] user: [mem 0x000000007dd3b000-0x000000007deeffff] reserved
>> [    0.000000] user: [mem 0x000000007def0000-0x000000007e0d3fff] ACPI NVS
>> [    0.000000] user: [mem 0x000000007e0d4000-0x000000007f367fff] reserved
>> [    0.000000] user: [mem 0x000000007f368000-0x000000007f7fffff] ACPI NVS
>> [    0.000000] user: [mem 0x0000000080000000-0x000000008fffffff] reserved
>> [    0.000000] user: [mem 0x00000000fed1c000-0x00000000fed3ffff] reserved
>> [    0.000000] user: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
>> ...
>> [    0.025617] Memory: 1762876K/2061136K available (16394K kernel code, 3568K rwdata, 10324K rodata, 2676K init, 4924K bss, 298000K reserved, 0K cma-reserved)
>>
>> Synced 8d48bf8206f77aa8687f0e241e901e5197e52423 (not working):
>>
>> [    0.000000] Command line: BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-5.16.0-rc4+ root=UUID=0e750e61-b92e-4708-a974-c50a3fb7e969 ro net.ifnames=0 crashkernel=128M mem=4G
>> [    0.000000] e820: remove [mem 0x100000000-0xfffffffffffffffe] usable
>> [    0.000000] BIOS-provided physical RAM map:
>> [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009abff] usable
>> [    0.000000] BIOS-e820: [mem 0x000000000009ac00-0x000000000009ffff] reserved
>> [    0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
>> [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000007dd3afff] usable
>> [    0.000000] BIOS-e820: [mem 0x000000007dd3b000-0x000000007deeffff] reserved
>> [    0.000000] BIOS-e820: [mem 0x000000007def0000-0x000000007e0d3fff] ACPI NVS
>> [    0.000000] BIOS-e820: [mem 0x000000007e0d4000-0x000000007f367fff] reserved
>> [    0.000000] BIOS-e820: [mem 0x000000007f368000-0x000000007f7fffff] ACPI NVS
>> [    0.000000] BIOS-e820: [mem 0x0000000080000000-0x000000008fffffff] reserved
>> [    0.000000] BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed3ffff] reserved
>> [    0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
>> [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000207fffffff] usable
>> [    0.000000] NX (Execute Disable) protection: active
>> [    0.000000] user-defined physical RAM map:
>> [    0.000000] user: [mem 0x0000000000000000-0x000000000009abff] usable
>> [    0.000000] user: [mem 0x000000000009ac00-0x000000000009ffff] reserved
>> [    0.000000] user: [mem 0x00000000000e0000-0x00000000000fffff] reserved
>> [    0.000000] user: [mem 0x0000000000100000-0x000000007dd3afff] usable
>> [    0.000000] user: [mem 0x000000007dd3b000-0x000000007deeffff] reserved
>> [    0.000000] user: [mem 0x000000007def0000-0x000000007e0d3fff] ACPI NVS
>> [    0.000000] user: [mem 0x000000007e0d4000-0x000000007f367fff] reserved
>> [    0.000000] user: [mem 0x000000007f368000-0x000000007f7fffff] ACPI NVS
>> [    0.000000] user: [mem 0x0000000080000000-0x000000008fffffff] reserved
>> [    0.000000] user: [mem 0x00000000fed1c000-0x00000000fed3ffff] reserved
>> [    0.000000] user: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
>> [    0.000000] user: [mem 0x0000000100000000-0x000000207fffffff] usable
>> ...
>> [    0.695267] Memory: 131657608K/134181712K available (16394K kernel code, 3568K rwdata, 10328K rodata, 2676K init, 4924K bss, 2523844K reserved, 0K cma-reserved)
>>
> 


[-- 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-12-09 15:27 UTC|newest]

Thread overview: 36+ 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
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 [this message]
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
2021-12-13 11:27                         ` [PATCH 0/3] x86: Fix boot ordering issues yet again Borislav Petkov
2021-12-13 11:27                           ` [PATCH 1/3] Revert "x86/boot: Mark prepare_command_line() __init" Borislav Petkov
2021-12-15 13:05                             ` [tip: x86/urgent] " tip-bot2 for Borislav Petkov
2021-12-13 11:27                           ` [PATCH 2/3] Revert "x86/boot: Pull up cmdline preparation and early param parsing" Borislav Petkov
2021-12-15 13:05                             ` [tip: x86/urgent] " tip-bot2 for Borislav Petkov
2021-12-13 11:27                           ` [PATCH 3/3] x86/boot: Move EFI range reservation after cmdline parsing Borislav Petkov
2021-12-15 13:12                             ` [tip: x86/urgent] " tip-bot2 for Mike Rapoport
     [not found]                         ` <CANGBn69pGb-nscv8tXN1UKDEQGEMWRKuPVPLgg+q2m7V_sBvHw@mail.gmail.com>
2021-12-20 18:49                           ` [tip: x86/urgent] x86/boot: Pull up cmdline preparation and early param parsing 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
2021-12-15 13:05     ` [tip: x86/urgent] x86/boot: Move EFI range reservation after cmdline parsing tip-bot2 for Mike Rapoport

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=50f25412-d616-1cc6-f07f-a29d80b4bd3b@suse.com \
    --to=jgross@suse.com \
    --cc=anjaneya.chagam@intel.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=hughd@google.com \
    --cc=jdorminy@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=rppt@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tip-bot2@linutronix.de \
    --cc=volkerdi@gmail.com \
    --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 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.