linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pratyush Yadav <pratyush@kernel.org>
To: Mike Rapoport <rppt@kernel.org>
Cc: Pratyush Yadav <pratyush@kernel.org>,
	 Pasha Tatashin <pasha.tatashin@soleen.com>,
	 akpm@linux-foundation.org, brauner@kernel.org,  corbet@lwn.net,
	 graf@amazon.com,  jgg@ziepe.ca, linux-kernel@vger.kernel.org,
	 linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
	 masahiroy@kernel.org,  ojeda@kernel.org, rdunlap@infradead.org,
	 tj@kernel.org
Subject: Re: [PATCHv7 3/7] kho: drop notifiers
Date: Fri, 24 Oct 2025 11:39:26 +0200	[thread overview]
Message-ID: <mafs01pmsfxkh.fsf@kernel.org> (raw)
In-Reply-To: <aPsZzxmGjrJSzB4q@kernel.org> (Mike Rapoport's message of "Fri, 24 Oct 2025 09:16:47 +0300")

On Fri, Oct 24 2025, Mike Rapoport wrote:

> On Wed, Oct 22, 2025 at 01:01:08PM +0200, Pratyush Yadav wrote:
>> Hi Pasha,
>> 
>> On Tue, Oct 21 2025, Pasha Tatashin wrote:
>> 
>> > From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
>> >
>> > The KHO framework uses a notifier chain as the mechanism for clients to
>> > participate in the finalization process. While this works for a single,
>> > central state machine, it is too restrictive for kernel-internal
>> > components like pstore/reserve_mem or IMA. These components need a
>> > simpler, direct way to register their state for preservation (e.g.,
>> > during their initcall) without being part of a complex,
>> > shutdown-time notifier sequence. The notifier model forces all
>> > participants into a single finalization flow and makes direct
>> > preservation from an arbitrary context difficult.
>> > This patch refactors the client participation model by removing the
>> > notifier chain and introducing a direct API for managing FDT subtrees.
>> >
>> > The core kho_finalize() and kho_abort() state machine remains, but
>> > clients now register their data with KHO beforehand.
>> >
>
> ...
>
>> > @@ -1280,7 +1298,7 @@ static __init int kho_init(void)
>> >  	kho_enable = false;
>> >  	return err;
>> >  }
>> > -late_initcall(kho_init);
>> > +fs_initcall(kho_init);
>> 
>> Is this change related to this patch? Also, why fs_initcall?
>
> memblock registers sub-fdt in late_initcall(), so we should have the root
> fdt ready by then. 

I see. Should this be even earlier then? Other components might also
depend on KHO being initialized, and those might be at or before
fs_initcall.

For example, LUO does its init using early_initcall and uses KHO, even
before it is initialized [0]. This works because kho_retrieve_subtree()
only uses parts initialized very early in boot (the KHO FDT), but I
suppose we want to have a proper initialization order to not rely on
things that just happen to work until they don't.

Since kho_init() has a dependency on debugfs, which gets initialized in
core_initcall, I guess the earliest it can be is postcore_initcall. Or,
we split out the debugfs parts into a separate init function (they have
their own file anyway) and initialize "core KHO" in early_initcall? Then
LUO can be in core_initcall and all its users in later ones.

Thoughts?

[0] https://lore.kernel.org/lkml/20250929010321.3462457-9-pasha.tatashin@soleen.com/

-- 
Regards,
Pratyush Yadav


  reply	other threads:[~2025-10-24  9:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22  0:57 [PATCHv7 0/7] liveupdate: Rework KHO for in-kernel users Pasha Tatashin
2025-10-22  0:57 ` [PATCHv7 1/7] kho: allow to drive kho from within kernel Pasha Tatashin
2025-10-23  7:13   ` Mike Rapoport
2025-10-22  0:57 ` [PATCHv7 2/7] kho: make debugfs interface optional Pasha Tatashin
2025-10-22 10:31   ` Pratyush Yadav
2025-10-22  0:57 ` [PATCHv7 3/7] kho: drop notifiers Pasha Tatashin
2025-10-22 11:01   ` Pratyush Yadav
2025-10-24  6:16     ` Mike Rapoport
2025-10-24  9:39       ` Pratyush Yadav [this message]
2025-10-24 13:11     ` Pasha Tatashin
2025-10-24 15:50       ` Pratyush Yadav
2025-10-24 15:52         ` Pratyush Yadav
2025-10-24 16:15           ` Pasha Tatashin
2025-10-24 16:32             ` Pratyush Yadav
2025-10-22  0:57 ` [PATCHv7 4/7] kho: add interfaces to unpreserve folios and page ranges Pasha Tatashin
2025-10-22 11:10   ` Pratyush Yadav
2025-10-24 13:18     ` Pasha Tatashin
2025-10-23  7:17   ` Mike Rapoport
2025-10-22  0:57 ` [PATCHv7 5/7] kho: don't unpreserve memory during abort Pasha Tatashin
2025-10-22 11:15   ` Pratyush Yadav
2025-10-23  7:20     ` Mike Rapoport
2025-10-24 13:28       ` Pasha Tatashin
2025-10-24 15:27         ` Pratyush Yadav
2025-10-24 15:33           ` Pasha Tatashin
2025-10-24 15:48             ` Pratyush Yadav
2025-10-22  0:57 ` [PATCHv7 6/7] liveupdate: kho: move to kernel/liveupdate Pasha Tatashin
2025-10-22  0:57 ` [PATCHv7 7/7] liveupdate: kho: move kho debugfs directory to liveupdate Pasha Tatashin
2025-10-23  7:32   ` Mike Rapoport
2025-10-24 13:33     ` Pasha Tatashin

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=mafs01pmsfxkh.fsf@kernel.org \
    --to=pratyush@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=corbet@lwn.net \
    --cc=graf@amazon.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=masahiroy@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=rdunlap@infradead.org \
    --cc=rppt@kernel.org \
    --cc=tj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox