From: Mike Rapoport <rppt@kernel.org>
To: Jason Miu <jasonmiu@google.com>
Cc: Alexander Graf <graf@amazon.com>,
Andrew Morton <akpm@linux-foundation.org>,
Baoquan He <bhe@redhat.com>,
Changyuan Lyu <changyuanl@google.com>,
David Matlack <dmatlack@google.com>,
David Rientjes <rientjes@google.com>,
Jason Gunthorpe <jgg@nvidia.com>,
Joel Granados <joel.granados@kernel.org>,
Marcos Paulo de Souza <mpdesouza@suse.com>,
Mario Limonciello <mario.limonciello@amd.com>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Petr Mladek <pmladek@suse.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Steven Chen <chenste@linux.microsoft.com>,
Yan Zhao <yan.y.zhao@intel.com>,
kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [RFC v1 2/4] kho: Adopt KHO page tables and remove serialization
Date: Wed, 17 Sep 2025 20:52:28 +0300 [thread overview]
Message-ID: <aMr1XAKmyfzM8RCc@kernel.org> (raw)
In-Reply-To: <20250917025019.1585041-3-jasonmiu@google.com>
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@google.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.
next prev parent reply other threads:[~2025-09-17 17:52 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-17 2:50 [RFC v1 0/4] Make KHO Stateless Jason Miu
2025-09-17 2:50 ` [RFC v1 1/4] kho: Introduce KHO page table data structures Jason Miu
2025-09-17 12:21 ` Jason Gunthorpe
2025-09-17 16:18 ` Pasha Tatashin
2025-09-17 16:32 ` Jason Gunthorpe
2025-09-19 6:49 ` Jason Miu
2025-09-19 12:56 ` Jason Gunthorpe
2025-09-17 2:50 ` [RFC v1 2/4] kho: Adopt KHO page tables and remove serialization Jason Miu
2025-09-17 17:52 ` Mike Rapoport [this message]
2025-09-19 6:58 ` Jason Miu
2025-09-17 2:50 ` [RFC v1 3/4] memblock: Remove KHO notifier usage Jason Miu
2025-09-17 2:50 ` [RFC v1 4/4] kho: Remove notifier system infrastructure Jason Miu
2025-09-17 11:36 ` [RFC v1 0/4] Make KHO Stateless Jason Gunthorpe
2025-09-17 14:48 ` Pasha Tatashin
2025-09-21 22:26 ` Matthew Wilcox
2025-09-21 23:07 ` Pasha Tatashin
2025-09-25 9:19 ` Mike Rapoport
2025-09-25 12:27 ` Pratyush Yadav
2025-09-25 12:33 ` Jason Gunthorpe
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=aMr1XAKmyfzM8RCc@kernel.org \
--to=rppt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=changyuanl@google.com \
--cc=chenste@linux.microsoft.com \
--cc=dmatlack@google.com \
--cc=graf@amazon.com \
--cc=jasonmiu@google.com \
--cc=jgg@nvidia.com \
--cc=joel.granados@kernel.org \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mario.limonciello@amd.com \
--cc=mpdesouza@suse.com \
--cc=pasha.tatashin@soleen.com \
--cc=pmladek@suse.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rientjes@google.com \
--cc=yan.y.zhao@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).