From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCAFE606A334 for ; Wed, 2 Dec 2026 11:30:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=2PwKrNIM; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iibytONu DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=V+FqVW89saVuc58kFcBHkOWxVgAUpozhPMkpHITF5Mw=; b=2PwKrNIMzP2flrdBIko61dv9lv suDBHDaIpJN/krUdy4N+vN8PvgR6TpK0JuRXdQR8bkTC7ih7KL1uhQ/W1oL7vDNw49/N+6UNvOWB2 +4Pnpd0PJxjtoC6mCwJgJLKRJg8GxeMcFMJjwsU5pd1OAK8QMYYMRCktgegLazfM1GOOxVCSWqatk yv5loLdREzgaB0PTYsYK494HGqlQNoXnMQTUeVe3vQKtKOQmrJe/3kLOTdQRsbFW0HSyxikI7oF9M tWBn/xBXK1LpvpCusNw5RQlrK0f2aqTcT+nAK8c9lS65/WVLfLy/N31heoI3lN1VAd09xTCbW0FmG yF2cNuMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYiXV-0000000BJc4-1Dlg; Wed, 02 Dec 2026 11:30:21 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYiXT-0000000BJbM-3sJo; Wed, 02 Dec 2026 11:30:19 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 54AFA42465; Wed, 2 Dec 2026 11:30:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C37DD1F00893; Wed, 2 Dec 2026 11:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796211018; bh=V+FqVW89saVuc58kFcBHkOWxVgAUpozhPMkpHITF5Mw=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=iibytONuqkcWi1MH99GPwnkAzSgXmGtJ91h6Qq8HbRmYM6XNlPlwoMn6/Tuj6/bj7 w1ZGxDW+kpXolC3uc7gX7hLuApjh35UPZebgsz2L1DVYG8wTYhBM2f0wHTQWtP3Eca dQ4RIw8vvgcENHqoiQSSDW+T8u1szJ9RWjjBiSNkR71zxmAr2s9bB+kF9kXg8xShYj m5Tk8KXeTnEgpqYVcut6fWBMkJmmCyqXEKN0pLA7wHSHzahY5E3SPc9mKd1I6QmzVd h5iXJU/pt6qMc0olHDDasg4oBKUSPHDUAr7i978XE4J4T814YcYv8xlyzamJRJbnw1 H6kT+c6cISVXw== From: Pratyush Yadav To: tarunsahu@google.com Cc: Pratyush Yadav , Pasha Tatashin , Mike Rapoport , robin.murphy@arm.com, maz@kernel.org, will@kernel.org, David Matlack , Alexander Graf , seanjc@google.com, jgg@nvidia.com, loganodell@google.com, arnd@arndb.de, dwmw2@infradead.org, baolu.lu@linux.intel.com, Bjorn Helgaas , oupton@kernel.org, alex@shazbot.org, gle.com@google.com, pbonzini@redhat.com, Andrew Morton , kevin.tian@intel.com, joro@8bytes.org, kvmarm@lists.linux.dev, linux-pci@vger.kernel.org, kexec@lists.infradead.org, kvm@vger.kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, skhawaja@google.com, sagis@google.com, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 18/19] mm: memfd_luo: Add feature header to struct memfd_luo_folio_ser In-Reply-To: <9huzpkvk3stu.fsf@tarunix.c.googlers.com> (tarunsahu@google.com's message of "Wed, 02 Dec 2026 10:00:45 +0000") References: <20261110050202.529473-1-tarunsahu@google.com> <20261110050202.529473-19-tarunsahu@google.com> <2vxz8q2fwhqj.fsf@kernel.org> <9huzpkvk3stu.fsf@tarunix.c.googlers.com> Date: Wed, 02 Dec 2026 11:30:11 +0000 Message-ID: <2vxzbj73vs1o.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" X-Spam-Status: No, score=-7.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Wed, Dec 02 2026, tarunsahu@google.com wrote: > Pratyush Yadav writes: > >> On Tue, Nov 10 2026, Tarun Sahu wrote: >> >>> Precede each serialized folio entry in the preserved memfd folio array >>> with struct kho_ser_hdr via DECLARE_KHO_SER so future per-folio memfd >>> features can append fields to struct memfd_luo_folio_ser without breaking >>> compatibility between adjacent kernels. >>> >>> Allocate the preserved folio array using kho_ser_size(memfd_luo_folio_ser) >>> per entry and initialize each entry feature header in >>> memfd_luo_preserve_folios(). On the incoming path in >>> memfd_luo_discard_folios() and memfd_luo_retrieve_folios(), validate each >>> entry feature header with kho_ser_validate() and advance between entries >>> using fhdr->size so entries written with a different feature layout are >>> traversed accurately. >> >> No. The flags in each folio entry is a part of memfd's ABI. These flags >> don't have an ABI of their own. If the layout of memfd_luo_folio_ser >> changes, it goes in the memfd_luo_ser flags. >> >> Doubling the memory needed to preserve a memfd is not acceptable. > > Based on recent discussion in hypervisor liveupdate meeting, we decided to omit > the kho_ser_hdr for collection entries and we will handle any changes to > their ABI by their parent structure. So for pci_dev_ser changes will be > handled by pci_ser feature header. and similarly memfd_luo_folio_ser > changes will be handled by memfd_luo_ser which is aligning with your > comment above. > > I want to discuss on this approach, same I raised here [1] > > collection entry that are allocated by kho_block can easily be > deserialized as kho block layer has entry_size that is also handed over > by previous kernel hence the current kernel can deserialize those > entries based on entry_size. There are no problem in this. (even > rollback is safe as well) > > Collection entries that are allocated by kho_vmalloc, are part of an > array which resides inside a folio of order (= # of folios * sizeof(memfd_luo_folio_ser)). > During time of deserialization, kho_restore_vmalloc will just give the > array of pages (a folio) that should be deserialized in array of > collection entry which is memfd_luo_folio_ser, direct type cast with +1 > in loop will not work as the size of memfd_luo_folio_ser might differ > across kernel. So, Like I suggested to have collection entry size in the > parent structure (folio_ser_entry_size) is acceptable design here? ABI contract should be to _not_ change the size of memfd_luo_folio_ser at all. It is always 16 bytes, and if you need more, you need to make a breaking ABI change (that is, a required flag). > > struct memfd_luo_ser { > > ... > > u64 folio_ser_entry_size; No, I'd much rather we do a feature flag as a follow up if we need this. All this is going to go away with KHO map [0] anyway, so not really a problem worth solving right now. [0] https://lore.kernel.org/kexec/20261116134013.1636689-6-pratyush@kernel.org/ -- Regards, Pratyush Yadav