From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7EB1C5B543 for ; Thu, 5 Jun 2025 11:56:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4961D6B00A2; Thu, 5 Jun 2025 07:56:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 46E326B0256; Thu, 5 Jun 2025 07:56:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 383AD6B0258; Thu, 5 Jun 2025 07:56:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 13E626B00A2 for ; Thu, 5 Jun 2025 07:56:19 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 988531D42F9 for ; Thu, 5 Jun 2025 11:56:18 +0000 (UTC) X-FDA: 83521194036.19.00E19BA Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf15.hostedemail.com (Postfix) with ESMTP id D1EFFA0005 for ; Thu, 5 Jun 2025 11:56:16 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jxlZk0qG; spf=pass (imf15.hostedemail.com: domain of pratyush@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=pratyush@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1749124577; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rrtqVmonq/cTDjAgs98qyfL+Sq53ppfNzR/iyo7DGhI=; b=Y3bzx3GuxskjwS0Ui0c3NwVwvrdkz4KTHcRfM5/xcBB/Q9QTBmfLdieVdEoRUquEBWc7dS JEDqodTaxsezUWVIIQ9rqix5f/3SwPaiOLaP8zeed86GoEJx5bRPpnHRQwqYmPbVpTYMa5 rAdNq943AqF/USvb/nG+J9xjN7s6F/E= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1749124577; a=rsa-sha256; cv=none; b=Lr9kq/oFzlu1GBI+tDvMIi6Kqw8JYXMB/FswRNUzpw10DKtqKaBboWi7GtSoyAOaKXeIqT o+YhQHgmb7O9vMbwA6I7I9JhzIvJFvTihWUe3YuOs1S2Q8HdtPBOlUiv8TSiR6ue5PuZzI 6LPs2DoIbZYs7hq+MAV6VBt0pH+LLd4= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jxlZk0qG; spf=pass (imf15.hostedemail.com: domain of pratyush@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=pratyush@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 3F8EF450E0; Thu, 5 Jun 2025 11:56:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CA70C4CEE7; Thu, 5 Jun 2025 11:56:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1749124575; bh=uWcXl9ynCkshNAH43IpoOSXtxdbCOYh/GOFOCUI9uBM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=jxlZk0qGEQhuOAutqsXnOe9PmJHL+oEglN6Gi3ZE9MjWut4dthhXTsEGgA2HAbcHb sw5LD4lQxsUirwofRPfTE4Q+JUD47iS3Tcq1ue9KXa4oMdnceICx+TkFYV/F0jlpHI XU8EMX/6+aJwPOQEOg6Ez+4ZS/+5fdpTfFywGkIsTJ8Eo32WxK1IizN0AzD1H7If3n sY+26Nc5iR0/Afw1IrtCODqNeOE2hJLylCKpMdiPL3zFWHkdKBZasU5kH02sc49Q2N Zss2L83Q4KA/HZEtHWYMsP/Fy8ZOCgulYwJbu92vZuGus9qVdKbHl0+GDsYstcQW2A VDKOQHOOHaTxA== From: Pratyush Yadav To: Mike Rapoport Cc: Pasha Tatashin , pratyush@kernel.org, jasonmiu@google.com, graf@amazon.com, changyuanl@google.com, dmatlack@google.com, rientjes@google.com, corbet@lwn.net, rdunlap@infradead.org, ilpo.jarvinen@linux.intel.com, kanie@linux.alibaba.com, ojeda@kernel.org, aliceryhl@google.com, masahiroy@kernel.org, akpm@linux-foundation.org, tj@kernel.org, yoann.congal@smile.fr, mmaurer@google.com, roman.gushchin@linux.dev, chenridong@huawei.com, axboe@kernel.dk, mark.rutland@arm.com, jannh@google.com, vincent.guittot@linaro.org, hannes@cmpxchg.org, dan.j.williams@intel.com, david@redhat.com, joel.granados@kernel.org, rostedt@goodmis.org, anna.schumaker@oracle.com, song@kernel.org, zhangguopeng@kylinos.cn, linux@weissschuh.net, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, gregkh@linuxfoundation.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, rafael@kernel.org, dakr@kernel.org, bartosz.golaszewski@linaro.org, cw00.choi@samsung.com, myungjoo.ham@samsung.com, yesanishhere@gmail.com, Jonathan.Cameron@huawei.com, quic_zijuhu@quicinc.com, aleksander.lobakin@intel.com, ira.weiny@intel.com, andriy.shevchenko@linux.intel.com, leon@kernel.org, lukas@wunner.de, bhelgaas@google.com, wagi@kernel.org, djeffery@redhat.com, stuart.w.hayes@gmail.com Subject: Re: [RFC v2 08/16] luo: luo_files: add infrastructure for FDs In-Reply-To: References: <20250515182322.117840-1-pasha.tatashin@soleen.com> <20250515182322.117840-9-pasha.tatashin@soleen.com> Date: Thu, 05 Jun 2025 13:56:06 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: D1EFFA0005 X-Stat-Signature: 96pb3hsh17bzenos1g6f618t7zubjixi X-Rspam-User: X-HE-Tag: 1749124576-268293 X-HE-Meta: U2FsdGVkX199v1VF9d0K0MRsNnheDOAU3tSrwPllWVd/R2tG7RVH0fU8l7EOj4beJgyKXVNcM3apKBCiULSPI/grZWrtGgSGoKAlMsjuyiAadtkumN+OnkvKDDrUiKLug2/vxCHnMojc/3rGL3akP1e3nWBxUtBHTyeJ3s5wztTfyZu+72ItgjWCQbyPxj+4TYLgr8iXNmd1zJhnUbs6IhCu6ggxRJAwrgAuD6GDNHNmmm8yIhWpyWDinwrY7z/7Q0MGsAH81V3hYbxpHRdoSeMX9D6f5JsPIRZyUBNqDICb6ODQRcgXHtcRQcufe2pljEIQwahVsPlLtvmXGRlAaSw1lXo+Pgdubm6fhI6j5wfQd3/zg8yrEIrhizbCZ50lkPpy+GEyetqEdc1r108I3HU3qoLQ9VGCALs1lWz3GmnOq1nXAK3mzyX6xy8QRppKc5Qb75DOi4AgV8zR1It+RoUA4H9xESMNXHqfx8KrgFs/AMpcKtGPs6IFJWCYwlTFEWsbQC1r84529IHwGFfQkTE6ozqtV5mbTAfA+anoFSj/vCMpdl7WjiS0gxQYnfZqkBY1edG0udvLumyXv0TeZ78e5A+bye3G8rytP1/hlcf/dpPxCL9IWe3P7dkjJQATOpXH4j/9NPu4SXfQz79c8prdpYw6ldaiyG/guLlcK3Qy+ANT3YvcocGm1i3hMCXyufbSmyLo1mvumjf0YC/kAYeNTYuSQEA9/k1d2j9ufhdwy1icmz7V6WvYgzZyX92jcQ734+odBjb0aD3meGP1lOV0Sd6PhF0FbHRIUCUsDhai3sc6H0Gv9lWYuXSQw7MRLneOi9iGc6JKih3wznxHx78Xmb+mzOzgHFnzLbRBVVZ0gwuqKPmlEOXoMcH988pvszLco+QYo7w4337pZg3ay5ydxIOrewkvL2IPFhASPeGLSe8jaMFp7rNYfedWpKFZDo8obKzsUL27qVFA27G 8acjLP5+ 3EXZBwRx5qc+4wqomxk6AC6pagAqd5rCpH+GKUGW8NZIhSOsoYFvSJURy8RBc1nnjXCskxmOWDy0lPixR2YuLIgi8ZW/FWD3E+4jq+bRlXkIHcJNdWFZzSFDmpTIifo0b+rbGtCZqrtwRaIlcu87I0l1WMe4CRhK3mGOYhi0RKnQb3BMKwA73Q9uOLfPhswSVd4pqpvieyT19VGhdRjQYIyZ9a7MRdR/orOoUblDdQyMOnUWl0TLok9shHyZMTA/JzpH/aHSQUDkDmfKFyDlVzaePbQSr0RgNOYWe0/OpCnjvqa4gRmVAYthtBAfkDC1nYXxyTnhYckY3iAI2NBF6I280rBCGMQbjNltc X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, May 26 2025, Mike Rapoport wrote: > On Thu, May 15, 2025 at 06:23:12PM +0000, Pasha Tatashin wrote: >> Introduce the framework within LUO to support preserving specific types >> of file descriptors across a live update transition. This allows >> stateful FDs (like memfds or vfio FDs used by VMs) to be recreated in >> the new kernel. >> >> Note: The core logic for iterating through the luo_files_list and >> invoking the handler callbacks (prepare, freeze, cancel, finish) >> within luo_do_files_*_calls, as well as managing the u64 data >> persistence via the FDT for individual files, is currently implemented >> as stubs in this patch. This patch sets up the registration, FDT layout, >> and retrieval framework. >> >> Signed-off-by: Pasha Tatashin >> --- [...] >> diff --git a/drivers/misc/liveupdate/luo_core.c b/drivers/misc/liveupdate/luo_core.c >> index 417e7f6bf36c..ab1d76221fe2 100644 >> --- a/drivers/misc/liveupdate/luo_core.c >> +++ b/drivers/misc/liveupdate/luo_core.c >> @@ -110,6 +110,10 @@ static int luo_fdt_setup(struct kho_serialization *ser) >> if (ret) >> goto exit_free; >> >> + ret = luo_files_fdt_setup(fdt_out); >> + if (ret) >> + goto exit_free; >> + >> ret = luo_subsystems_fdt_setup(fdt_out); >> if (ret) >> goto exit_free; > > The duplication of files and subsystems does not look nice here and below. > Can't we make files to be a subsystem? +1 It would also give subsystems a user. [...] >> diff --git a/drivers/misc/liveupdate/luo_files.c b/drivers/misc/liveupdate/luo_files.c >> new file mode 100644 >> index 000000000000..953fc40db3d7 >> --- /dev/null >> +++ b/drivers/misc/liveupdate/luo_files.c >> @@ -0,0 +1,563 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> + >> +/* >> + * Copyright (c) 2025, Google LLC. >> + * Pasha Tatashin >> + */ >> + >> +/** >> + * DOC: LUO file descriptors >> + * >> + * LUO provides the infrastructure necessary to preserve >> + * specific types of stateful file descriptors across a kernel live >> + * update transition. The primary goal is to allow workloads, such as virtual >> + * machines using vfio, memfd, or iommufd to retain access to their essential >> + * resources without interruption after the underlying kernel is updated. >> + * >> + * The framework operates based on handler registration and instance tracking: >> + * >> + * 1. Handler Registration: Kernel modules responsible for specific file >> + * types (e.g., memfd, vfio) register a &struct liveupdate_filesystem >> + * handler. This handler contains callbacks (&liveupdate_filesystem.prepare, >> + * &liveupdate_filesystem.freeze, &liveupdate_filesystem.finish, etc.) >> + * and a unique 'compatible' string identifying the file type. >> + * Registration occurs via liveupdate_register_filesystem(). > > I wouldn't use filesystem here, as the obvious users are not really > filesystems. Maybe liveupdate_register_file_ops? +1 [...] -- Regards, Pratyush Yadav