* [PATCH 1/2] liveupdate: Reference count outgoing FLB data
2026-05-28 17:41 [PATCH 0/2] liveupdate: Small FLB fixes David Matlack
@ 2026-05-28 17:41 ` David Matlack
2026-06-02 17:15 ` Pratyush Yadav
2026-06-03 3:36 ` Pasha Tatashin
2026-05-28 17:41 ` [PATCH 2/2] liveupdate: Remember FLB retrieve() status David Matlack
2026-06-04 5:28 ` [PATCH 0/2] liveupdate: Small FLB fixes Mike Rapoport
2 siblings, 2 replies; 10+ messages in thread
From: David Matlack @ 2026-05-28 17:41 UTC (permalink / raw)
To: kexec, linux-kernel
Cc: Andrew Morton, Mike Rapoport, Pasha Tatashin, Pratyush Yadav,
David Matlack
Increment the outgoing FLB refcount in liveupdate_flb_get_outgoing() so
that the FLB structure cannot be freed while the caller is actively
using it. Add an additional liveupdate_flb_put_outgoing() function so
the caller can explicitly indicate when it is done using the outgoing
FLB.
During a Live Update, the kernel may need to fetch the outgoing FLB
outside of the scope of a file handler's preserve() and unpreserve()
callbacks. In that situation there is no way for the caller to protect
itself against the outgoing FLB from being freed while it is using it.
Incrementing the reference count in liveupdate_flb_get_outgoing()
ensures it cannot be freed.
This change also aligns the outgoing FLB lifecycle management with the
incoming FLB, since the latter uses the same get/put semantics.
Fixes: cab056f2aae7 ("liveupdate: luo_flb: introduce File-Lifecycle-Bound global state")
Assisted-by: Gemini:gemini-3-pro-preview
Signed-off-by: David Matlack <dmatlack@google.com>
---
include/linux/liveupdate.h | 5 +++++
kernel/liveupdate/luo_flb.c | 10 +++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/include/linux/liveupdate.h b/include/linux/liveupdate.h
index 88722e5caf02..c344bf987b63 100644
--- a/include/linux/liveupdate.h
+++ b/include/linux/liveupdate.h
@@ -243,6 +243,7 @@ int liveupdate_flb_get_incoming(struct liveupdate_flb *flb, void **objp);
void liveupdate_flb_put_incoming(struct liveupdate_flb *flb);
int liveupdate_flb_get_outgoing(struct liveupdate_flb *flb, void **objp);
+void liveupdate_flb_put_outgoing(struct liveupdate_flb *flb);
#else /* CONFIG_LIVEUPDATE */
@@ -292,5 +293,9 @@ static inline int liveupdate_flb_get_outgoing(struct liveupdate_flb *flb,
return -EOPNOTSUPP;
}
+static inline void liveupdate_flb_put_outgoing(struct liveupdate_flb *flb)
+{
+}
+
#endif /* CONFIG_LIVEUPDATE */
#endif /* _LINUX_LIVEUPDATE_H */
diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c
index 8f5c5dd01cd0..7ddef552ff6b 100644
--- a/kernel/liveupdate/luo_flb.c
+++ b/kernel/liveupdate/luo_flb.c
@@ -135,7 +135,7 @@ static int luo_flb_file_preserve_one(struct liveupdate_flb *flb)
return 0;
}
-static void luo_flb_file_unpreserve_one(struct liveupdate_flb *flb)
+void liveupdate_flb_put_outgoing(struct liveupdate_flb *flb)
{
struct luo_flb_private *private = luo_flb_get_private(flb);
@@ -266,7 +266,7 @@ int luo_flb_file_preserve(struct liveupdate_file_handler *fh)
exit_err:
list_for_each_entry_continue_reverse(iter, flb_list, list)
- luo_flb_file_unpreserve_one(iter->flb);
+ liveupdate_flb_put_outgoing(iter->flb);
up_read(&luo_register_rwlock);
return err;
@@ -291,7 +291,7 @@ void luo_flb_file_unpreserve(struct liveupdate_file_handler *fh)
guard(rwsem_read)(&luo_register_rwlock);
list_for_each_entry_reverse(iter, flb_list, list)
- luo_flb_file_unpreserve_one(iter->flb);
+ liveupdate_flb_put_outgoing(iter->flb);
}
/**
@@ -546,6 +546,10 @@ int liveupdate_flb_get_outgoing(struct liveupdate_flb *flb, void **objp)
return -EOPNOTSUPP;
guard(mutex)(&private->outgoing.lock);
+ if (!private->outgoing.obj)
+ return -ENOENT;
+
+ refcount_inc(&private->outgoing.count);
*objp = private->outgoing.obj;
return 0;
--
2.54.0.823.g6e5bcc1fc9-goog
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 1/2] liveupdate: Reference count outgoing FLB data
2026-05-28 17:41 ` [PATCH 1/2] liveupdate: Reference count outgoing FLB data David Matlack
@ 2026-06-02 17:15 ` Pratyush Yadav
2026-06-02 17:25 ` David Matlack
2026-06-03 3:36 ` Pasha Tatashin
1 sibling, 1 reply; 10+ messages in thread
From: Pratyush Yadav @ 2026-06-02 17:15 UTC (permalink / raw)
To: David Matlack
Cc: kexec, linux-kernel, Andrew Morton, Mike Rapoport, Pasha Tatashin,
Pratyush Yadav
Hi David,
On Thu, May 28 2026, David Matlack wrote:
> Increment the outgoing FLB refcount in liveupdate_flb_get_outgoing() so
> that the FLB structure cannot be freed while the caller is actively
> using it. Add an additional liveupdate_flb_put_outgoing() function so
> the caller can explicitly indicate when it is done using the outgoing
> FLB.
>
> During a Live Update, the kernel may need to fetch the outgoing FLB
> outside of the scope of a file handler's preserve() and unpreserve()
> callbacks. In that situation there is no way for the caller to protect
> itself against the outgoing FLB from being freed while it is using it.
> Incrementing the reference count in liveupdate_flb_get_outgoing()
> ensures it cannot be freed.
We grab a reference to the FLB's module when the first file using the
FLB is preserved. So the FLB should never go away while preserved files
exist. Once all preserved files go away, you normally shouldn't be doing
anything with the FLB anyway.
Can you please elaborate on the use case and why this is a problem?
Using the FLB outside of the standard LUO file callbacks sounds
problematic.
>
> This change also aligns the outgoing FLB lifecycle management with the
> incoming FLB, since the latter uses the same get/put semantics.
>
> Fixes: cab056f2aae7 ("liveupdate: luo_flb: introduce File-Lifecycle-Bound global state")
> Assisted-by: Gemini:gemini-3-pro-preview
> Signed-off-by: David Matlack <dmatlack@google.com>
[...]
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 1/2] liveupdate: Reference count outgoing FLB data
2026-06-02 17:15 ` Pratyush Yadav
@ 2026-06-02 17:25 ` David Matlack
0 siblings, 0 replies; 10+ messages in thread
From: David Matlack @ 2026-06-02 17:25 UTC (permalink / raw)
To: Pratyush Yadav
Cc: kexec, linux-kernel, Andrew Morton, Mike Rapoport, Pasha Tatashin
On 2026-06-02 07:15 PM, Pratyush Yadav wrote:
> Hi David,
>
> On Thu, May 28 2026, David Matlack wrote:
>
> > Increment the outgoing FLB refcount in liveupdate_flb_get_outgoing() so
> > that the FLB structure cannot be freed while the caller is actively
> > using it. Add an additional liveupdate_flb_put_outgoing() function so
> > the caller can explicitly indicate when it is done using the outgoing
> > FLB.
> >
> > During a Live Update, the kernel may need to fetch the outgoing FLB
> > outside of the scope of a file handler's preserve() and unpreserve()
> > callbacks. In that situation there is no way for the caller to protect
> > itself against the outgoing FLB from being freed while it is using it.
> > Incrementing the reference count in liveupdate_flb_get_outgoing()
> > ensures it cannot be freed.
>
> We grab a reference to the FLB's module when the first file using the
> FLB is preserved. So the FLB should never go away while preserved files
> exist. Once all preserved files go away, you normally shouldn't be doing
> anything with the FLB anyway.
>
> Can you please elaborate on the use case and why this is a problem?
> Using the FLB outside of the standard LUO file callbacks sounds
> problematic.
The scenario I had in mind was to remove a PCI device from the outgoing
FLB if the device is forcibly removed while the file is still preserved,
for example someone writes 1 to /sys/bus/pci/devices/.../remove or a
device is physically hot-unplugged.
Specifically this call here from the patch below:
+void pci_liveupdate_cleanup_device(struct pci_dev *dev)
+{
+ /*
+ * It should be safe to READ_ONCE() outside of the rwsem during cleanup
+ * since there should no longer be any references to @dev on the system.
+ */
+ if (READ_ONCE(dev->liveupdate.outgoing)) {
+ pci_WARN(dev, 1, "Destroying outgoing-preserved device!\n");
+ pci_liveupdate_unpreserve(dev);
+ }
+}
https://lore.kernel.org/linux-pci/20260522202410.3104264-3-dmatlack@google.com/
I can do this without adding reference counting to
liveupdate_flb_get_outgoing(), but the reference counting makes it
obvious that the outgoing FLB will not be freed while I am using it
here, and also aligns with liveupdate_flb_get_incoming().
> >
> > This change also aligns the outgoing FLB lifecycle management with the
> > incoming FLB, since the latter uses the same get/put semantics.
> >
> > Fixes: cab056f2aae7 ("liveupdate: luo_flb: introduce File-Lifecycle-Bound global state")
> > Assisted-by: Gemini:gemini-3-pro-preview
> > Signed-off-by: David Matlack <dmatlack@google.com>
> [...]
>
> --
> Regards,
> Pratyush Yadav
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] liveupdate: Reference count outgoing FLB data
2026-05-28 17:41 ` [PATCH 1/2] liveupdate: Reference count outgoing FLB data David Matlack
2026-06-02 17:15 ` Pratyush Yadav
@ 2026-06-03 3:36 ` Pasha Tatashin
1 sibling, 0 replies; 10+ messages in thread
From: Pasha Tatashin @ 2026-06-03 3:36 UTC (permalink / raw)
To: David Matlack
Cc: kexec, linux-kernel, Andrew Morton, Mike Rapoport, Pasha Tatashin,
Pratyush Yadav
On 05-28 17:41, David Matlack wrote:
> Increment the outgoing FLB refcount in liveupdate_flb_get_outgoing() so
> that the FLB structure cannot be freed while the caller is actively
> using it. Add an additional liveupdate_flb_put_outgoing() function so
> the caller can explicitly indicate when it is done using the outgoing
> FLB.
>
> During a Live Update, the kernel may need to fetch the outgoing FLB
> outside of the scope of a file handler's preserve() and unpreserve()
> callbacks. In that situation there is no way for the caller to protect
> itself against the outgoing FLB from being freed while it is using it.
> Incrementing the reference count in liveupdate_flb_get_outgoing()
> ensures it cannot be freed.
>
> This change also aligns the outgoing FLB lifecycle management with the
> incoming FLB, since the latter uses the same get/put semantics.
>
> Fixes: cab056f2aae7 ("liveupdate: luo_flb: introduce File-Lifecycle-Bound global state")
> Assisted-by: Gemini:gemini-3-pro-preview
> Signed-off-by: David Matlack <dmatlack@google.com>
Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> ---
> include/linux/liveupdate.h | 5 +++++
> kernel/liveupdate/luo_flb.c | 10 +++++++---
> 2 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/liveupdate.h b/include/linux/liveupdate.h
> index 88722e5caf02..c344bf987b63 100644
> --- a/include/linux/liveupdate.h
> +++ b/include/linux/liveupdate.h
> @@ -243,6 +243,7 @@ int liveupdate_flb_get_incoming(struct liveupdate_flb *flb, void **objp);
> void liveupdate_flb_put_incoming(struct liveupdate_flb *flb);
>
> int liveupdate_flb_get_outgoing(struct liveupdate_flb *flb, void **objp);
> +void liveupdate_flb_put_outgoing(struct liveupdate_flb *flb);
>
> #else /* CONFIG_LIVEUPDATE */
>
> @@ -292,5 +293,9 @@ static inline int liveupdate_flb_get_outgoing(struct liveupdate_flb *flb,
> return -EOPNOTSUPP;
> }
>
> +static inline void liveupdate_flb_put_outgoing(struct liveupdate_flb *flb)
> +{
> +}
> +
> #endif /* CONFIG_LIVEUPDATE */
> #endif /* _LINUX_LIVEUPDATE_H */
> diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c
> index 8f5c5dd01cd0..7ddef552ff6b 100644
> --- a/kernel/liveupdate/luo_flb.c
> +++ b/kernel/liveupdate/luo_flb.c
> @@ -135,7 +135,7 @@ static int luo_flb_file_preserve_one(struct liveupdate_flb *flb)
> return 0;
> }
>
> -static void luo_flb_file_unpreserve_one(struct liveupdate_flb *flb)
> +void liveupdate_flb_put_outgoing(struct liveupdate_flb *flb)
> {
> struct luo_flb_private *private = luo_flb_get_private(flb);
>
> @@ -266,7 +266,7 @@ int luo_flb_file_preserve(struct liveupdate_file_handler *fh)
>
> exit_err:
> list_for_each_entry_continue_reverse(iter, flb_list, list)
> - luo_flb_file_unpreserve_one(iter->flb);
> + liveupdate_flb_put_outgoing(iter->flb);
> up_read(&luo_register_rwlock);
>
> return err;
> @@ -291,7 +291,7 @@ void luo_flb_file_unpreserve(struct liveupdate_file_handler *fh)
>
> guard(rwsem_read)(&luo_register_rwlock);
> list_for_each_entry_reverse(iter, flb_list, list)
> - luo_flb_file_unpreserve_one(iter->flb);
> + liveupdate_flb_put_outgoing(iter->flb);
> }
>
> /**
> @@ -546,6 +546,10 @@ int liveupdate_flb_get_outgoing(struct liveupdate_flb *flb, void **objp)
> return -EOPNOTSUPP;
>
> guard(mutex)(&private->outgoing.lock);
> + if (!private->outgoing.obj)
> + return -ENOENT;
> +
> + refcount_inc(&private->outgoing.count);
> *objp = private->outgoing.obj;
>
> return 0;
> --
> 2.54.0.823.g6e5bcc1fc9-goog
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/2] liveupdate: Remember FLB retrieve() status
2026-05-28 17:41 [PATCH 0/2] liveupdate: Small FLB fixes David Matlack
2026-05-28 17:41 ` [PATCH 1/2] liveupdate: Reference count outgoing FLB data David Matlack
@ 2026-05-28 17:41 ` David Matlack
2026-06-02 17:18 ` Pratyush Yadav
2026-06-03 3:36 ` Pasha Tatashin
2026-06-04 5:28 ` [PATCH 0/2] liveupdate: Small FLB fixes Mike Rapoport
2 siblings, 2 replies; 10+ messages in thread
From: David Matlack @ 2026-05-28 17:41 UTC (permalink / raw)
To: kexec, linux-kernel
Cc: Andrew Morton, Mike Rapoport, Pasha Tatashin, Pratyush Yadav,
David Matlack
LUO keeps track of successful retrieve attempts on an FLB. It does so
to avoid multiple retrievals of the same FLB. Multiple retrievals cause
problems because once the FLB is retrieved, the serialized data
structures are likely freed and the FLB is likely in a very different
state from what the code expects.
All this works well when retrieve succeeds. When it fails,
luo_flb_retrieve_one() returns the error immediately, without ever
storing anywhere that a retrieve was attempted or what its error code
was. If the user attempts to retrieve another file registered with the
same FLB, LUO will attempt to call the FLB's retrieve() callback again.
The retry is problematic for much of the same reasons listed above. The
FLB is likely in a very different state than what the retrieve logic
normally expects (e.g. some KHO pages may have already been restored and
freed).
There is no sane way of attempting the retrieve again. Remember the
error retrieve returned and directly return it on a retry.
This is done by changing the retrieved bool to a retrieve_status
integer. A value of 0 means retrieve was never attempted, a positive
value means it succeeded, and a negative value means it failed and the
error code is the value.
This is similar to commit f85b1c6af5bc ("liveupdate: luo_file: remember
retrieve() status") which did the same for LUO files.
Fixes: cab056f2aae7 ("liveupdate: luo_flb: introduce File-Lifecycle-Bound global state")
Assisted-by: Gemini:gemini-3-pro-preview
Signed-off-by: David Matlack <dmatlack@google.com>
---
include/linux/liveupdate.h | 6 ++++--
kernel/liveupdate/luo_flb.c | 10 +++++++---
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/include/linux/liveupdate.h b/include/linux/liveupdate.h
index c344bf987b63..63ea5417de84 100644
--- a/include/linux/liveupdate.h
+++ b/include/linux/liveupdate.h
@@ -173,7 +173,9 @@ struct liveupdate_flb_ops {
* @lock: A mutex that protects all fields within this structure, providing
* the synchronization service for the FLB's ops.
* @finished: True once the FLB's finish() callback has run.
- * @retrieved: True once the FLB's retrieve() callback has run.
+ * @retrieve_status: Status code indicating whether retrieve() has been
+ * attempted. 0 means not attempted, 1 means successful,
+ * and negative value means it failed with that error code.
*/
struct luo_flb_private_state {
refcount_t count;
@@ -181,7 +183,7 @@ struct luo_flb_private_state {
void *obj;
struct mutex lock;
bool finished;
- bool retrieved;
+ int retrieve_status;
};
/*
diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c
index 7ddef552ff6b..f8852f7e62e5 100644
--- a/kernel/liveupdate/luo_flb.c
+++ b/kernel/liveupdate/luo_flb.c
@@ -170,7 +170,10 @@ static int luo_flb_retrieve_one(struct liveupdate_flb *flb)
if (private->incoming.finished)
return -ENODATA;
- if (private->incoming.retrieved)
+ if (private->incoming.retrieve_status < 0)
+ return private->incoming.retrieve_status;
+
+ if (private->incoming.retrieve_status > 0)
return 0;
if (!fh->active)
@@ -196,12 +199,13 @@ static int luo_flb_retrieve_one(struct liveupdate_flb *flb)
err = flb->ops->retrieve(&args);
if (err) {
+ private->incoming.retrieve_status = err;
module_put(flb->ops->owner);
return err;
}
private->incoming.obj = args.obj;
- private->incoming.retrieved = true;
+ private->incoming.retrieve_status = 1;
return 0;
}
@@ -215,7 +219,7 @@ void liveupdate_flb_put_incoming(struct liveupdate_flb *flb)
if (!refcount_dec_and_test(&private->incoming.count))
return;
- if (!private->incoming.retrieved) {
+ if (private->incoming.retrieve_status <= 0) {
int err = luo_flb_retrieve_one(flb);
if (WARN_ON(err))
--
2.54.0.823.g6e5bcc1fc9-goog
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 2/2] liveupdate: Remember FLB retrieve() status
2026-05-28 17:41 ` [PATCH 2/2] liveupdate: Remember FLB retrieve() status David Matlack
@ 2026-06-02 17:18 ` Pratyush Yadav
2026-06-03 3:36 ` Pasha Tatashin
1 sibling, 0 replies; 10+ messages in thread
From: Pratyush Yadav @ 2026-06-02 17:18 UTC (permalink / raw)
To: David Matlack
Cc: kexec, linux-kernel, Andrew Morton, Mike Rapoport, Pasha Tatashin,
Pratyush Yadav
On Thu, May 28 2026, David Matlack wrote:
> LUO keeps track of successful retrieve attempts on an FLB. It does so
> to avoid multiple retrievals of the same FLB. Multiple retrievals cause
> problems because once the FLB is retrieved, the serialized data
> structures are likely freed and the FLB is likely in a very different
> state from what the code expects.
>
> All this works well when retrieve succeeds. When it fails,
> luo_flb_retrieve_one() returns the error immediately, without ever
> storing anywhere that a retrieve was attempted or what its error code
> was. If the user attempts to retrieve another file registered with the
> same FLB, LUO will attempt to call the FLB's retrieve() callback again.
>
> The retry is problematic for much of the same reasons listed above. The
> FLB is likely in a very different state than what the retrieve logic
> normally expects (e.g. some KHO pages may have already been restored and
> freed).
>
> There is no sane way of attempting the retrieve again. Remember the
> error retrieve returned and directly return it on a retry.
>
> This is done by changing the retrieved bool to a retrieve_status
> integer. A value of 0 means retrieve was never attempted, a positive
> value means it succeeded, and a negative value means it failed and the
> error code is the value.
>
> This is similar to commit f85b1c6af5bc ("liveupdate: luo_file: remember
> retrieve() status") which did the same for LUO files.
>
> Fixes: cab056f2aae7 ("liveupdate: luo_flb: introduce File-Lifecycle-Bound global state")
> Assisted-by: Gemini:gemini-3-pro-preview
> Signed-off-by: David Matlack <dmatlack@google.com>
Reviewed-by: Pratyush Yadav (Google) <pratyush@kernel.org>
Thanks for fixing this!
[...]
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 2/2] liveupdate: Remember FLB retrieve() status
2026-05-28 17:41 ` [PATCH 2/2] liveupdate: Remember FLB retrieve() status David Matlack
2026-06-02 17:18 ` Pratyush Yadav
@ 2026-06-03 3:36 ` Pasha Tatashin
1 sibling, 0 replies; 10+ messages in thread
From: Pasha Tatashin @ 2026-06-03 3:36 UTC (permalink / raw)
To: David Matlack
Cc: kexec, linux-kernel, Andrew Morton, Mike Rapoport, Pasha Tatashin,
Pratyush Yadav
On 05-28 17:41, David Matlack wrote:
> LUO keeps track of successful retrieve attempts on an FLB. It does so
> to avoid multiple retrievals of the same FLB. Multiple retrievals cause
> problems because once the FLB is retrieved, the serialized data
> structures are likely freed and the FLB is likely in a very different
> state from what the code expects.
>
> All this works well when retrieve succeeds. When it fails,
> luo_flb_retrieve_one() returns the error immediately, without ever
> storing anywhere that a retrieve was attempted or what its error code
> was. If the user attempts to retrieve another file registered with the
> same FLB, LUO will attempt to call the FLB's retrieve() callback again.
>
> The retry is problematic for much of the same reasons listed above. The
> FLB is likely in a very different state than what the retrieve logic
> normally expects (e.g. some KHO pages may have already been restored and
> freed).
>
> There is no sane way of attempting the retrieve again. Remember the
> error retrieve returned and directly return it on a retry.
>
> This is done by changing the retrieved bool to a retrieve_status
> integer. A value of 0 means retrieve was never attempted, a positive
> value means it succeeded, and a negative value means it failed and the
> error code is the value.
>
> This is similar to commit f85b1c6af5bc ("liveupdate: luo_file: remember
> retrieve() status") which did the same for LUO files.
>
> Fixes: cab056f2aae7 ("liveupdate: luo_flb: introduce File-Lifecycle-Bound global state")
> Assisted-by: Gemini:gemini-3-pro-preview
> Signed-off-by: David Matlack <dmatlack@google.com>
Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> ---
> include/linux/liveupdate.h | 6 ++++--
> kernel/liveupdate/luo_flb.c | 10 +++++++---
> 2 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/liveupdate.h b/include/linux/liveupdate.h
> index c344bf987b63..63ea5417de84 100644
> --- a/include/linux/liveupdate.h
> +++ b/include/linux/liveupdate.h
> @@ -173,7 +173,9 @@ struct liveupdate_flb_ops {
> * @lock: A mutex that protects all fields within this structure, providing
> * the synchronization service for the FLB's ops.
> * @finished: True once the FLB's finish() callback has run.
> - * @retrieved: True once the FLB's retrieve() callback has run.
> + * @retrieve_status: Status code indicating whether retrieve() has been
> + * attempted. 0 means not attempted, 1 means successful,
> + * and negative value means it failed with that error code.
> */
> struct luo_flb_private_state {
> refcount_t count;
> @@ -181,7 +183,7 @@ struct luo_flb_private_state {
> void *obj;
> struct mutex lock;
> bool finished;
> - bool retrieved;
> + int retrieve_status;
> };
>
> /*
> diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c
> index 7ddef552ff6b..f8852f7e62e5 100644
> --- a/kernel/liveupdate/luo_flb.c
> +++ b/kernel/liveupdate/luo_flb.c
> @@ -170,7 +170,10 @@ static int luo_flb_retrieve_one(struct liveupdate_flb *flb)
> if (private->incoming.finished)
> return -ENODATA;
>
> - if (private->incoming.retrieved)
> + if (private->incoming.retrieve_status < 0)
> + return private->incoming.retrieve_status;
> +
> + if (private->incoming.retrieve_status > 0)
> return 0;
>
> if (!fh->active)
> @@ -196,12 +199,13 @@ static int luo_flb_retrieve_one(struct liveupdate_flb *flb)
>
> err = flb->ops->retrieve(&args);
> if (err) {
> + private->incoming.retrieve_status = err;
> module_put(flb->ops->owner);
> return err;
> }
>
> private->incoming.obj = args.obj;
> - private->incoming.retrieved = true;
> + private->incoming.retrieve_status = 1;
>
> return 0;
> }
> @@ -215,7 +219,7 @@ void liveupdate_flb_put_incoming(struct liveupdate_flb *flb)
> if (!refcount_dec_and_test(&private->incoming.count))
> return;
>
> - if (!private->incoming.retrieved) {
> + if (private->incoming.retrieve_status <= 0) {
> int err = luo_flb_retrieve_one(flb);
>
> if (WARN_ON(err))
> --
> 2.54.0.823.g6e5bcc1fc9-goog
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] liveupdate: Small FLB fixes
2026-05-28 17:41 [PATCH 0/2] liveupdate: Small FLB fixes David Matlack
2026-05-28 17:41 ` [PATCH 1/2] liveupdate: Reference count outgoing FLB data David Matlack
2026-05-28 17:41 ` [PATCH 2/2] liveupdate: Remember FLB retrieve() status David Matlack
@ 2026-06-04 5:28 ` Mike Rapoport
2026-06-05 13:09 ` Pratyush Yadav
2 siblings, 1 reply; 10+ messages in thread
From: Mike Rapoport @ 2026-06-04 5:28 UTC (permalink / raw)
To: David Matlack
Cc: kexec, linux-kernel, Andrew Morton, Pasha Tatashin,
Pratyush Yadav
On Thu, May 28, 2026 at 05:41:38PM +0000, David Matlack wrote:
> This series has 2 small fixes to how FLBs are managed. First is to
> increase the outgoing FLB refcount during liveupdate_flb_get_outgoing()
> so it cannot be freed while the caller is using it, and to align with
> the semantics of liveupdate_flb_get_incoming(). The second is to prevent
> FLB retrieve() from being called multiple times if the first attempt
> fails.
>
> Both of these changes are needed for the correctness of the PCI core
> support for Live Update:
>
> https://lore.kernel.org/linux-pci/20260522202410.3104264-1-dmatlack@google.com/
We are late in the release cycle and since there no in-tree flb users let's
postpone this after rc1.
> David Matlack (2):
> liveupdate: Reference count outgoing FLB data
> liveupdate: Remember FLB retrieve() status
>
> include/linux/liveupdate.h | 11 +++++++++--
> kernel/liveupdate/luo_flb.c | 20 ++++++++++++++------
> 2 files changed, 23 insertions(+), 8 deletions(-)
>
>
> base-commit: 5428435567cbe06c19914592fc22ca23c9ca1de5
> --
> 2.54.0.823.g6e5bcc1fc9-goog
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] liveupdate: Small FLB fixes
2026-06-04 5:28 ` [PATCH 0/2] liveupdate: Small FLB fixes Mike Rapoport
@ 2026-06-05 13:09 ` Pratyush Yadav
0 siblings, 0 replies; 10+ messages in thread
From: Pratyush Yadav @ 2026-06-05 13:09 UTC (permalink / raw)
To: Mike Rapoport
Cc: David Matlack, kexec, linux-kernel, Andrew Morton, Pasha Tatashin,
Pratyush Yadav
On Thu, Jun 04 2026, Mike Rapoport wrote:
> On Thu, May 28, 2026 at 05:41:38PM +0000, David Matlack wrote:
>> This series has 2 small fixes to how FLBs are managed. First is to
>> increase the outgoing FLB refcount during liveupdate_flb_get_outgoing()
>> so it cannot be freed while the caller is using it, and to align with
>> the semantics of liveupdate_flb_get_incoming(). The second is to prevent
>> FLB retrieve() from being called multiple times if the first attempt
>> fails.
>>
>> Both of these changes are needed for the correctness of the PCI core
>> support for Live Update:
>>
>> https://lore.kernel.org/linux-pci/20260522202410.3104264-1-dmatlack@google.com/
>
> We are late in the release cycle and since there no in-tree flb users let's
> postpone this after rc1.
Yes, I agree.
[...]
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 10+ messages in thread