From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 023131DF72C for ; Mon, 30 Mar 2026 16:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774889817; cv=none; b=EdHCSQFAefBDbUz2uZ8s+u7S+n+7RXYqvadTFLWB2PQpKEMAeDrboA19pilT+LlyrcEs5tEPD1gZrtGyFa8BWlU8nKuMIHa+IgBqf3KDahTY9GkLI/UiLm0pCpM38000AGIpJU/HEvTiB+y2toZ5y8ACl+FY5NDJs4/4pe7T3tM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774889817; c=relaxed/simple; bh=CpIrEkUd9q5lDcQoelleuOSgnl+xOGUv8y9nSLPdQN8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ORWOmhlPTvJ3Pa17qtaB/35RD/P9WQo1d//4pvPkOHjj2o0T4dyTunBnr079j4ptpyiEE3rR/rkG0JxB34YtC/Yo7TLis79YMEHNbnzdOOKMTqkDHfXzZMhz4Tb9xqILGunYkUdd/DgwGaRcibAb/UOWskK+1Ljef/s3vyjaB/E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=N7D7+2rs; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="N7D7+2rs" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2b2591757fbso6375ad.0 for ; Mon, 30 Mar 2026 09:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1774889815; x=1775494615; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wDYEULGBlCsIFF3UlEMjXf8hzOYpl6gbeZeqwueHYJU=; b=N7D7+2rsEcNHBDzGlKY/79hf4X7XCL5F9AONFr2ebza+S25YMws/ANLHW9X7djmUX8 rzmw0uJuozUYpXCMvr6cOaYM0BJC4GnDfnHuDpLoagW+bRyEktOwVXY19Il/tv+iCtnA HebZUqIk8kzz4xjZufsvlTlnTf4AnbmruJG1sYVr9tkINr668GuHV5wdyHX4ssfV5FUE j0YiUAgRj1y1+yzLPI9RYepfzVUKkkSfecs8eMuFIwdbkF37NNEAEV7d0PXxQw3Exb6q uVxsrHucBoQUqJ9PtmlNPxt1fJwlJVSRNiNbbVJAbdoDOn8Wi7PxKKqyx7fKvLKi3GPv c9mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774889815; x=1775494615; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wDYEULGBlCsIFF3UlEMjXf8hzOYpl6gbeZeqwueHYJU=; b=EAALhdUyLYiKDWU+hHdudiQkr2Ps/PNH0PDwO86engQBiQ7j3oEJhvz5gZs9BdGuLK vzJAsApexETkzH7O5FiwJvhGmu7x+ijeVXO6B9dXJBL7q6xoRczfEuGEqPmss6NL73jn ielwsEbxxUDZUL1X+A2cKE5AC2b8XdeTRz6G3pHDKPRP/BpobmJA4IvQoJ9b4/ly/Hjg oBXnfa9xywju0N/9j17sgDM2UGxoAqG8J7hky9rBxz1+kOZ19gs3uahVDM+SDyXLCEbj 7Ee3L4501VkXNoDHhh93HBavrfNta4uvKVczO2ru4wlFJrsspXHEC1+jxK/oSTCyJA+k a7EA== X-Forwarded-Encrypted: i=1; AJvYcCWl3gYb6a0cPbJQmcEGdoIT+4HXZIs9eIukL06oIKWJVCQWAPUGLGFKu3AU/QhgKEDQdNoMFe7PJxVIEi8=@vger.kernel.org X-Gm-Message-State: AOJu0YzILPkVqkBZ7stfpy9j5IW1jabk0eMkhSCcnOa48GjVYNXayYo+ ATN5+GNaitFpHsl+0W/RJS0Pu2WeXE5SdBPXxAMZn5l5EVjAevtROORaCPxB0Niemg== X-Gm-Gg: ATEYQzw3dZkx8RINVhHwWZcZeimxZwGhRy8Bbyj3JdXrZ7wqdTuzzHumar4lQNztPVm kq2/PUx4+qcpFpGemN0eR6/oM3WCziFSsubs4S0ITXcI+1l2mC1836pf5XVk0TvT179KIKqIizS 8xc9TVJGsQwoVyWxERflD+ZRHRz4s5eLV97la3sVR6Tx+8KDGDt6TeDHTX8uiiB6pHbyAJo1MHj wyEcb6KNO6gfMuaN931Z5QbLT/DEz2i8URkcHv/byzhcCyAiA7lQl+vfPHZDILsL91Bc7QRFYvn rJuUUuND8cvR227vTss/neAZ1IZtnjb1CkMCAIFvPH9aKXaQubzFjbZmRoKrwx2+qBtUdHI7wSd CGyqAoXRK3GsFvbMaBBMU1wIu1Lzf5ws9LzW4bCECoK4Q1zfBrL8C0mg9hGPEdWRWW1jVDn4q55 Y7It5fkwtn7twhibh8vvFAuvPvj/CnhX1xevGzXDyEZ+/GQUuXNFL7njC84ftkiDFLxWWN1Usu X-Received: by 2002:a17:903:2412:b0:2ae:4e8e:954e with SMTP id d9443c01a7336-2b242c79fb7mr574715ad.5.1774889814732; Mon, 30 Mar 2026 09:56:54 -0700 (PDT) Received: from google.com (168.136.83.34.bc.googleusercontent.com. [34.83.136.168]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b24267397bsm94018185ad.27.2026.03.30.09.56.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2026 09:56:54 -0700 (PDT) Date: Mon, 30 Mar 2026 16:56:50 +0000 From: Samiullah Khawaja To: Pasha Tatashin Cc: rppt@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, dmatlack@google.com, pratyush@kernel.org Subject: Re: [PATCH v3 05/10] liveupdate: Defer FLB module refcounting to active sessions Message-ID: References: <20260327033335.696621-1-pasha.tatashin@soleen.com> <20260327033335.696621-6-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-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20260327033335.696621-6-pasha.tatashin@soleen.com> On Fri, Mar 27, 2026 at 03:33:29AM +0000, Pasha Tatashin wrote: >Stop pinning modules indefinitely upon FLB registration. >Instead, dynamically take a module reference when the FLB is actively >used in a session (e.g., during preserve and retrieve) and release it >when the session concludes. > >This allows modules providing FLB operations to be cleanly unloaded >when not in active use by the live update orchestrator. > >Signed-off-by: Pasha Tatashin >--- > kernel/liveupdate/luo_flb.c | 27 +++++++++++++++++---------- > 1 file changed, 17 insertions(+), 10 deletions(-) > >diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c >index 3c91d0008eb1..ce28ce9b113e 100644 >--- a/kernel/liveupdate/luo_flb.c >+++ b/kernel/liveupdate/luo_flb.c >@@ -115,10 +115,15 @@ static int luo_flb_file_preserve_one(struct liveupdate_flb *flb) > struct liveupdate_flb_op_args args = {0}; > int err; > >+ if (!try_module_get(flb->ops->owner)) >+ return -ENODEV; >+ > args.flb = flb; > err = flb->ops->preserve(&args); >- if (err) >+ if (err) { >+ module_put(flb->ops->owner); > return err; >+ } > private->outgoing.data = args.data; > private->outgoing.obj = args.obj; > } >@@ -146,6 +151,7 @@ static void luo_flb_file_unpreserve_one(struct liveupdate_flb *flb) > > private->outgoing.data = 0; > private->outgoing.obj = NULL; >+ module_put(flb->ops->owner); > } > } > } >@@ -181,12 +187,17 @@ static int luo_flb_retrieve_one(struct liveupdate_flb *flb) > if (!found) > return -ENOENT; > >+ if (!try_module_get(flb->ops->owner)) >+ return -ENODEV; >+ > args.flb = flb; > args.data = private->incoming.data; > > err = flb->ops->retrieve(&args); >- if (err) >+ if (err) { >+ module_put(flb->ops->owner); > return err; >+ } > > private->incoming.obj = args.obj; > private->incoming.retrieved = true; >@@ -237,6 +248,7 @@ static void luo_flb_file_finish_one(struct liveupdate_flb *flb) > private->incoming.data = 0; > private->incoming.obj = NULL; > private->incoming.finished = true; >+ module_put(flb->ops->owner); > } > } > } >@@ -412,11 +424,6 @@ int liveupdate_register_flb(struct liveupdate_file_handler *fh, > goto err_resume; > } > >- if (!try_module_get(flb->ops->owner)) { >- err = -EAGAIN; >- goto err_resume; >- } >- > list_add_tail(&private->list, &luo_flb_global.list); > luo_flb_global.count++; > } >@@ -493,12 +500,11 @@ int liveupdate_unregister_flb(struct liveupdate_file_handler *fh, > private->users--; > /* > * If this is the last file-handler with which we are registred, remove >- * from the global list, and relese module reference. >+ * from the global list. > */ > if (!private->users) { > list_del_init(&private->list); > luo_flb_global.count--; >- module_put(flb->ops->owner); > } > > up_write(&luo_register_rwlock); >@@ -527,7 +533,8 @@ int liveupdate_unregister_flb(struct liveupdate_file_handler *fh, > * > * Return: 0 on success, or a negative errno on failure. -ENODATA means no > * incoming FLB data, -ENOENT means specific flb not found in the incoming >- * data, and -EOPNOTSUPP when live update is disabled or not configured. >+ * data, -ENODEV if the FLB's module is unloading, and -EOPNOTSUPP when >+ * live update is disabled or not configured. > */ > int liveupdate_flb_get_incoming(struct liveupdate_flb *flb, void **objp) > { >-- >2.43.0 > Reviewed-by: Samiullah Khawaja