From nobody Thu Apr 2 18:49:14 2026 Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) (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 2CB4D37107F for ; Fri, 27 Mar 2026 03:33:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774582425; cv=none; b=ihiQEx6m6kYxtSJOna4wgOeEcPHyxdPicnYMnh/mU5H2Nw5by0wga/I1vs8FjOLyLYpUtlrDkqEM6yitWwkxjMojohF18I1XhFU8cw1zEUnsAUUZTgxOukVGMoKFR1rrCqoR8Kbg+5NOjPA3znfM5R8+fn1sbVBtENTBwRRba+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774582425; c=relaxed/simple; bh=DVzMDiusTWfIH5k52/TGAUQTcdsUmO8OJS5Og/rLrts=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UUfHISMPjyu8sTWJASMOqdyti7zYe0mboy1hREKpIkMwbaMKAPVqQDGpvxDJ97C4s7U4RdVlymKm6dO+4kDlfjKSWfHsAlwqwx4dq75mW2t/O/SXTZZQb+DPqmmLv65oHBhl16Ee12M9/4Pw8oJFGl/VUakMxMmY3H098/yWM9E= 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=CYa9fesc; arc=none smtp.client-ip=209.85.219.52 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="CYa9fesc" Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-89a1d7cc7f0so14216516d6.1 for ; Thu, 26 Mar 2026 20:33:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1774582423; x=1775187223; 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=Mszalggt3dPTMibHtCmbJKEiDYjehfwuxFzG9yJXx/o=; b=CYa9fescwmItJkSyeZhKmAI7dtoVLCgB6BM0oMkBh/cxF5eLOhHiS55fmLqUS+Fn/i 2F3yqkqHZGLG419ruu9STYTtoBWkOjqSVE1YHVl3pZb0PiGBBVT62+sBmk+lQLREft3+ ID9mfUqDIdPtbG0SE+xhr4ekqfuGdGf+bTOft7+wOZrmJ24fSx1vPSRQblxSgLv1axLa NlqMzKTqNoxKRCoszjXnMcJcIvc4y/Cz8RVkfJy/Hluu4OLCKdPdCi8W6DIpV9+MHfIs Y8U3MkzZyyk7OiSM36tjut1feFIUP2PlwmjGoOIRxm+uBcFfXfnFALCj/0cfeOxqEnKO vBaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774582423; x=1775187223; 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=Mszalggt3dPTMibHtCmbJKEiDYjehfwuxFzG9yJXx/o=; b=S4bLRfEWN00C7GdCJYjfYB74xItUc3g/fPa9J49VKJJUo0dTvmw51e9DQ6pahZy6Hl IS94HCIgXSGY0ViJdlpyv0O7vOFqr69xM0Q2k+uXN9ynV5ulQZssZIWGE3NRe9JYeOZe 8rsygatSnoKGAuPVPatc2+U/9SKEDGwLk6NDJ4yqgxpgIaWyPU1Ev0Bw0C0PSCIjMsfe fDYFj82T2ko15s12jDyjO72oo7A7DFo3trEW1v1hu4ospN08Lvs6UXIDwkrdjqTwur3T +ZnDjg5KtLVWqepZsHJjpw1btK2yUCCUZEJ185s1Bj045IZVFS6MCfWLZ9FoT1vRJZ98 Dfww== X-Forwarded-Encrypted: i=1; AJvYcCWXgdUFkj0SNqCBoXOCrLc4jp23Pd04mKvXgDjXugsCGlbp5VW1enKpqKTXgibpYRPEK7L4+ZIbU3PT1xE=@vger.kernel.org X-Gm-Message-State: AOJu0Yz3JJO1sMT4Ke49sUTeNO6qiTaK2h6Nn8p2DzaH3qTvVg+SYn9W O8JyZYRx9773qoua+wOPSdCuAE0kOIx5AUCeRh17pvSDrORQ+AFx5+lR3QypGIo0YW8= X-Gm-Gg: ATEYQzxu/uItk6gS0tbAVzNq2SKi1313LFXfZZfy/yZjqRwV9M6GovEOv0M8DjSsWix XCaQBtb5V5hbghCnZJvdmhZCGe313WW7hAZE+BwYH+ec7haOQtMbzTImlbQSz9Xc/9CMdSmx66C 0Z0BDJ7GQVxMG3PfWoqdKP8hphPssbnZg3WU+qIVyqvvzoUtRPRqXh5pbU9EIkMqQmHtmWgQ4CN Wt4acMA8SFpJPoSd7GU43K179s9PlORfFHDLMQn9RZ4fAv26pFkkXCr+oA+rMV4TkiYtitrRMbY 2l/sz03kJK5fcP198yzR5fv04JSzsYr3r9zeZ9hbgVAjsp99dya63TofrCNVizbLaWSx+dwADMA LJRk51RtRdQ5OQjkUwbvXA4x7E4h+2N821dLi9L/tYpRC/84I/qSEz2uisS3ZXSDCB42yUi7oVi T6Y1VWqYgCaZp2aX6VICXIrvO2aPCp5kqwtx4SrLjyZzYwiqVNr7f/3jk40OfOEzwcyA== X-Received: by 2002:ad4:5c8b:0:b0:89c:55b1:c8dc with SMTP id 6a1803df08f44-89ce8d8a990mr11018426d6.21.1774582423081; Thu, 26 Mar 2026 20:33:43 -0700 (PDT) Received: from plex.localdomain ([71.181.43.54]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-89cd5a22711sm46519186d6.27.2026.03.26.20.33.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2026 20:33:42 -0700 (PDT) From: Pasha Tatashin 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, skhawaja@google.com Subject: [PATCH v3 06/10] liveupdate: Remove luo_session_quiesce() Date: Fri, 27 Mar 2026 03:33:30 +0000 Message-ID: <20260327033335.696621-7-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260327033335.696621-1-pasha.tatashin@soleen.com> References: <20260327033335.696621-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 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 Reviewed-by: Pratyush Yadav (Google) --- kernel/liveupdate/luo_file.c | 21 +----------- kernel/liveupdate/luo_flb.c | 59 ++++++-------------------------- kernel/liveupdate/luo_internal.h | 2 -- kernel/liveupdate/luo_session.c | 43 ----------------------- 4 files changed, 11 insertions(+), 114 deletions(-) diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c index 4aea17a94b4f..439177c10723 100644 --- a/kernel/liveupdate/luo_file.c +++ b/kernel/liveupdate/luo_file.c @@ -847,14 +847,6 @@ int liveupdate_register_file_handler(struct liveupdate= _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; - down_write(&luo_register_rwlock); /* Check for duplicate compatible strings */ list_private_for_each_entry(fh_iter, &luo_file_handler_list, list) { @@ -877,15 +869,12 @@ int liveupdate_register_file_handler(struct liveupdat= e_file_handler *fh) list_add_tail(&ACCESS_PRIVATE(fh, list), &luo_file_handler_list); up_write(&luo_register_rwlock); =20 - luo_session_resume(); - liveupdate_test_register(fh); =20 return 0; =20 err_unlock: up_write(&luo_register_rwlock); - luo_session_resume(); return err; } =20 @@ -897,14 +886,12 @@ int liveupdate_register_file_handler(struct liveupdat= e_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 wi= th - * this file handler. + * update is in progress, FLB is registred with this file handler. */ int liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh) { @@ -915,9 +902,6 @@ int liveupdate_unregister_file_handler(struct liveupdat= e_file_handler *fh) =20 liveupdate_test_unregister(fh); =20 - if (!luo_session_quiesce()) - goto err_register; - down_write(&luo_register_rwlock); if (!list_empty(&ACCESS_PRIVATE(fh, flb_list))) goto err_unlock; @@ -926,14 +910,11 @@ int liveupdate_unregister_file_handler(struct liveupd= ate_file_handler *fh) up_write(&luo_register_rwlock); =20 module_put(fh->ops->owner); - luo_session_resume(); =20 return 0; =20 err_unlock: up_write(&luo_register_rwlock); - luo_session_resume(); -err_register: liveupdate_test_register(fh); return err; } diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c index ce28ce9b113e..ac6fa5b34b43 100644 --- a/kernel/liveupdate/luo_flb.c +++ b/kernel/liveupdate/luo_flb.c @@ -365,7 +365,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; @@ -386,21 +385,12 @@ 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; - - down_write(&luo_register_rwlock); + guard(rwsem_write)(&luo_register_rwlock); =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 /* @@ -408,20 +398,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); @@ -432,15 +418,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); - up_write(&luo_register_rwlock); - luo_session_resume(); =20 return 0; - -err_resume: - up_write(&luo_register_rwlock); - luo_session_resume(); - return err; } =20 /** @@ -456,12 +435,9 @@ int liveupdate_register_flb(struct liveupdate_file_han= dler *fh, * 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. + * Context: 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 quies= ced. * -ENOENT if the FLB was not found in the file handler's list. */ int liveupdate_unregister_flb(struct liveupdate_file_handler *fh, @@ -475,14 +451,7 @@ int liveupdate_unregister_flb(struct liveupdate_file_h= andler *fh, if (!liveupdate_enabled()) return -EOPNOTSUPP; =20 - /* - * Ensure the system is quiescent (no active sessions). - * This acts as a global lock for unregistration. - */ - if (!luo_session_quiesce()) - return -EBUSY; - - down_write(&luo_register_rwlock); + guard(rwsem_write)(&luo_register_rwlock); =20 /* Find and remove the link from the file handler's list */ list_for_each_entry(iter, flb_list, list) { @@ -495,7 +464,7 @@ int liveupdate_unregister_flb(struct liveupdate_file_ha= ndler *fh, } =20 if (err) - goto err_resume; + return err; =20 private->users--; /* @@ -507,15 +476,7 @@ int liveupdate_unregister_flb(struct liveupdate_file_h= andler *fh, luo_flb_global.count--; } =20 - up_write(&luo_register_rwlock); - luo_session_resume(); - return 0; - -err_resume: - up_write(&luo_register_rwlock); - luo_session_resume(); - return err; } =20 /** diff --git a/kernel/liveupdate/luo_internal.h b/kernel/liveupdate/luo_inter= nal.h index 4bfe00ac8866..40a011bdfa55 100644 --- a/kernel/liveupdate/luo_internal.h +++ b/kernel/liveupdate/luo_internal.h @@ -85,8 +85,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 8c76dece679b..a3327a28fc1f 100644 --- a/kernel/liveupdate/luo_session.c +++ b/kernel/liveupdate/luo_session.c @@ -607,46 +607,3 @@ int luo_session_serialize(void) return err; } =20 -/** - * 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.43.0