From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.72 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796205648; b=1ACb/wBWFB7DZYra9mcE+GMJvdx/Om2tsq66BbX4CtlZouyoW3V5F0B10E5k/eGAw7ln ddWsUX5z51caephmhsDFKX22s9GtZFSzn73d1XFak/2at+LBkCgztQfx3ue+UaPZmMuwY rQjr6N3BBQFbISfZhVNtEh2RyCzP7yLZZtifdnt08RnIeN1oCgzeHy1RpUgRPsoiNYLrX U2LPTzbfQ/bVkBt4KzG3zeVVdBgQJoKO3Ajr1iRKOZowGmacPNMY2Qf2G6DqLL/cD7QYH tR9QsV1dSlPoff2Hiln1WIpo+SO2mljvP3I5nxYNL0sOwAeIGSvYZ899guq5YSk5WRw== 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=KTO12A5KGn5bhFRj+kjfXIL1Eik5glJmUbq44rrss5K17RHnVPcUQ/1iCVHnQwGHybME r7qwpyTwxalZIKZ6Brgj/QgG/CjCecNJq5rIzDKCaiyyspWMp5+xpF9tbnwyzXTPjCSyz 0iq5VPtYFtn8Ys/oFjvarMpQTtVIgpb8x3W8nVY9JNotFJUBVkOA6EU2E2ke0VjyydBrG RI9zArCRQTaj9/8AfIoRZMT0evhXTjglYMK26/vItKTduRWpqvvF2JKNHwNg1QDWwxd/s obug8AaMFAgkmVp/WbLL3HtU9uW9MMBTUEnvF3APm/luUX64xP7QKN/AwtY4Y3kPwhA== 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.72 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (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 F3FCB606A337 for ; Wed, 2 Dec 2026 10:00:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F3FCB606A337 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-f72.google.com with SMTP id a640c23a62f3a-c50b170ec5aso1094626466b.2 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=RWq98gRCpnd0WYwoBMEabzJ7Cva7KXmw3/Pz+YItnREPOi4pX08hsLNMF3gB0gwdYO 3s1Y8FK/2++/r4LlZg4ZyOEaG9bwmuTFHQoCeGAITYxWiA3+AEehpDbqqnYsIU4FckNB GyTapynk5Sk9/TParCcB2p7jpz5D+1T8jqvOmHwJ9CdJIfEoxcSKmblHf2QPU/eOxxi8 iAi3s21HMGeME1iZttc1ofT8f1jUAjyvf5aO9LFf3gM9t/0Bv7rsFcKcQ71AWrRiOCqP WayAK0D9Oy+qJBU+pA3FSVFTnLh6ezBNFljwv7l2rUyafPppJZdCvtH3INjE3Kqh+LOi DjMQ== X-Forwarded-Encrypted: i=1; AL+hErGP6ORa1KtmbjMiv31MW8Bum4E37MJA2ReYDkbJJBQILm8YWyV2567F4OHmFxwM77zBbAvLmLbtBKgGjvA=@vger.kernel.org X-Gm-Message-State: APuU4Z953L2XRA2H7YHKtG2lU+v6ucFSYpzAzYA9QXcEO1duEg4AjxqX Loxb0s3xUSc1GtplONVRDurlksoTW3TVr+I2Faqzs44oMChy+WIZNkdflQsMPvGbD0nPw0I6LWp bADWDEACTKun58hTEuA== 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: linux-kernel@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