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: <aMr1XAKmyfzM8RCc@kernel.org>
Date: Wed, 17 Sep 2025 20:52:28 +0300
From: Mike Rapoport <rppt@...nel.org>
To: Jason Miu <jasonmiu@...gle.com>
Cc: Alexander Graf <graf@...zon.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Baoquan He <bhe@...hat.com>, Changyuan Lyu <changyuanl@...gle.com>,
	David Matlack <dmatlack@...gle.com>,
	David Rientjes <rientjes@...gle.com>,
	Jason Gunthorpe <jgg@...dia.com>,
	Joel Granados <joel.granados@...nel.org>,
	Marcos Paulo de Souza <mpdesouza@...e.com>,
	Mario Limonciello <mario.limonciello@....com>,
	Pasha Tatashin <pasha.tatashin@...een.com>,
	Petr Mladek <pmladek@...e.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
	Steven Chen <chenste@...ux.microsoft.com>,
	Yan Zhao <yan.y.zhao@...el.com>, kexec@...ts.infradead.org,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [RFC v1 2/4] kho: Adopt KHO page tables and remove serialization

Hi Jason,

On Tue, Sep 16, 2025 at 07:50:17PM -0700, Jason Miu wrote:
> Transition the KHO system to use the new page table data structures
> for managing preserved memory, replacing the previous xarray-based
> approach. Remove the serialization process and the associated
> finalization and abort logic.
> 
> Update the methods for marking memory to be preserved to use the KHO
> page table hierarchy. Remove the former system of tracking preserved
> pages using an xarray-based structure.
> 
> Change the method of passing preserved memory information to the next
> kernel to be direct. Instead of serializing the memory map, place the
> physical address of the `kho_order_table`, which holds the roots of
> the KHO page tables for each order, in the FDT. Remove the explicit
> `kho_finalize()` and `kho_abort()` functions and the logic supporting
> the finalize and abort states, as they are no longer needed. This
> simplifies the KHO lifecycle.
> 
> Enable the next kernel's initialization process to read the
> `kho_order_table` address from the FDT. The kernel will then traverse
> the KHO page table structures to discover all preserved memory
> regions, reserving them to prevent early boot-time allocators from
> overwriting them.
> 
> This architectural shift to using a shared page table structure
> simplifies the KHO design and eliminates the overhead of serializing
> and deserializing the preserved memory map.
> 
> Signed-off-by: Jason Miu <jasonmiu@...gle.com>
> ---
>  include/linux/kexec_handover.h |  17 --
>  kernel/kexec_handover.c        | 532 +++++----------------------------
>  2 files changed, 71 insertions(+), 478 deletions(-)
>  
> -/*
> - * TODO: __maybe_unused is added to the functions:
> - * kho_preserve_page_table()
> - * kho_walk_tables()
> - * kho_memblock_reserve()
> - * since they are not actually being called in this change.
> - * __maybe_unused will be removed in the next patch.
> - */
> -static __maybe_unused int kho_preserve_page_table(unsigned long pfn, int order)
> +static int kho_preserve_page_table(unsigned long pfn, int order)

Just merge this and the previous patch so that the patch will replace the
current preservation mechanism with a new one.

>  {
>  	unsigned long pa = PFN_PHYS(pfn);
>  
> @@ -365,8 +357,8 @@ static int __kho_walk_page_tables(int order, int level,
>  	return 0;
>  }
>  

...

> @@ -1023,12 +752,8 @@ int kho_preserve_folio(struct folio *folio)
>  {
>  	const unsigned long pfn = folio_pfn(folio);
>  	const unsigned int order = folio_order(folio);
> -	struct kho_mem_track *track = &kho_out.ser.track;
> -
> -	if (kho_out.finalized)
> -		return -EBUSY;
>  
> -	return __kho_preserve_order(track, pfn, order);
> +	return kho_preserve_page_table(pfn, order);

I don't think we should "rename" __kho_preserve_order() to
kho_preserve_page_table(). __kho_preserve_order() could use the new data
structure, or call the new implementation, but I don't see a reason to
replace it.

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ