Linux EFI development
 help / color / mirror / Atom feed
* [PATCH v2] Documentation: kernel-parameters: memmap= and mem= in confidential guests
@ 2026-12-03 11:35 Pankaj Gupta
  2026-12-03 13:40 ` Mike Rapoport
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Pankaj Gupta @ 2026-12-03 11:35 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	Jonathan Corbet, Shuah Khan, rdunlap, linux-doc
  Cc: Arnd Bergmann, Dapeng Mi, Marco Elver, H . Peter Anvin,
	Tom Lendacky, Ard Biesheuvel, Kiryl Shutsemau, Ilias Apalodimas,
	linux-kernel, Mike Rapoport, linux-mm, linux-efi,
	Pankaj.gupta.linux, Ethan Nelson-Moore, Karl Mehltretter,
	Pankaj Gupta

In a confidential guest (SEV-SNP, TDX) the EFI stub builds the unaccepted
memory bitmap before the command line is parsed. memmap= and mem= edit
the E820 table only afterwards, so the two no longer match.

accept_memory() accepts whole units (2 MiB on x86). On SEV-SNP this can
touch a memmap= hole, which is not mapped, and crashes the guest early
in boot. TDX accepts by physical address and does not fault.

Making the bitmap follow these options is not feasible in the current
design, as a unit cannot be half accepted. So document that these
options are best effort.

Link: https://lore.kernel.org/all/96be8f5a-8f65-48ff-8263-1d5d5f706354@intel.com/
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com>
---
    v2: 
     - Document mem= and memmap= as best effort, as suggested by Ard,
       instead of describing the unaccepted memory bitmap.
    v1: https://lore.kernel.org/all/20261125120301.223907-1-pankaj.gupta@amd.com/

 Documentation/admin-guide/kernel-parameters.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index dce9b8f3ae98..9636e662fed1 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3930,6 +3930,10 @@ Kernel parameters
 			in above case 3, memory may need be hot added after boot
 			if system memory of hypervisor is not sufficient.
 
+			This option is best effort and may break the mutual
+			consistency of the various memory descriptions provided
+			by the platform firmware.
+
 	mem=nn[KMG]@ss[KMG]
 			[ARM,MIPS,EARLY] - override the memory layout
 			reported by firmware.
@@ -3971,6 +3975,10 @@ Kernel parameters
 			Example:
 				memmap=100M@2G,100M#3G,1G!1024G
 
+			This option is best effort and may break the mutual
+			consistency of the various memory descriptions provided
+			by the platform firmware.
+
 	memmap=nn[KMG]#ss[KMG]
 			[KNL,ACPI,EARLY] Mark specific memory as ACPI data.
 			Region of memory to be marked is from ss to ss+nn.
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] Documentation: kernel-parameters: memmap= and mem= in confidential guests
  2026-12-03 11:35 [PATCH v2] Documentation: kernel-parameters: memmap= and mem= in confidential guests Pankaj Gupta
@ 2026-12-03 13:40 ` Mike Rapoport
  2026-12-04 11:08   ` Gupta, Pankaj
  2026-12-03 15:20 ` Dave Hansen
  2026-12-04 11:36 ` sashiko-bot
  2 siblings, 1 reply; 7+ messages in thread
From: Mike Rapoport @ 2026-12-03 13:40 UTC (permalink / raw)
  To: Pankaj Gupta
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	Jonathan Corbet, Shuah Khan, rdunlap, linux-doc, Arnd Bergmann,
	Dapeng Mi, Marco Elver, H . Peter Anvin, Tom Lendacky,
	Ard Biesheuvel, Kiryl Shutsemau, Ilias Apalodimas, linux-kernel,
	linux-mm, linux-efi, Pankaj.gupta.linux, Ethan Nelson-Moore,
	Karl Mehltretter

On Thu, Dec 03, 2026 at 05:35:47AM -0600, Pankaj Gupta wrote:
> In a confidential guest (SEV-SNP, TDX) the EFI stub builds the unaccepted
> memory bitmap before the command line is parsed. memmap= and mem= edit
> the E820 table only afterwards, so the two no longer match.
> 
> accept_memory() accepts whole units (2 MiB on x86). On SEV-SNP this can
> touch a memmap= hole, which is not mapped, and crashes the guest early
> in boot. TDX accepts by physical address and does not fault.
> 
> Making the bitmap follow these options is not feasible in the current
> design, as a unit cannot be half accepted. So document that these
> options are best effort.
> 
> Link: https://lore.kernel.org/all/96be8f5a-8f65-48ff-8263-1d5d5f706354@intel.com/
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Pankaj Gupta <pankaj.gupta@amd.com>
> ---
>     v2: 
>      - Document mem= and memmap= as best effort, as suggested by Ard,
>        instead of describing the unaccepted memory bitmap.
>     v1: https://lore.kernel.org/all/20261125120301.223907-1-pankaj.gupta@amd.com/
> 
>  Documentation/admin-guide/kernel-parameters.txt | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index dce9b8f3ae98..9636e662fed1 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -3930,6 +3930,10 @@ Kernel parameters
>  			in above case 3, memory may need be hot added after boot
>  			if system memory of hypervisor is not sufficient.
>  
> +			This option is best effort and may break the mutual
> +			consistency of the various memory descriptions provided
> +			by the platform firmware.
> +

I'd move it out of x86 part to [KNL,BOOT,EARLY].

>  	mem=nn[KMG]@ss[KMG]
>  			[ARM,MIPS,EARLY] - override the memory layout
>  			reported by firmware.
> @@ -3971,6 +3975,10 @@ Kernel parameters
>  			Example:
>  				memmap=100M@2G,100M#3G,1G!1024G
>  
> +			This option is best effort and may break the mutual
> +			consistency of the various memory descriptions provided
> +			by the platform firmware.
> +

And here I'd mention that other memmap= variants are treated the same.

>  	memmap=nn[KMG]#ss[KMG]
>  			[KNL,ACPI,EARLY] Mark specific memory as ACPI data.
>  			Region of memory to be marked is from ss to ss+nn.
> -- 
> 2.34.1
> 

-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] Documentation: kernel-parameters: memmap= and mem= in confidential guests
  2026-12-03 11:35 [PATCH v2] Documentation: kernel-parameters: memmap= and mem= in confidential guests Pankaj Gupta
  2026-12-03 13:40 ` Mike Rapoport
@ 2026-12-03 15:20 ` Dave Hansen
  2026-12-03 16:14   ` Ard Biesheuvel
  2026-12-04 11:13   ` Gupta, Pankaj
  2026-12-04 11:36 ` sashiko-bot
  2 siblings, 2 replies; 7+ messages in thread
From: Dave Hansen @ 2026-12-03 15:20 UTC (permalink / raw)
  To: Pankaj Gupta, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, Jonathan Corbet, Shuah Khan, rdunlap, linux-doc
  Cc: Arnd Bergmann, Dapeng Mi, Marco Elver, H . Peter Anvin,
	Tom Lendacky, Ard Biesheuvel, Kiryl Shutsemau, Ilias Apalodimas,
	linux-kernel, Mike Rapoport, linux-mm, linux-efi,
	Pankaj.gupta.linux, Ethan Nelson-Moore, Karl Mehltretter

On 12/3/26 03:35, Pankaj Gupta wrote:
> +			This option is best effort and may break the mutual
> +			consistency of the various memory descriptions provided
> +			by the platform firmware.

I'm not sure folks are going to know what "mutual consistency" means.
*I'm* not sure what it means.

Why don't we just say it can and will break things and stop there? If
folks want to know more details, they have git blame and the changelog.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] Documentation: kernel-parameters: memmap= and mem= in confidential guests
  2026-12-03 15:20 ` Dave Hansen
@ 2026-12-03 16:14   ` Ard Biesheuvel
  2026-12-04 11:13   ` Gupta, Pankaj
  1 sibling, 0 replies; 7+ messages in thread
From: Ard Biesheuvel @ 2026-12-03 16:14 UTC (permalink / raw)
  To: Dave Hansen, Pankaj Gupta, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, Jonathan Corbet, Shuah Khan,
	Randy Dunlap, linux-doc
  Cc: Arnd Bergmann, Dapeng Mi, Marco Elver, H . Peter Anvin,
	Tom Lendacky, Kiryl Shutsemau (Meta), Ilias Apalodimas,
	linux-kernel, Mike Rapoport, linux-mm, linux-efi,
	Pankaj.gupta.linux, Ethan Nelson-Moore, Karl Mehltretter



On Thu, 3 Dec 2026, at 16:20, Dave Hansen wrote:
> On 12/3/26 03:35, Pankaj Gupta wrote:
>> +			This option is best effort and may break the mutual
>> +			consistency of the various memory descriptions provided
>> +			by the platform firmware.
>
> I'm not sure folks are going to know what "mutual consistency" means.
> *I'm* not sure what it means.
>

I could explain what I meant by this but I suppose that is not your point.

> Why don't we just say it can and will break things and stop there? If
> folks want to know more details, they have git blame and the changelog.

I'd prefer to refer at least in some way to the fact that it may not be
possible to reconcile these with descriptions coming from the boot
environment. But I suppose even mem= and memmap= themselves could be
contradictory.

I'm fine with reducing this statement to "this may break stuff when
used incorrectly"




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] Documentation: kernel-parameters: memmap= and mem= in confidential guests
  2026-12-03 13:40 ` Mike Rapoport
@ 2026-12-04 11:08   ` Gupta, Pankaj
  0 siblings, 0 replies; 7+ messages in thread
From: Gupta, Pankaj @ 2026-12-04 11:08 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	Jonathan Corbet, Shuah Khan, rdunlap, linux-doc, Arnd Bergmann,
	Dapeng Mi, Marco Elver, H . Peter Anvin, Tom Lendacky,
	Ard Biesheuvel, Kiryl Shutsemau, Ilias Apalodimas, linux-kernel,
	linux-mm, linux-efi, Pankaj.gupta.linux, Ethan Nelson-Moore,
	Karl Mehltretter

>>
>> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
>> index dce9b8f3ae98..9636e662fed1 100644
>> --- a/Documentation/admin-guide/kernel-parameters.txt
>> +++ b/Documentation/admin-guide/kernel-parameters.txt
>> @@ -3930,6 +3930,10 @@ Kernel parameters
>>   			in above case 3, memory may need be hot added after boot
>>   			if system memory of hypervisor is not sufficient.
>>   
>> +			This option is best effort and may break the mutual
>> +			consistency of the various memory descriptions provided
>> +			by the platform firmware.
>> +
> I'd move it out of x86 part to [KNL,BOOT,EARLY].
>
>>   	mem=nn[KMG]@ss[KMG]
>>   			[ARM,MIPS,EARLY] - override the memory layout
>>   			reported by firmware.
>> @@ -3971,6 +3975,10 @@ Kernel parameters
>>   			Example:
>>   				memmap=100M@2G,100M#3G,1G!1024G
>>   
>> +			This option is best effort and may break the mutual
>> +			consistency of the various memory descriptions provided
>> +			by the platform firmware.
>> +
> And here I'd mention that other memmap= variants are treated the same.

Addressed both suggestions in v3.

Thanks,

Pankaj


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] Documentation: kernel-parameters: memmap= and mem= in confidential guests
  2026-12-03 15:20 ` Dave Hansen
  2026-12-03 16:14   ` Ard Biesheuvel
@ 2026-12-04 11:13   ` Gupta, Pankaj
  1 sibling, 0 replies; 7+ messages in thread
From: Gupta, Pankaj @ 2026-12-04 11:13 UTC (permalink / raw)
  To: Dave Hansen, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, Jonathan Corbet, Shuah Khan, rdunlap, linux-doc
  Cc: Arnd Bergmann, Dapeng Mi, Marco Elver, H . Peter Anvin,
	Tom Lendacky, Ard Biesheuvel, Kiryl Shutsemau, Ilias Apalodimas,
	linux-kernel, Mike Rapoport, linux-mm, linux-efi,
	Pankaj.gupta.linux, Ethan Nelson-Moore, Karl Mehltretter


>> +			This option is best effort and may break the mutual
>> +			consistency of the various memory descriptions provided
>> +			by the platform firmware.
> I'm not sure folks are going to know what "mutual consistency" means.
> *I'm* not sure what it means.
>
> Why don't we just say it can and will break things and stop there? If
> folks want to know more details, they have git blame and the changelog.

Sent v3 with this wording to provide a clear warning to users.

Best regards,
Pankaj


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] Documentation: kernel-parameters: memmap= and mem= in confidential guests
  2026-12-03 11:35 [PATCH v2] Documentation: kernel-parameters: memmap= and mem= in confidential guests Pankaj Gupta
  2026-12-03 13:40 ` Mike Rapoport
  2026-12-03 15:20 ` Dave Hansen
@ 2026-12-04 11:36 ` sashiko-bot
  2 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-04 11:36 UTC (permalink / raw)
  To: Pankaj Gupta, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, Jonathan Corbet, Shuah Khan, rdunlap
  Cc: Arnd Bergmann, Dapeng Mi, Marco Elver, H . Peter Anvin,
	Tom Lendacky, Ard Biesheuvel, Kiryl Shutsemau, Ilias Apalodimas,
	Mike Rapoport, linux-mm, linux-efi, Pankaj.gupta.linux,
	Ethan Nelson-Moore, Karl Mehltretter

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] Documentation: memmap= best-effort warning omits hole-creating
  variants
- [Low] Documentation: commit subject mentions confidential guests
  absent from diff
--

commit 375ba6787248885f8395ae9c50ef874b593daa3b
Author: Pankaj Gupta <pankaj.gupta@amd.com>

Documentation: kernel-parameters: memmap= and mem= in confidential guests

This commit documents in Documentation/admin-guide/kernel-parameters.txt
that the mem= and memmap= boot parameters are best effort and may break
consistency among platform firmware memory descriptions.

Link: https://lore.kernel.org/all/96be8f5a-8f65-48ff-8263-1d5d5f706354@intel.com/

> Documentation: kernel-parameters: memmap= and mem= in confidential guests

[Severity: Low]
Should the commit subject be updated to match the generalized change?
The documentation text no longer mentions confidential guests, so a
subject stating that mem= and memmap= are best effort would better match
the diff while keeping confidential guests in the body as motivation.

> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index dce9b8f3ae980..9636e662fed1f 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt

[ ... ]

> @@ -3971,6 +3975,10 @@ Kernel parameters
>  			Example:
>  				memmap=100M@2G,100M#3G,1G!1024G
>  
> +			This option is best effort and may break the mutual
> +			consistency of the various memory descriptions provided
> +			by the platform firmware.
> +
>  	memmap=nn[KMG]#ss[KMG]
>  			[KNL,ACPI,EARLY] Mark specific memory as ACPI data.
>  			Region of memory to be marked is from ss to ss+nn.

[Severity: Low]
Does this note miss the hole-creating memmap= variants?

The wording says "This option" and sits only under memmap=nn[KMG]@ss[KMG],
which adds RAM.  The hole-creating forms like memmap=nn[KMG]$ss[KMG] (and
the #, !, and % entries) have no warning or cross-reference back here, so
users configuring those variants will miss the caveat.

Rewording this to apply to all memmap= forms and cross-referencing it from
the other entries (as memmap=exactmap does) would ensure all variants are
covered.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203113547.250526-1-pankaj.gupta@amd.com?part=1

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-12-04 11:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 11:35 [PATCH v2] Documentation: kernel-parameters: memmap= and mem= in confidential guests Pankaj Gupta
2026-12-03 13:40 ` Mike Rapoport
2026-12-04 11:08   ` Gupta, Pankaj
2026-12-03 15:20 ` Dave Hansen
2026-12-03 16:14   ` Ard Biesheuvel
2026-12-04 11:13   ` Gupta, Pankaj
2026-12-04 11:36 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox