diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-08-18 10:43:01 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-08-18 10:43:01 -0700 |
| commit | 7b24dd46a70e94d8db83b50a04d46690fac216d0 (patch) | |
| tree | b03a5f0521d65701a9e0dc5717af94ca38755baf /kernel | |
| parent | ba24659b1dbee90d4ce7ffc7577e299f085533a1 (diff) | |
| parent | bcf2a0b55e322a663c9602c9e773770b87d3e629 (diff) | |
| download | linux-next-7b24dd46a70e94d8db83b50a04d46690fac216d0.tar.gz linux-next-7b24dd46a70e94d8db83b50a04d46690fac216d0.zip | |
Merge tag 'liveupdate-v7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux
Pull liveupdate updates from Mike Rapoport:
"Kexec Handover:
- Fix size calculation in kho_preserved_memory_reserve() for
preservations larger than 2 GiB
Live Update Orchestrator:
- move liveupdate selftest utilities into a library so that selftests
of subsystems participating in liveupdate, e.g. PCI and VFIO, can
use them and drop direct ioctl calls from the tests
- add end to end liveupdate test infrastructure that allows running
the tests across a kexec in QEMU
- remove redundant INIT_LIST_HEAD in luo_session_alloc()
- remember the error status of an FLB retrieve() and return it on
subsequent attempts rather than retrying retrieve() with an FLB in
an unexpected state
- reference count the outgoing FLB so that it cannot be freed while a
caller is using it, the same way it's done for the incoming FLB
- reject nonzero reserved field in LIVEUPDATE_SESSION_FINISH so that
it can be reused by a future extension"
* tag 'liveupdate-v7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/liveupdate/linux:
kho: fix size calculation in kho_preserved_memory_reserve()
selftests/liveupdate: Move luo_test_utils.* into a reusable library
selftests/liveupdate: Use luo_test_utils.c for liveupdate ioctl APIs
liveupdate: Remember FLB retrieve() status
liveupdate: Reference count outgoing FLB data
liveupdate: reject nonzero reserved value for SESSION_FINISH
liveupdate: Remove redundant INIT_LIST_HEAD in luo_session_alloc
selftests/liveupdate: add end to end test infrastructure and scripts
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/liveupdate/kexec_handover.c | 2 | ||||
| -rw-r--r-- | kernel/liveupdate/luo_flb.c | 20 | ||||
| -rw-r--r-- | kernel/liveupdate/luo_session.c | 7 |
3 files changed, 20 insertions, 9 deletions
diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c index 175c08a6e41e..6fad9152387a 100644 --- a/kernel/liveupdate/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -501,7 +501,7 @@ static int __init kho_preserved_memory_reserve(phys_addr_t phys, struct page *page; u64 sz; - sz = 1 << (order + PAGE_SHIFT); + sz = 1UL << (order + PAGE_SHIFT); page = kho_get_preserved_page(phys, order); /* Reserve the memory preserved in KHO in memblock */ diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c index 5c27134ce7ba..cd715a7c1d99 100644 --- a/kernel/liveupdate/luo_flb.c +++ b/kernel/liveupdate/luo_flb.c @@ -133,7 +133,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); @@ -168,7 +168,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) @@ -194,12 +197,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; } @@ -213,7 +217,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)) @@ -264,7 +268,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; @@ -289,7 +293,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); } /** @@ -544,6 +548,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; diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c index f38b5b18f3f8..f48e9a4185f9 100644 --- a/kernel/liveupdate/luo_session.c +++ b/kernel/liveupdate/luo_session.c @@ -154,7 +154,6 @@ static struct luo_session *luo_session_alloc(const char *name) return ERR_PTR(-ENOMEM); strscpy(session->name, name, sizeof(session->name)); - INIT_LIST_HEAD(&session->file_set.files_list); luo_file_set_init(&session->file_set); INIT_LIST_HEAD(&session->list); mutex_init(&session->mutex); @@ -316,8 +315,12 @@ static int luo_session_finish(struct luo_session *session, struct luo_ucmd *ucmd) { struct liveupdate_session_finish *argp = ucmd->cmd; - int err = luo_session_finish_one(session); + int err; + + if (argp->reserved) + return -EINVAL; + err = luo_session_finish_one(session); if (err) return err; |
