From: Pratyush Yadav <pratyush@kernel.org>
To: Pratyush Yadav <pratyush@kernel.org>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>,
Samiullah Khawaja <skhawaja@google.com>,
Mike Rapoport <rppt@kernel.org>,
Alexander Graf <graf@amazon.com>,
David Matlack <dmatlack@google.com>,
tarunsahu@google.com, open list <linux-kernel@vger.kernel.org>,
"open list:KEXEC HANDOVER (KHO)" <kexec@lists.infradead.org>,
"open list:KEXEC HANDOVER (KHO)" <linux-mm@kvack.org>
Subject: Re: [PATCH 1/1] liveupdate: luo_file: Add internal APIs for file preservation
Date: Mon, 29 Jun 2026 18:50:09 +0200 [thread overview]
Message-ID: <2vxz7bnhjnpa.fsf@kernel.org> (raw)
In-Reply-To: <2vxzse65k938.fsf@kernel.org> (Pratyush Yadav's message of "Mon, 29 Jun 2026 11:08:11 +0200")
On Mon, Jun 29 2026, Pratyush Yadav wrote:
> On Mon, Jun 29 2026, Pasha Tatashin wrote:
>
>> On 06-26 13:57, Pratyush Yadav wrote:
>>> Hi Sami,
>>>
>>> On Sat, Jun 13 2026, Samiullah Khawaja wrote:
>>>
>>> > From: Pasha Tatashin <pasha.tatashin@soleen.com>
>>> >
>>> > Live update orchestrator file handlers depend on the preservation of
>>> > other files. To make sure that the dependency is preserved, the file
>>> > handlers needs to fetch the preservation token of the preserved
>>> > dependency. Similarly during restore, a file handler wants to fetch the
>>> > restored file of the dependency.
>>> >
>>> > Add APIs that allows fetching token of dependency during preservation,
>>> > and fetching the restored file dependency during restore.
>>> >
>>> > Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
>>> > Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
[...]
>>
>> To achieve this, LUO provides the .can_finish() callback. So, LUO does
>> two-phase verification:
>>
>> 1. It iterates through all tracked files and invokes .can_finish().
>> 2. Only if *all* files return success does it proceed to invoke .finish().
>>
>> If a VMM restores a file (such as guest_memfd) but fails to restore its
>> dependency (such as the VM FD), or attempts to close the session
>> prematurely, the .can_finish() check for that file will fail (returning
>> -EBUSY), and the entire finish sequence will abort. This guarantees
>> kernel-enforced correctness at the session boundary and without forcing
>> the VMM to execute restores in a strict sequential order, which anway
>> would not make any sense from kernel side due to circular dependecies
>> issue, where topological sort does not exist.
>>
>>>
>>> But on the preservation side, VMMs still do need to follow the
>>> topological order of dependencies. Because if they don't, the
>>> liveupdate_get_token_outgoing() call will fail and preservation can't
>>> proceed.
>>
>> Actually, preservation can also be performed in an order-independent manner.
>> While a handler can call liveupdate_get_token_outgoing() during .preserve(),
>> it can also defer this query until the .freeze() callback. Because .freeze()
>> is invoked after all files in the session have completed their .preserve() phase,
>> all dependency tokens are guaranteed to be available, completely eliminating any
>> topological ordering requirements during the initial preservation calls. It is
>> up to individual file handler implementations to decide whether they wish to
>> enforce ordering at .preserve() time or defer it to .freeze().
>
> That is the worst of both worlds. I get your point that LUO doesn't want
> to enforce dependency ordering. My arguments against that are somewhat
> subjective so I can live with this.
>
> But then you can't let file handlers enforce it as they wish. The
> dependency ordering is uAPI because it directly affects how VMMs
> preserve files. If the VMM has to keep track of dependencies for some
> file types and doesn't have to do so for others, that is a terrible and
> inconsistent API.
>
> Ideally, LUO should handle the dependencies on its own. preserve() can
> give LUO a list of files the preserved file depends on, and LUO makes
> sure all the dependencies are present in the session at freeze. We would
> also need a way of getting the dependent files back from LUO on
> retrieve(). That would make sure the dependencies are properly enforced
> both on freeze and finish, and the enforcement isn't left up to the file
> handlers.
>
> Unfortunately all that sounds fairly complicated so I am not sure if we
> want to do that just yet, although I would like to hear your thoughts on
> this.
We had discussion about this in the live update bi-weekly today. The
conclusion we arrived at is to keep the current functionality. That is,
we don't enforce preservation dependency.
But that also means file handlers can't try to get their dependent file
in their preserve() callback, since that would implicitly enforce
ordering. They always _have_ to do it from their freeze() callback.
Similarly, on retrieve side, file handlers enforce their dependent files
are restored via the can_finish() callback only.
So I think the next steps for this series is to clearly document this
requirement for file handlers in the documentation for
liveupdate_get_token_outgoing() and liveupdate_get_file_incoming().
Also, I think you need some way of tracking if the file was explicitly
restored by userspace, which is something file handlers would then need
to call in their can_finish().
[...]
--
Regards,
Pratyush Yadav
next prev parent reply other threads:[~2026-06-29 16:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-13 1:25 [PATCH 0/1] liveupdate: Add internal APIs for file preservation Samiullah Khawaja
2026-06-13 1:25 ` [PATCH 1/1] liveupdate: luo_file: " Samiullah Khawaja
2026-06-14 12:48 ` Pranjal Shrivastava
2026-06-26 11:57 ` Pratyush Yadav
2026-06-29 7:32 ` Pasha Tatashin
2026-06-29 9:08 ` Pratyush Yadav
2026-06-29 16:50 ` Pratyush Yadav [this message]
2026-06-15 12:28 ` [PATCH 0/1] liveupdate: " tarunsahu
2026-06-17 19:00 ` Mike Rapoport
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=2vxz7bnhjnpa.fsf@kernel.org \
--to=pratyush@kernel.org \
--cc=dmatlack@google.com \
--cc=graf@amazon.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=rppt@kernel.org \
--cc=skhawaja@google.com \
--cc=tarunsahu@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.