From nobody Tue Apr 7 02:56:17 2026 Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1F0E346E41 for ; Tue, 17 Mar 2026 02:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773715863; cv=none; b=STdw1lRZbL80+t4iApQLd/Z68aCpWvpItUi76hGGa7Ev+q1OdJeS7gW85l9+FsMFR5AsqGcbi11KOmbGod8MDLixf0C3JnqtQxaoloKdfVy9cHFtOnb1H8BNAb97lXNKmv8AT70ngIPhbRbMaKYN1QejaPGIqVPiEL2POycYbk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773715863; c=relaxed/simple; bh=NivFBiGu31RZfVCjzxekBJ87+FNJ54DJ542JKdteQdM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T/KzTXktF31/GW3qgAStI+yDlNb2QdJsJVuRIkTQRVHd1IsQhLJ0wByZKuUuh5vbufBCpJfrpPT3WS6Dv77eLEe/k6p0bojvH0IqDrfZoA+b5o5T8/MI5Fx0x/Ecuu3IM4YpJS/TLQhNmCoxGv0EgTzZNmCErV5XKoSQCSRB334= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b=ATV8+/z5; arc=none smtp.client-ip=209.85.128.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="ATV8+/z5" Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-78fc4425b6bso50556027b3.1 for ; Mon, 16 Mar 2026 19:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1773715861; x=1774320661; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=sd93Vtcs6nWwoXw9KS21SuDl6vnDZo9LwpKtI+MCpyM=; b=ATV8+/z54mbhnW0OyAwHfydw4VVnnv2DvRYFRKlDIryab1b49dFH8yPAWHCNXOH7vp MH0XiLxbyB598QqmlPofIaXx1qcVPNtt8h+HWxjxrRayOgxVLE2WT23on/Ac8ZjCx30h rSTxUjDa/jL5A/+/4D01TnZOAMsaGUhJRVVTPUevqJ3feRN/wnq8BR80ADZIkC6Nu3OU lm2ATOYGU9V9HvqNDUSzCQf2+viPIkfz33ae3g3NfuvN5yGxOzsfRKQokWVo2l0C8iM9 fohu3sFwroh/B3phUtTqRf9ffgpHZq0H6vXNW7h8lQxKMCnjzXhzh3Q8uXPpKx28Ggan pYVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773715861; x=1774320661; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=sd93Vtcs6nWwoXw9KS21SuDl6vnDZo9LwpKtI+MCpyM=; b=U7jlCb2Z6XU6vnDLAmB0YUoVo6YpE+VfzHix/VYQxl6WrDeOyueUIDtiuvWglyqOnu ROFzJIRUYbWQjGs2FR5ipeYuuGYSlN/7Lto5ZNdDnGmhODLap0YjmMsj8Yc4c+kG3nsc IrMsWveF8hd6amsbzPQu3oFGTHAMs54HfWND32jcY5l68g43Alhv7lIqOsNFRHFPguGK xcziLtRWL2aYvW0JzAib8HXIhVLLakjrtl6fRVZRLkLO0Dn6bR6AYz2Wyq/U3XToZhyK 9nzbRXxryPBpnb4SkGgJX1xrnmwgAg1hXwotsL4hMYmO6xf3lJHYhSECpRDXzsgDquoT hKeA== X-Forwarded-Encrypted: i=1; AJvYcCV1ZZwiMtgktTWck+hQEOQ3uH/DC2aeo77DbFRhE8NWjjqa+sTUjIUN9BsFG1i6ix4w6Y2BzANUSF97mqY=@vger.kernel.org X-Gm-Message-State: AOJu0YysC7OVt40IWMEJrg5RITHbwlTEzsdxNSPUMoExhvPtUDBZunfX IUizvBmtOyQLIGBibTIKoqJwikUvcdfBUaKVDZ3HNFQ93OsMKOXBPa3Bc32fLookXpc= X-Gm-Gg: ATEYQzw63nWczmA55wjLEn4L8Q2X/l96C/024QSFIDvMQZ22PBJIqIxi0fUeP0budGD nSNvMhFNg0WI9duynd64+hY5g0r13157EiLBwjI/Curd/lbXVF4yWmRPfC0HosvqX0JepemhWWc H467VOnHt1mTDxxFNMOLkEzt/X8j48hXCBOK0r5XvgN3xHzqaasIrYxfYFpQcvB+bOI8HDyDg/0 DYQuVdWLS2jCzxwjA6j8AssNJKdz67dPzGJY4DWDJozj1vET7jiToWj8paJkNtZYH4yeQVkVdrD WFXJT8tq4ZuZtDSnmWWCDHauKqV5c8bsvRe5191/x+smkWopzVTukc6v3N/p5QueyONH88BKCJm Dt7kurr5jB4kQk1crwosunXwyvpX5ee9dtnXSdJqdBqStCUj++z3WAaTRn0RW6b4dCXy7zwA2IU Cbz9xQwgCRGX9a43Ixbaz/MFPulNTPBS9RF7zm4H39176Qp0MCv82WCDL46B9y+a7HsGIkviXS3 OwFtYkstGXU1vAICI1+0UrTaDbaLHl2xPXob9AGFFmLRfYDRXvnLV6L3CHm X-Received: by 2002:a05:690c:84:b0:799:3e:8239 with SMTP id 00721157ae682-79a1c071df6mr154381937b3.6.1773715860747; Mon, 16 Mar 2026 19:51:00 -0700 (PDT) Received: from soleen.c.googlers.com.com (57.233.150.34.bc.googleusercontent.com. [34.150.233.57]) by smtp.gmail.com with ESMTPSA id 00721157ae682-79a5a866c85sm14951757b3.35.2026.03.16.19.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2026 19:51:00 -0700 (PDT) From: Pasha Tatashin To: pasha.tatashin@soleen.com, rppt@kernel.org, pratyush@kernel.org, linux-kernel@vger.kernel.org, dmatlack@google.com, akpm@linux-foundation.org, linux-mm@kvack.org Subject: [PATCH 6/6] liveupdate: Remove luo_session_quiesce() Date: Mon, 16 Mar 2026 22:50:49 -0400 Message-ID: <20260317025049.494931-7-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.53.0.851.ga537e3e6e9-goog In-Reply-To: <20260317025049.494931-1-pasha.tatashin@soleen.com> References: <20260317025049.494931-1-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now that module references properly handle the usage of file handlers and FLBs during active sessions, we can safely remove the luo_session_quiesce() and luo_session_resume() mechanism. Signed-off-by: Pasha Tatashin --- kernel/liveupdate/luo_file.c | 31 +++------------------- kernel/liveupdate/luo_flb.c | 31 +++++----------------- kernel/liveupdate/luo_internal.h | 2 -- kernel/liveupdate/luo_session.c | 44 -------------------------------- 4 files changed, 9 insertions(+), 99 deletions(-) diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c index 0fe2f8be8bd1..bfa0b4868746 100644 --- a/kernel/liveupdate/luo_file.c +++ b/kernel/liveupdate/luo_file.c @@ -847,7 +847,6 @@ void luo_file_set_destroy(struct luo_file_set *file_set) int liveupdate_register_file_handler(struct liveupdate_file_handler *fh) { struct liveupdate_file_handler *fh_iter; - int err; =20 if (!liveupdate_enabled()) return -EOPNOTSUPP; @@ -858,45 +857,29 @@ int liveupdate_register_file_handler(struct liveupdat= e_file_handler *fh) return -EINVAL; } =20 - /* - * 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' alrea= dy registered.\n", fh->compatible); - err =3D -EEXIST; - goto err_resume; + return -EEXIST; } } =20 /* Pin the module implementing the handler */ - if (!try_module_get(fh->ops->owner)) { - err =3D -EAGAIN; - goto err_resume; - } + if (!try_module_get(fh->ops->owner)) + return -EAGAIN; =20 INIT_LIST_HEAD(&ACCESS_PRIVATE(fh, flb_list)); init_rwsem(&ACCESS_PRIVATE(fh, flb_lock)); INIT_LIST_HEAD(&ACCESS_PRIVATE(fh, list)); list_add_tail(&ACCESS_PRIVATE(fh, list), &luo_file_handler_list); } - luo_session_resume(); =20 liveupdate_test_register(fh); =20 return 0; - -err_resume: - luo_session_resume(); - return err; } =20 /** @@ -921,23 +904,15 @@ void liveupdate_unregister_file_handler(struct liveup= date_file_handler *fh) =20 liveupdate_test_unregister(fh); =20 - if (!luo_session_quiesce()) - goto err_register; - scoped_guard(rwsem_write, &luo_file_handler_lock) { is_empty =3D list_empty(&ACCESS_PRIVATE(fh, flb_list)); if (is_empty) list_del(&ACCESS_PRIVATE(fh, list)); } - luo_session_resume(); =20 if (!is_empty) { pr_warn("Failed to unregister file handler '%s': FLB list not empty\n", fh->compatible); liveupdate_test_register(fh); } - return; - -err_register: - liveupdate_test_register(fh); } diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c index 23fa6e0c6083..8810595c672d 100644 --- a/kernel/liveupdate/luo_flb.c +++ b/kernel/liveupdate/luo_flb.c @@ -346,7 +346,6 @@ int liveupdate_register_flb(struct liveupdate_file_hand= ler *fh, struct luo_flb_link *link __free(kfree) =3D NULL; struct liveupdate_flb *gflb; struct luo_flb_link *iter; - int err; =20 if (!liveupdate_enabled()) return -EOPNOTSUPP; @@ -367,22 +366,13 @@ int liveupdate_register_flb(struct liveupdate_file_ha= ndler *fh, if (!link) return -ENOMEM; =20 - /* - * 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)); =20 /* Check that this FLB is not already linked to this file handler */ - err =3D -EEXIST; list_for_each_entry(iter, flb_list, list) { if (iter->flb =3D=3D flb) - goto err_resume; + return -EEXIST; } =20 /* @@ -390,20 +380,16 @@ int liveupdate_register_flb(struct liveupdate_file_ha= ndler *fh, * is registered */ if (!private->users) { - if (WARN_ON(!list_empty(&private->list))) { - err =3D -EINVAL; - goto err_resume; - } + if (WARN_ON(!list_empty(&private->list))) + return -EINVAL; =20 - if (luo_flb_global.count =3D=3D LUO_FLB_MAX) { - err =3D -ENOSPC; - goto err_resume; - } + if (luo_flb_global.count =3D=3D LUO_FLB_MAX) + return -ENOSPC; =20 /* 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; } =20 list_add_tail(&private->list, &luo_flb_global.list); @@ -414,13 +400,8 @@ int liveupdate_register_flb(struct liveupdate_file_han= dler *fh, private->users++; link->flb =3D flb; list_add_tail(&no_free_ptr(link)->list, flb_list); - luo_session_resume(); =20 return 0; - -err_resume: - luo_session_resume(); - return err; } =20 /** diff --git a/kernel/liveupdate/luo_internal.h b/kernel/liveupdate/luo_inter= nal.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); =20 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_sessio= n.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) =20 return err; } - -/** - * luo_session_quiesce - Ensure no active sessions exist and lock session = lists. - * - * Acquires exclusive write locks on both incoming and outgoing session li= sts. - * It then validates no sessions exist in either list. - * - * This mechanism is used during file handler un/registration to ensure th= at no - * sessions are currently using the handler, and no new sessions can be cr= eated - * 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); -} --=20 2.53.0.851.ga537e3e6e9-goog