linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Matlack <dmatlack@google.com>
To: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: pratyush@kernel.org, rppt@kernel.org, skhawaja@google.com,
	 rientjes@google.com, corbet@lwn.net, akpm@linux-foundation.org,
	 kees@kernel.org, davidgow@google.com, pmladek@suse.com,
	 linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	 nicolas.frattaroli@collabora.com, linux-doc@vger.kernel.org,
	tamird@gmail.com,  raemoar63@gmail.com, graf@amazon.com,
	Bjorn Helgaas <bhelgaas@google.com>,
	 Alex Williamson <alex@shazbot.org>,
	Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [PATCH v9 4/5] liveupdate: luo_flb: Introduce File-Lifecycle-Bound global state
Date: Thu, 12 Mar 2026 16:59:08 -0700	[thread overview]
Message-ID: <CALzav=cJmgG04+Ba82Rnr3iKpU0gKD5WD3oF-_43rdD7T+REEQ@mail.gmail.com> (raw)
In-Reply-To: <20251218155752.3045808-5-pasha.tatashin@soleen.com>

On Thu, Dec 18, 2025 at 7:58 AM Pasha Tatashin
<pasha.tatashin@soleen.com> wrote:

> +static inline int liveupdate_register_flb(struct liveupdate_file_handler *fh,
> +                                         struct liveupdate_flb *flb)
> +{
> +       return -EOPNOTSUPP;
> +}

I think LUO could use a cleanup to return 0 in all the register
functions when Live Update is not enabled via CONFIG or parameter.

I think all of the users of these functions are going to want to
ignore -EOPNOTSUPP. memfd already does.

> +static int luo_flb_retrieve_one(struct liveupdate_flb *flb)
> +{
> +       struct luo_flb_private *private = luo_flb_get_private(flb);
> +       struct luo_flb_header *fh = &luo_flb_global.incoming;
> +       struct liveupdate_flb_op_args args = {0};
> +       bool found = false;
> +       int err;
> +
> +       guard(mutex)(&private->incoming.lock);
> +
> +       if (private->incoming.finished)
> +               return -ENODATA;
> +
> +       if (private->incoming.retrieved)
> +               return 0;
> +
> +       if (!fh->active)
> +               return -ENODATA;
> +
> +       for (int i = 0; i < fh->header_ser->count; i++) {
> +               if (!strcmp(fh->ser[i].name, flb->compatible)) {
> +                       private->incoming.data = fh->ser[i].data;
> +                       private->incoming.count = fh->ser[i].count;
> +                       found = true;
> +                       break;
> +               }
> +       }
> +
> +       if (!found)
> +               return -ENOENT;

FLB users have no way to distinguish between "there was no data
preserved" and "there was data preserved, but it was not a supported
version".

This is especially going to be important for PCI [1] since there's a
big difference between "there were no devices preserved" and "there
were devices preserved but the incoming kernel isn't compatible". The
former means there's nothing for the PCI subsystem to do wrt Live
Update. The latter means we should probably panic the system.

[1] https://lore.kernel.org/kvm/20260129212510.967611-3-dmatlack@google.com/

> +/**
> + * liveupdate_unregister_flb - Remove an FLB dependency from a file handler.
> + * @fh:   The file handler that is currently depending on the FLB.
> + * @flb:  The File-Lifecycle-Bound object to remove.
> + *
> + * Removes the association between the specified file handler and the FLB
> + * previously established by liveupdate_register_flb().
> + *
> + * This function manages the global lifecycle of the FLB. It decrements the
> + * FLB's usage count. If this was the last file handler referencing this FLB,
> + * the FLB is removed from the global registry and the reference to its
> + * owner module (acquired during registration) is released.
> + *
> + * Context: This function ensures the session is quiesced (no active FDs
> + *          being created) during the update. It is typically called from a
> + *          subsystem's module exit function.
> + * Return: 0 on success.
> + *         -EOPNOTSUPP if live update is disabled.
> + *         -EBUSY if the live update session is active and cannot be quiesced.
> + *         -ENOENT if the FLB was not found in the file handler's list.
> + */
> +int liveupdate_unregister_flb(struct liveupdate_file_handler *fh,
> +                             struct liveupdate_flb *flb)

Alex Williamson and Jason Gunthrope both suggested this should return void.

  https://lore.kernel.org/kvm/20260303210733.GG972761@nvidia.com/

I suspect liveupdate_unregister_file_handler() should as well. I don't
think there's anything callers can do if unregister fails.


  reply	other threads:[~2026-03-12 23:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 15:57 [PATCH v2 0/5] list private v2 & luo flb v9 Pasha Tatashin
2025-12-18 15:57 ` [PATCH v2 1/5] list: add primitives for private list manipulations Pasha Tatashin
2025-12-18 15:57 ` [PATCH v2 2/5] list: add kunit test for private list primitives Pasha Tatashin
2025-12-18 15:57 ` [PATCH v2 3/5] liveupdate: luo_file: Use private list Pasha Tatashin
2025-12-18 15:57 ` [PATCH v9 4/5] liveupdate: luo_flb: Introduce File-Lifecycle-Bound global state Pasha Tatashin
2026-03-12 23:59   ` David Matlack [this message]
2026-03-13  1:00     ` Pasha Tatashin
2025-12-18 15:57 ` [PATCH v9 5/5] tests/liveupdate: Add in-kernel liveupdate test Pasha Tatashin
2025-12-18 21:07 ` [PATCH v2 0/5] list private v2 & luo flb v9 Andrew Morton
2025-12-18 22:30   ` Pasha Tatashin
2025-12-18 22:34     ` Andrew Morton
2025-12-19  6:46   ` Mike Rapoport
2025-12-19  6:53     ` 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='CALzav=cJmgG04+Ba82Rnr3iKpU0gKD5WD3oF-_43rdD7T+REEQ@mail.gmail.com' \
    --to=dmatlack@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@shazbot.org \
    --cc=bhelgaas@google.com \
    --cc=corbet@lwn.net \
    --cc=davidgow@google.com \
    --cc=graf@amazon.com \
    --cc=jgg@nvidia.com \
    --cc=kees@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nicolas.frattaroli@collabora.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=pmladek@suse.com \
    --cc=pratyush@kernel.org \
    --cc=raemoar63@gmail.com \
    --cc=rientjes@google.com \
    --cc=rppt@kernel.org \
    --cc=skhawaja@google.com \
    --cc=tamird@gmail.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