From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796211019; b=xFffPJlOt509yiQw1XfWXMhZUmhQCyD+FuUVgxTkbJqX6OcCzeBngrm29S+wJ1DW3LLk y84O6xhW4pglKXM3YZrYeSXML8FNA9QiUMvLcqaPQQ7Ire4ALaJh7p2HQZCyz9iZUMVAt mm6zYkeXiKnZ1n7gTns67YWbyd1QJ0xYqhJz/oBoBvx902iC2E2M5RNmJuGE4v+RF7WV6 Fe4f4F80haJyrUYy1hcoIrKvY+De1FosiNT9DbbWK+3gkm/cjMrJAdG9lM/ZevotUsato dND45KMvXWwiWi/FQ2g9GMPnJq1KQmZR4I/BBUBIstRL1nkkmkNe//aTL3Gfo1xAJDQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796211019; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:User-Agent:MIME-Version:Content-Type; bh=V+FqVW89saVuc58kFcBHkOWxVgAUpozhPMkpHITF5Mw=; b=EM9CTW8QfTMNEeuiaa3dFtZjWdV1mINFTeL2uRGRZTcc5MGZBLeHHq5AQmJ6B0hSmCOc CwSJ8/ukk67Lqc9Ka+yklQkEwcdacUvE4wjR0fB71HpJh9NFIsHztW1E63L/igWaMbz8E muS1Mg5GC5kzPjEloEljVpCtqQ1ZAV20/GHgGH8J7B/cYidphISopTb3/MLTcYQwrtELu OxhTTF7iM9RAQX21apTYYV4gxsKN/Ljfp3WkvPtYnqIH5Y+fZmvJoc2grgi7/LyMJOe0O Qp6hCQYMi3xlrthnVCLf09d/JzLSdJu6O5jkBw/7ibbelFOva7mx/l6feUi+UJLrIZg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iibytONu; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 651BC606A322; Wed, 2 Dec 2026 11:30:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iibytONu 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-Mailing-List: linux-arch@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain 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