lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b8285bad-533d-426c-bcad-2010a7c043a0@amd.com>
Date: Mon, 12 Jan 2026 23:52:01 -0600
From: "Pratik R. Sampat" <prsampat@....com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, linux-coco@...ts.linux.dev, x86@...nel.org,
 linux-kernel@...r.kernel.org, tglx@...utronix.de, mingo@...hat.com,
 bp@...en8.de, dave.hansen@...ux.intel.com, kas@...nel.org, ardb@...nel.org,
 david@...nel.org, osalvador@...e.de, thomas.lendacky@....com,
 michael.roth@....com
Subject: Re: [PATCH v2 1/2] mm/memory_hotplug: Add support to accept memory
 during hot-add



On 1/12/26 4:43 PM, Andrew Morton wrote:
> On Mon, 12 Jan 2026 16:23:37 -0600 "Pratik R. Sampat" <prsampat@....com> wrote:
> 
>>
>>
>> On 1/12/26 3:04 PM, Andrew Morton wrote:
>>> On Mon, 12 Jan 2026 14:22:59 -0600 "Pratik R. Sampat" <prsampat@....com> wrote:
>>>
>>>> Confidential computing guests require memory to be accepted before use.
>>>> The unaccepted memory bitmap maintained by firmware does not track
>>>> hotplugged memory ranges.
>>>>
>>>> Call arch_accept_memory() during the hot-add path to explicitly validate
>>>> and transition the newly added memory to a private state, making it
>>>> usable by the guest.
>>>>
>>>> Signed-off-by: Pratik R. Sampat <prsampat@....com>
>>>> ---
>>>>  mm/memory_hotplug.c | 4 ++++
>>>>  1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>>>> index a63ec679d861..8cfbf0541430 100644
>>>> --- a/mm/memory_hotplug.c
>>>> +++ b/mm/memory_hotplug.c
>>>> @@ -38,6 +38,7 @@
>>>>  #include <linux/node.h>
>>>>  
>>>>  #include <asm/tlbflush.h>
>>>> +#include <asm/unaccepted_memory.h>
>>>
>>> This only exists for x86!
>>
>> Ah, I missed that entirely. Thanks for catching that.
>>
>> Probably not the best option to have a generic unaccepted_memory.h as well.
>> Maybe, I should have arch_[un]accept_memory() definitions within mm.h wrapped
>> within CONFIG_UNACCEPTED_MEMORY instead so that its cleaner.
> 
> Something like that.
> 
> The idiomatic Linus way is to use
> 
> #ifndef arch_accept_memory
> #define arch_accept_memory ...
> #endif
> 
> Lots of prior art here:
> 
> 	grep -r include/linux "ifndef arch_"
> 
> 
> Oh, arch_get_idle_state_flags() got it all wrong.
> 
> 	#ifdef CONFIG_ACPI_PROCESSOR_IDLE
> 	#ifndef arch_get_idle_state_flags
> 	static inline unsigned int arch_get_idle_state_flags(u32 arch_flags)
> 	{
> 		return 0;
> 	}
> 	#endif
> 	#endif /* CONFIG_ACPI_PROCESSOR_IDLE */
> 
> - shouldn't have needed "ifdef CONFIG_ACPI_PROCESSOR_IDLE"
> 
> - should have appended
> 
> 	#define arch_get_idle_state_flags arch_get_idle_state_flags
> 
>   in case cpp hit the same lines a second time.
> 

Got it. Thanks for clearing that up. I'll make sure to do it this way
in the next iteration.

--Pratik


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ