Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796205648; b=pYbRpjaYSXl/S1o2XuWvLZ2RnlBqje6gsrygOL8c0qcdMAM/PG1zMrlXjwZKvReVBAIu hX0vJgL+wlv7IMFjTerpa5EbpSOmXIHu7O5g2HQMkbVSk3ZDV6ymE2Ob+OkbNeVtcv68C JfWPR+ldaAvqkwz6SDRbEp73h2BbqR0SEZIqMyqrREOBdouVtvlNW4mqEOXCmpTxxnfRL P/Dj/aEVtOnYBuu9DSNEwnGXaUiw5uP16QO/WhPphrOE4cf8/+CGVJ7z6AARZssgiI57+ 1+KcHNSHyFE3g28TmLGbOLfatiTsZsbMRmmPzBnTmU5HeFu1R+e+0Uw1oXi3lL7uBdw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796205648; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:Message-ID:Subject:From:To:Cc:Content-Type; bh=72U8IwQG90LcjDLWJFDfQqzlREXg4vPSgzJSwrS5OnM=; b=Pb8GUiYuw0wCUsMwBhKzJxk32lB8JuMF0OaJkUVZ2RUQO0KeC5m6EfQj4bYGBwgJyxFg Ga8oDdD2QhpT6Tn6TqlmIV3S6ZYRO9ztpTnxGiAgNlm59sHhQBp8+pAD8nsMPhBEmMLJQ sGzgwbcQ88hRTdT94E47aZfZ+Jsi48ILQdBAUfOrl1jujswg9pLxMT5atH0mz84LIVAXO 27oPj5+lUgB0tvtarspSr/BlhjnZ6vDV2xgyKE4LNTl/mKej0V5uMFgSW7mRhYSwd+lKB mraaQ9Egep0TmNxhdTuZ4USYDFuRsSpAQpFANV6yhPLIK/dzHJY/97EgveUwoLY3wlg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--tarunsahu.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=YAGsn4JN; arc=none smtp.remote-ip=209.85.218.71 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3DAD606A325 for ; Wed, 2 Dec 2026 10:00:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F3DAD606A325 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=flex--tarunsahu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=YAGsn4JN Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-c50657eaef0so1082330466b.3 for ; Wed, 02 Dec 2026 02:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796205646; x=1796810446; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=72U8IwQG90LcjDLWJFDfQqzlREXg4vPSgzJSwrS5OnM=; b=YAGsn4JNgiE+0y1bqmB/ZZvZFy1F2Nl5mk1aT9gsscnH6uxa7xCxb8FlON4dkX1yYe hWfc/HufWwhaTUMYlKVpJHKaHO3hEgiwXBiyEdnsRImn1NcTjtOCFeV2Y7y5fk1J4XJA 20y/zBBWQVmO2kmUsmV7wYgy8phLchwiJxHvE+Td5I2yVBdK5POTIeoB3jqNwc90EqH4 MizJU9l4WBiNTt8wiPfex8KlRuuNKTBrgJuPLCECEbZXmimv/BWm6DG556ro9qBGFXcQ 901EmWaF66BlEe909qqr50Eo/j1uYZbOKWtpeoO4NlNTMac0snD4JFYKLEfLx6TfUUbh jXbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796205646; x=1796810446; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=72U8IwQG90LcjDLWJFDfQqzlREXg4vPSgzJSwrS5OnM=; b=EhiH/f638T9W93TQgo4c0eSFSXUKrzprL8u8DrmG2gxbk1FeUNqIcgpul5g2ghJAHJ /mCsVRVOTOIwbsqwLO85oUg9IDPjlNoTWiln89qRxVcArKfuRPGOfxMrO85hJA+OPcPF HBnHQbhHT4LPBQ8suOr4alBmAbu4RQ4WCJcacxOlWUlKnfZTkVZqpVg7m4HJJkQ6CuB2 cEIoiqjRPo8m/uDueHzsvmtUer4CE+MqhKCEk83ZVwM4L1qVSy0gRkIQn+Wn0/O8XjBR e8a78/MkFReSMeFhMNP/n8ca5aYRH69BbxzNPPUpbNjCRMJJk25ddLZOi9xldXphdokO UHDw== X-Forwarded-Encrypted: i=1; AL+hErF68jwsIA21R7tqlk4hogq0OW3+cDadqmaUjT9/70ZzJ4wQqDT+/5zyLIcBgoflk2PODdk=@vger.kernel.org X-Gm-Message-State: APuU4Z/CxZdH8XcCF3Xtb3ovaO24Oz+8pTir+OxSLKarcDl3zGcAsN2x Hm3q4GVrYUMFO4CFQd8pxQFTqKFqRsxCxBV/Ej3A1exANfDN8HAvsjTxDwCzsCSQJMJGsXJwzmo WVLwRko+P85EdKPE5tg== X-Received: from ejde23.prod.google.com ([2002:a17:906:817:b0:c3f:cc01:4b71]) (user=tarunsahu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:906:17c9:b0:c46:7ec3:fde7 with SMTP id a640c23a62f3a-c513a8920damr2531560266b.31.1796205645960; Wed, 02 Dec 2026 02:00:45 -0800 (PST) Date: Wed, 02 Dec 2026 10:00:45 +0000 In-Reply-To: <2vxz8q2fwhqj.fsf@kernel.org> X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261110050202.529473-1-tarunsahu@google.com> <20261110050202.529473-19-tarunsahu@google.com> <2vxz8q2fwhqj.fsf@kernel.org> Message-ID: <9huzpkvk3stu.fsf@tarunix.c.googlers.com> Subject: Re: [PATCH v4 18/19] mm: memfd_luo: Add feature header to struct memfd_luo_folio_ser From: tarunsahu@google.com To: Pratyush Yadav Cc: 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, Pratyush Yadav , 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 Content-Type: text/plain; charset="UTF-8" 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? struct memfd_luo_ser { ... u64 folio_ser_entry_size; } ~Tarun [1]: https://lore.kernel.org/all/9huzmrrbpb7w.fsf@tarunix.c.googlers.com/ > > [...] > > -- > Regards, > Pratyush Yadav