From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: rppt@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com,
dmatlack@google.com, pratyush@kernel.org
Subject: [PATCH v2 5/8] liveupdate: Remove luo_session_quiesce()
Date: Wed, 18 Mar 2026 10:16:43 -0400 [thread overview]
Message-ID: <20260318141637.1870220-15-pasha.tatashin@soleen.com> (raw)
In-Reply-To: <20260318141637.1870220-10-pasha.tatashin@soleen.com>
Now that FLB module references are handled dynamically during active
sessions, we can safely remove the luo_session_quiesce() and
luo_session_resume() mechanism.
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
---
kernel/liveupdate/luo_file.c | 21 ++-------------
kernel/liveupdate/luo_flb.c | 46 +++++---------------------------
kernel/liveupdate/luo_internal.h | 2 --
kernel/liveupdate/luo_session.c | 44 ------------------------------
4 files changed, 9 insertions(+), 104 deletions(-)
diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c
index b124fd747841..c0ce08d55747 100644
--- a/kernel/liveupdate/luo_file.c
+++ b/kernel/liveupdate/luo_file.c
@@ -846,21 +846,12 @@ int liveupdate_register_file_handler(struct liveupdate_file_handler *fh)
return -EINVAL;
}
- /*
- * Ensure the system is quiescent (no active sessions).
- * This prevents registering new handlers while sessions are active or
- * while deserialization is in progress.
- */
- if (!luo_session_quiesce())
- return -EBUSY;
-
scoped_guard(rwsem_write, &luo_file_handler_lock) {
/* Check for duplicate compatible strings */
list_private_for_each_entry(fh_iter, &luo_file_handler_list, list) {
if (!strcmp(fh_iter->compatible, fh->compatible)) {
pr_err("File handler registration failed: Compatible string '%s' already registered.\n",
fh->compatible);
- luo_session_resume();
return -EEXIST;
}
}
@@ -870,7 +861,6 @@ int liveupdate_register_file_handler(struct liveupdate_file_handler *fh)
INIT_LIST_HEAD(&ACCESS_PRIVATE(fh, list));
list_add_tail(&ACCESS_PRIVATE(fh, list), &luo_file_handler_list);
}
- luo_session_resume();
liveupdate_test_register(fh);
@@ -885,13 +875,12 @@ int liveupdate_register_file_handler(struct liveupdate_file_handler *fh)
* reverses the operations of liveupdate_register_file_handler().
*
* It ensures safe removal by checking that:
- * No live update session is currently in progress.
* No FLB registered with this file handler.
*
* If the unregistration fails, the internal test state is reverted.
*
* Return: 0 Success. -EOPNOTSUPP when live update is not enabled. -EBUSY A live
- * update is in progress, can't quiesce live update or FLB is registred with
+ * update is in progress, FLB is registred with
* this file handler.
*/
int liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh)
@@ -901,18 +890,12 @@ int liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh)
liveupdate_test_unregister(fh);
- if (!luo_session_quiesce())
- goto err_register;
-
scoped_guard(rwsem_write, &luo_file_handler_lock) {
- if (!list_empty(&ACCESS_PRIVATE(fh, flb_list))) {
- luo_session_resume();
+ if (!list_empty(&ACCESS_PRIVATE(fh, flb_list)))
goto err_register;
- }
list_del(&ACCESS_PRIVATE(fh, list));
}
- luo_session_resume();
return 0;
diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c
index 98336cd23aa5..8bbe11a7286b 100644
--- a/kernel/liveupdate/luo_flb.c
+++ b/kernel/liveupdate/luo_flb.c
@@ -346,7 +346,6 @@ int liveupdate_register_flb(struct liveupdate_file_handler *fh,
struct luo_flb_link *link __free(kfree) = NULL;
struct liveupdate_flb *gflb;
struct luo_flb_link *iter;
- int err;
if (!liveupdate_enabled())
return -EOPNOTSUPP;
@@ -367,22 +366,13 @@ int liveupdate_register_flb(struct liveupdate_file_handler *fh,
if (!link)
return -ENOMEM;
- /*
- * Ensure the system is quiescent (no active sessions).
- * This acts as a global lock for registration: no other thread can
- * be in this section, and no sessions can be creating/using FDs.
- */
- if (!luo_session_quiesce())
- return -EBUSY;
-
guard(rwsem_write)(&luo_flb_lock);
guard(rwsem_write)(&ACCESS_PRIVATE(fh, flb_lock));
/* Check that this FLB is not already linked to this file handler */
- err = -EEXIST;
list_for_each_entry(iter, flb_list, list) {
if (iter->flb == flb)
- goto err_resume;
+ return -EEXIST;
}
/*
@@ -390,20 +380,16 @@ int liveupdate_register_flb(struct liveupdate_file_handler *fh,
* is registered
*/
if (!private->users) {
- if (WARN_ON(!list_empty(&private->list))) {
- err = -EINVAL;
- goto err_resume;
- }
+ if (WARN_ON(!list_empty(&private->list)))
+ return -EINVAL;
- if (luo_flb_global.count == LUO_FLB_MAX) {
- err = -ENOSPC;
- goto err_resume;
- }
+ if (luo_flb_global.count == LUO_FLB_MAX)
+ return -ENOSPC;
/* Check that compatible string is unique in global list */
list_private_for_each_entry(gflb, &luo_flb_global.list, private.list) {
if (!strcmp(gflb->compatible, flb->compatible))
- goto err_resume;
+ return -EEXIST;
}
list_add_tail(&private->list, &luo_flb_global.list);
@@ -414,13 +400,8 @@ int liveupdate_register_flb(struct liveupdate_file_handler *fh,
private->users++;
link->flb = flb;
list_add_tail(&no_free_ptr(link)->list, flb_list);
- luo_session_resume();
return 0;
-
-err_resume:
- luo_session_resume();
- return err;
}
/**
@@ -455,13 +436,6 @@ int liveupdate_unregister_flb(struct liveupdate_file_handler *fh,
if (!liveupdate_enabled())
return -EOPNOTSUPP;
- /*
- * Ensure the system is quiescent (no active sessions).
- * This acts as a global lock for unregistration.
- */
- if (!luo_session_quiesce())
- return -EBUSY;
-
guard(rwsem_write)(&luo_flb_lock);
guard(rwsem_write)(&ACCESS_PRIVATE(fh, flb_lock));
@@ -476,7 +450,7 @@ int liveupdate_unregister_flb(struct liveupdate_file_handler *fh,
}
if (err)
- goto err_resume;
+ return err;
private->users--;
/*
@@ -488,13 +462,7 @@ int liveupdate_unregister_flb(struct liveupdate_file_handler *fh,
luo_flb_global.count--;
}
- luo_session_resume();
-
return 0;
-
-err_resume:
- luo_session_resume();
- return err;
}
/**
diff --git a/kernel/liveupdate/luo_internal.h b/kernel/liveupdate/luo_internal.h
index 8083d8739b09..ec949f91c8c1 100644
--- a/kernel/liveupdate/luo_internal.h
+++ b/kernel/liveupdate/luo_internal.h
@@ -83,8 +83,6 @@ int __init luo_session_setup_outgoing(void *fdt);
int __init luo_session_setup_incoming(void *fdt);
int luo_session_serialize(void);
int luo_session_deserialize(void);
-bool luo_session_quiesce(void);
-void luo_session_resume(void);
int luo_preserve_file(struct luo_file_set *file_set, u64 token, int fd);
void luo_file_unpreserve_files(struct luo_file_set *file_set);
diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c
index 783677295640..067ffb54c36a 100644
--- a/kernel/liveupdate/luo_session.c
+++ b/kernel/liveupdate/luo_session.c
@@ -600,47 +600,3 @@ int luo_session_serialize(void)
return err;
}
-
-/**
- * luo_session_quiesce - Ensure no active sessions exist and lock session lists.
- *
- * Acquires exclusive write locks on both incoming and outgoing session lists.
- * It then validates no sessions exist in either list.
- *
- * This mechanism is used during file handler un/registration to ensure that no
- * sessions are currently using the handler, and no new sessions can be created
- * while un/registration is in progress.
- *
- * This prevents registering new handlers while sessions are active or
- * while deserialization is in progress.
- *
- * Return:
- * true - System is quiescent (0 sessions) and locked.
- * false - Active sessions exist. The locks are released internally.
- */
-bool luo_session_quiesce(void)
-{
- down_write(&luo_session_global.incoming.rwsem);
- down_write(&luo_session_global.outgoing.rwsem);
-
- if (luo_session_global.incoming.count ||
- luo_session_global.outgoing.count) {
- up_write(&luo_session_global.outgoing.rwsem);
- up_write(&luo_session_global.incoming.rwsem);
- return false;
- }
-
- return true;
-}
-
-/**
- * luo_session_resume - Unlock session lists and resume normal activity.
- *
- * Releases the exclusive locks acquired by a successful call to
- * luo_session_quiesce().
- */
-void luo_session_resume(void)
-{
- up_write(&luo_session_global.outgoing.rwsem);
- up_write(&luo_session_global.incoming.rwsem);
-}
--
2.53.0.851.ga537e3e6e9-goog
next prev parent reply other threads:[~2026-03-18 14:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-18 14:16 [PATCH v2 0/8] liveupdate: Fix module unloading and unregister API Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 1/8] liveupdate: Protect file handler list with rwsem Pasha Tatashin
2026-03-22 13:13 ` Mike Rapoport
2026-03-22 14:23 ` Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 2/8] liveupdate: Protect FLB lists " Pasha Tatashin
2026-03-20 0:21 ` Samiullah Khawaja
2026-03-20 1:04 ` Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 3/8] liveupdate: Remove file handler module refcounting Pasha Tatashin
2026-03-24 21:15 ` David Matlack
2026-03-24 21:23 ` David Matlack
2026-03-25 2:49 ` Pasha Tatashin
2026-03-25 13:14 ` David Matlack
2026-03-25 13:43 ` Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 4/8] liveupdate: Defer FLB module refcounting to active sessions Pasha Tatashin
2026-03-18 14:16 ` Pasha Tatashin [this message]
2026-03-18 14:16 ` [PATCH v2 6/8] liveupdate: Auto unregister FLBs on file handler unregistration Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 7/8] liveupdate: Remove liveupdate_test_unregister() Pasha Tatashin
2026-03-18 14:16 ` [PATCH v2 8/8] liveupdate: Make unregister functions return void 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=20260318141637.1870220-15-pasha.tatashin@soleen.com \
--to=pasha.tatashin@soleen.com \
--cc=akpm@linux-foundation.org \
--cc=dmatlack@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pratyush@kernel.org \
--cc=rppt@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