From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from flow-b4-smtp.messagingengine.com (flow-b4-smtp.messagingengine.com [202.12.124.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A955D322B6D; Fri, 27 Feb 2026 22:23:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.139 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772231024; cv=none; b=a31slK/B4aEQn99GEZgx22nbTX5S855KWZk9hWQgjj6LCf7FaVGUGm8/ax3dH1nlxPPlebDmbvaBN0d7kkK2v/kL/06xfpwFdQyx1wN33W/KBiwqLyyEo/D4kHrSMVeiYcUP8smRj3uweeh0vRu7fjTF6jnoGYTru4z1x7CN6c0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772231024; c=relaxed/simple; bh=KBMAvSvDQckqME7TpGCiPOU7XymSowZAfDJAaO+tQHY=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SFdXC659GFILCXk/KnG7aO1FWugeKmz8uka3Q9kwGoSMsosNdBRDsC6smJgfF0V/RJlXCjBtvm4jDTurZdF+nanyuCAe2zyGvTPIAc5ScXi6LfbDewffUb7BaIBQpoYUEVKJ6+IqWkIjjT46xg1Nr3szqoeUt5mglLHwTFmB3KU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shazbot.org; spf=pass smtp.mailfrom=shazbot.org; dkim=pass (2048-bit key) header.d=shazbot.org header.i=@shazbot.org header.b=ibyQ9xq8; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=heYMklfx; arc=none smtp.client-ip=202.12.124.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shazbot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shazbot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=shazbot.org header.i=@shazbot.org header.b="ibyQ9xq8"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="heYMklfx" Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailflow.stl.internal (Postfix) with ESMTP id 617581300E4D; Fri, 27 Feb 2026 17:23:40 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Fri, 27 Feb 2026 17:23:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shazbot.org; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1772231020; x=1772238220; bh=5gDryY4zQRH428jXcjjSGP/R/ZBS8LlxLYxDdPgkkiE=; b= ibyQ9xq81ZUFDtngjlebvG4FaCgNpNNbQr1R+mWKzerZDqZJKaMwf0HBblpSPQ91 VFdvsMyKGU5Tg9sMFl/57BZro8wkMOPw1LWE3jqikOFmHEQcnmlkJjpTO3zUAXow XOqfcAa0iIMoieG9RdcB8yL8non1RpY3YX3cBZWsNRzgZoVDHcW4WvsrdYMvRR4O kXG9r5jcj3nRPeI3wIZjCqx9pYJ+ovtiJyFyz/zG1Tnpx+Wt4tq5H6UYxb5/xjlk lkG0YgCvfdWXxZfC5tYJ4+h6oCW1XZQUWE5ZXPBMY4qfpryKhrz4mlFKl0CtABZh ozaeXUkPc0VOpKeMVm0KzA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1772231020; x= 1772238220; bh=5gDryY4zQRH428jXcjjSGP/R/ZBS8LlxLYxDdPgkkiE=; b=h eYMklfxrT1hKh6s89IGlVCYgodJjyXuEtJzsN6GWawwrgE3RWvsVXiKD+nITWgWN uNh/M4JytKcYo90WUBaxX6+sbp0D1FJQarxN9Bl5nKn6toxi0MxhIWTI6N3FuwqC O38dHRyoBq/f0uv0cZ0cpvnBSDck1XGNuRuaccj7YkBP9n+efQLf7Dwy5Hdi+GHk 8YOK86rNlDdXf8PkgONcfllG3kXVA5sq8Bm5XES78tNMaptniFche5ptLjl7/U+u AoG867Fox04IbnG/hATygTqTDaZqoKyJxDxYxhOyZQugp7Mthn77Ts4A+ePYYqlV Z++xJLYSuIBgqTjIBJbjg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvhedtudelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkjghfofggtgfgsehtqhertdertdejnecuhfhrohhmpeetlhgvgicu hghilhhlihgrmhhsohhnuceorghlvgigsehshhgriigsohhtrdhorhhgqeenucggtffrrg htthgvrhhnpeetuefgleefhfdvueegffdtffevhfffgfffiedutdetgffhheejtdekfeek ieehgfenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvgigsehshhgriigsohhtrdhorhhg pdhnsggprhgtphhtthhopeegiedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepug hmrghtlhgrtghksehgohhoghhlvgdrtghomhdprhgtphhtthhopehhvghlghgrrghssehk vghrnhgvlhdrohhrghdprhgtphhtthhopegrjhgrhigrtghhrghnughrrgesnhhvihguih grrdgtohhmpdhrtghpthhtohepghhrrghfsegrmhgriihonhdrtghomhdprhgtphhtthho pegrmhgrshhtrhhosehfsgdrtghomhdprhgtphhtthhopegrphhophhplhgvsehnvhhiug hirgdrtghomhdprhgtphhtthhopegrkhhpmheslhhinhhugidqfhhouhhnuggrthhiohhn rdhorhhgpdhrtghpthhtoheprghnkhhithgrsehnvhhiughirgdrtghomhdprhgtphhtth hopegshhgvlhhgrggrshesghhoohhglhgvrdgtohhm X-ME-Proxy: Feedback-ID: i03f14258:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 27 Feb 2026 17:23:31 -0500 (EST) Date: Fri, 27 Feb 2026 15:23:30 -0700 From: Alex Williamson To: David Matlack Cc: Bjorn Helgaas , Adithya Jayachandran , Alexander Graf , Alex Mastro , Alistair Popple , Andrew Morton , Ankit Agrawal , Bjorn Helgaas , Chris Li , David Rientjes , Jacob Pan , Jason Gunthorpe , Jason Gunthorpe , Jonathan Corbet , Josh Hilke , Kevin Tian , kexec@lists.infradead.org, kvm@vger.kernel.org, Leon Romanovsky , Leon Romanovsky , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, Lukas Wunner , =?UTF-8?B?TWlj?= =?UTF-8?B?aGHFgg==?= Winiarski , Mike Rapoport , Parav Pandit , Pasha Tatashin , Pranjal Shrivastava , Pratyush Yadav , Raghavendra Rao Ananta , Rodrigo Vivi , Saeed Mahameed , Samiullah Khawaja , Shuah Khan , Thomas =?UTF-8?B?SGVsbHN0csO2bQ==?= , Tomita Moeko , Vipin Sharma , Vivek Kasireddy , William Tu , Yi Liu , Zhu Yanjun , alex@shazbot.org Subject: Re: [PATCH v2 02/22] PCI: Add API to track PCI devices preserved across Live Update Message-ID: <20260227152330.1b2b0ebb@shazbot.org> In-Reply-To: References: <20260129212510.967611-3-dmatlack@google.com> <20260225224651.GA3711085@bhelgaas> <20260227093233.45891424@shazbot.org> <20260227112501.465e2a86@shazbot.org> X-Mailer: Claws Mail 4.3.1 (GTK 3.24.51; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 27 Feb 2026 14:19:45 -0800 David Matlack wrote: > On Fri, Feb 27, 2026 at 10:25=E2=80=AFAM Alex Williamson wrote: > > > > On Fri, 27 Feb 2026 09:19:28 -0800 > > David Matlack wrote: > > =20 > > > On Fri, Feb 27, 2026 at 8:32=E2=80=AFAM Alex Williamson wrote: =20 > > > > > > > > On Thu, 26 Feb 2026 00:28:28 +0000 > > > > David Matlack wrote: =20 > > > > > > > +static int pci_flb_preserve(struct liveupdate_flb_op_args *a= rgs) > > > > > > > +{ > > > > > > > + struct pci_dev *dev =3D NULL; > > > > > > > + int max_nr_devices =3D 0; > > > > > > > + struct pci_ser *ser; > > > > > > > + unsigned long size; > > > > > > > + > > > > > > > + for_each_pci_dev(dev) > > > > > > > + max_nr_devices++; =20 > > > > > > > > > > > > How is this protected against hotplug? =20 > > > > > > > > > > Pranjal raised this as well. Here was my reply: > > > > > > > > > > . Yes, it's possible to run out space to preserve devices if dev= ices are > > > > > . hot-plugged and then preserved. But I think it's better to def= er > > > > > . handling such a use-case exists (unless you see an obvious sim= ple > > > > > . solution). So far I am not seeing preserving hot-plugged devic= es > > > > > . across Live Update as a high priority use-case to support. > > > > > > > > > > I am going to add a comment here in the next revision to clarify = that. > > > > > I will also add a comment clarifying why this code doesn't bother= to > > > > > account for VFs created after this call (preserving VFs are expli= citly > > > > > disallowed to be preserved in this patch since they require addit= ional > > > > > support). =20 > > > > > > > > TBH, without SR-IOV support and some examples of in-kernel PF > > > > preservation in support of vfio-pci VFs, it seems like this only > > > > supports a very niche use case. =20 > > > > > > The intent is to start by supporting a simple use-case and expand to > > > more complex scenarios over time, including preserving VFs. Full GPU > > > passthrough is common at cloud providers so even non-VF preservation > > > support is valuable. > > > =20 > > > > I expect the majority of vfio-pci > > > > devices are VFs and I don't think we want to present a solution whe= re > > > > the requirement is to move the PF driver to userspace. =20 > > > > > > JasonG recommended the upstream support for VF preservation be limited > > > to cases where the PF is also bound to VFIO: > > > > > > https://lore.kernel.org/lkml/20251003120358.GL3195829@ziepe.ca/ > > > > > > Within Google we have a way to support in-kernel PF drivers but we are > > > trying to focus on simpler use-cases first upstream. > > > =20 > > > > It's not clear, > > > > for example, how we can have vfio-pci variant drivers relying on > > > > in-kernel channels to PF drivers to support migration in this model= . =20 > > > > > > Agree this still needs to be fleshed out and designed. I think the > > > roadmap will be something like: > > > > > > 1. Get non-VF preservation working end-to-end (device fully preserved > > > and doing DMA continuously during Live Update). > > > 2. Extend to support VF preservation where the PF is also bound to v= fio-pci. > > > 3. (Maybe) Extend to support in-kernel PF drivers. > > > > > > This series is the first step of #1. I have line of sight to how #2 > > > could work since it's all VFIO. =20 > > > > Without 3, does this become a mainstream feature? =20 >=20 > I do think there will be enough demand for (3) that it will be worth > doing. But I also think ordering the steps this way makes sense from > an iterative development point of view. >=20 > > There's obviously a knee jerk reaction that moving PF drivers into > > userspace is a means to circumvent the GPL that was evident at LPC, > > even if the real reason is "in-kernel is hard". > > > > Related to that, there's also not much difference between a userspace > > driver and an out-of-tree driver when it comes to adding in-kernel code > > for their specific support requirements. Therefore, unless migration is > > entirely accomplished via a shared dmabuf between PF and VF, > > orchestrated through userspace, I'm not sure how we get to migration, > > making KHO vs migration a binary choice. I have trouble seeing how > > that's a viable intermediate step. Thanks, =20 >=20 > What do you mean by "migration" in this context? Live migration support, it's the primary use case currently where we have vfio-pci variant drivers on VFs communicating with in-kernel PF drivers. Thanks, Alex