From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DD1DD27E; Fri, 30 Jan 2026 00:31:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769733116; cv=none; b=Ku1jTlPE9hz4bJCP0t6gzwYjFwvjHd7g/oVY/IOUaBWpojhHWgUTW6dFhf2wh0EcgR7/UOKrqTekBCrBynqTwg1Ul4X3JHuU1VbBnCs6fyfunqbKBY1EO2oltAQx3Acdvadoc8UbbLnRxL37FmJu9NtNvuFuIAWyIYiMGD4bGQs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769733116; c=relaxed/simple; bh=iKHyY2AgpsoE57kanXCC6ExkTSdYkPtSVMy6708F8GM=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Q+5swqGJfwKwXxHaVCNinYXLUbOgXNujYI5bMkxpZh5rsWDUmwC8W2aS6ION9MTJHIcXmLm08QwPqB7iTmjlg3PzLUYfCrFMQ9/AxOFFi/g3LM1Yc3ZIoainHxHDOkh3rsFqxDcskPBkBs+8JXB2kGkVgGSV5rPSjaYCP8XpfIk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=eEaDTQq+; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="eEaDTQq+" Received: from localhost (unknown [52.148.140.42]) by linux.microsoft.com (Postfix) with ESMTPSA id 02ED820B7167; Thu, 29 Jan 2026 16:31:52 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 02ED820B7167 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1769733114; bh=5QTLnbHZvfOsZm6P1XTvKuZKL+X4Zqmm8W+hY1sTkg8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=eEaDTQq+Esr/RUhilvTOCceWy537iSweTVrOCQF87LN7ewfzzEyzyd4RUlTpzT2bW kg7uIcbs9tYpacoilvpa5mW4vUKyQ+xSa6CjgGAzcB47rSlnza3XRXVmL0xeyblupb 26ODqz1MAroYBEfMeqzG7EalDwPpbFYk2tLsdDZs= Date: Thu, 29 Jan 2026 16:31:50 -0800 From: Jacob Pan To: David Matlack Cc: Alex Williamson , Adithya Jayachandran , Alexander Graf , Alex Mastro , Alistair Popple , Andrew Morton , Ankit Agrawal , Bjorn Helgaas , Chris Li , David Rientjes , 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?Q?Mich?= =?utf-8?Q?a=C5=82?= 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?Q?Hellstr=C3=B6m?= , Tomita Moeko , Vipin Sharma , Vivek Kasireddy , William Tu , Yi Liu , Zhu Yanjun Subject: Re: [PATCH v2 10/22] vfio/pci: Skip reset of preserved device after Live Update Message-ID: <20260129163150.000059a2@linux.microsoft.com> In-Reply-To: References: <20260129212510.967611-1-dmatlack@google.com> <20260129212510.967611-11-dmatlack@google.com> <20260129142158.00004cdc@linux.microsoft.com> Organization: LSG X-Mailer: Claws Mail 3.21.0 (GTK+ 2.24.33; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@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 Hi David, On Thu, 29 Jan 2026 22:33:13 +0000 David Matlack wrote: > On 2026-01-29 02:21 PM, Jacob Pan wrote: > > On Thu, 29 Jan 2026 21:24:57 +0000 David Matlack > > wrote: =20 >=20 > > > diff --git a/drivers/vfio/pci/vfio_pci_core.c > > > b/drivers/vfio/pci/vfio_pci_core.c index > > > b01b94d81e28..c9f73f597797 100644 --- > > > a/drivers/vfio/pci/vfio_pci_core.c +++ > > > b/drivers/vfio/pci/vfio_pci_core.c @@ -515,12 +515,24 @@ int > > > vfio_pci_core_enable(struct vfio_pci_core_device *vdev) if (ret) > > > goto out_power; > > > =20 > > > - /* If reset fails because of the device lock, fail this > > > path entirely */ > > > - ret =3D pci_try_reset_function(pdev); > > > - if (ret =3D=3D -EAGAIN) > > > - goto out_disable_device; > > > + if (vdev->liveupdate_incoming_state) { > > > + /* > > > + * This device was preserved by the previous > > > kernel across a > > > + * Live Update, so it does not need to be reset. > > > + */ > > > + vdev->reset_works =3D > > > vdev->liveupdate_incoming_state->reset_works; =20 > > > > Just wondering what happened to skipping the bus master clearing. I > > understand this version does not preserve the device itself yet; I=E2= =80=99m > > just curious whether there were specific difficulties that led to > > dropping the earlier patch which skipped clearing bus master. =20 >=20 > Hi Jacob, >=20 > There's several places where bus master gets cleared that we need to > eventually eliminate to fully preserve the device. >=20 > 1. vfio_pci_liveupdate_freeze() clears it during shutdown when it > restores vdev->pci_saved_state. > 2. pci_device_shutdown() clears it during shutdown. > 3. vfio_pci_core_enable() clears it when the preserved device file > is bound to an iommufd after the Live Update (in > vfio_pci_core_enable()). >=20 > I think it would be safe to skip (3) in this series, since that's very > similar to how this series skips resets during vfio_pci_core_enable() > for preserved devices. >=20 > But I don't think it would be safe to skip (1) or (2) until the > attached iommufd is fully preserved. >=20 > If you are just asking about (3) then I agree it could be skipped and > I can include that in the next version. I was just asking about (3) and trying to understand the asymmetric handling compared to reset. I don=E2=80=99t have a strong preference since = this is temporary=E2=80=94thanks for the explanation. I=E2=80=99ve been testing my noiommu cdev patches on top of yours, and so f= ar they behave the same as with a real IOMMU. As you noted, however, final device preservation still depends on iommufd.