From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8730649659 for ; Fri, 27 Feb 2026 00:51:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772153486; cv=none; b=cJLQcv1SB/1JDMu1bgxPu+I9dklPWmmeD59b4UXmOmRyRCnS6//5cPFpuDU+DVJqCbRzxh4hVKqo6tGabTJXepdeJql4dLyYK4weGK0/zLNv9RB/YQ9nTV0rbQTqq2yD5Z5Nn1+9+Moxwp2BquVKFmNvMWRV/A+El8MpqLXEsDo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772153486; c=relaxed/simple; bh=RyZXx/G7qCicaZId45D0cNgeQ8TX0mKD9axtH69slQo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jUaVDRTCdyiSiNos1c83sLAullGQYntSRCbSWQf6W5rndj8Sa1ULp2k+MjHp3VxNSueXXBPvdsVU84Sck6l6GJi9uGZ/hJ8ON3Xoe5LviX8pqhYCwr3icwq5h0gghWvFQQZE7nueqCyk6oLh3/J9vXqbagtyZthoTHjUE6Qd5sk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=KV+yYfL3; arc=none smtp.client-ip=209.85.214.180 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="KV+yYfL3" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2ada721eda1so6584435ad.2 for ; Thu, 26 Feb 2026 16:51:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1772153484; x=1772758284; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MbrSIpDE3Y8TNhyTW+6lYUs18ku3UAynLvTznEtk/Vk=; b=KV+yYfL3RSTVSGk8zPgiMYi1QxoJ4iyFJaBlfRxKrxMv2CCbZKiRK/6BH23MWBqsZS rF+F0m+o/yWe1FkKbp7TFSVIO6HG6elJYI6oXqrqx3juZ51qFzIswmQIAB4zgwZbKaEN /9B5wVem+oXu9Clr+wFdvqzS+s9aMNZ7XOy+5u0PMl9GXMvX4YwZxxzWRpxce/ygotv5 GHKd+TfodlrNdiOKX9RhHGqNHFTr3CIKkYcd3SXTE9Yrv3Sgp4YKcoGDY+1/A9oXu3wi aZ2AtafAcT3gU2/tugcMopjO6eJgXysOzMHswmwzfqhzXh1LPwCtbxmZmWF0LTT1NQaF vqXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772153484; x=1772758284; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MbrSIpDE3Y8TNhyTW+6lYUs18ku3UAynLvTznEtk/Vk=; b=AXFQrEcGXos9IpRSBi9U83GCW7XTWEOl2a5kXxQueH6F0D2aGjpdiLo0Xy0N4FbOln EnaMS1niin8FSNeqWshrjSk6jNQsSYnH8biPVuT6KlDVIVx//sYzsXqeL3e3sH4wugLe rzEJ2UUPmp/bsd+BJtf1fnqT05NcWDETmopNBlZmMcxfE6GN4mF7+8kFKAshasu6PZ2B 60X2N4iMjhXK0RZBCZo9q/ANvdXAfeSrFV6QvcXDgUkAlo1m9MbTGZ+L9bqYb+EmNS5+ +k6hdf+Py9YPwlWPtYdx5BiH19+m/aFiCOeZJGfX6ywFuAEgelnzbwdwtlZZiobXUBNM KLjQ== X-Forwarded-Encrypted: i=1; AJvYcCUiUTs+dgux+hSEI7UNVHPFTgkD2IzFGa0VqAXEvaWf3NgsAHGMy3ZAZ+SeolBg2kwZQEYh1xuBKlLWlRk=@vger.kernel.org X-Gm-Message-State: AOJu0YzaiQJHa+8jUeIKoKjHAebS2qWR2ZlQ9QQS7W+zPyQLXTV5ZERm +tQtOxy4JK5C7bygy2sk4sVsuYC3oQI76z20nwCgj2QnZz0juqmMdJ0nxLixxSg2Jw== X-Gm-Gg: ATEYQzy8liKWbIfmrF9qUAw84Be1c2zGlfBD08yGhReUOVUtYYGaFay2gJXbhXBBlv4 qp5IKDftdFhrmNugXXa6VegxB3sSdcDjBpEBcZ+j5rPpEE7EqSU6FWsyn7zp9lp4ppqMDlRIaXT C8a2+clBnlX5RK7IBzegudG2nej1uprEhDO7oXTkozXy7kBiQSDHAV8qfeBmhGhJtyCyS9OGC89 SLmVp6hLycnobd1oUGNynqoMIo86NDvEpQS0285lEhMAqhzn0AfjHSgIYEDGTVFmEHwl+/0l7Dz rePC9AENSGt1Q0xpme70BKI/urcP77FwR9JzyB0X41/6OYErD5CRp/CaPIHOiimpmrBKaYe91c6 KJ3E3IdOPrSGufgM8tIVwL85yqzKMRMVfaqMpgeK5vpeG3/0cCd2geFKjKe4yZZKCOUhGCz++4W CEJoiDxbPoY1ue5qTnnXgX51ugn77bist1R5iWKdCIaM9BeVGmGNoWu+fh3fsbeQ== X-Received: by 2002:a17:903:41cb:b0:2ad:ba04:40ca with SMTP id d9443c01a7336-2ae2e419430mr8325415ad.25.1772153483265; Thu, 26 Feb 2026 16:51:23 -0800 (PST) Received: from google.com (239.23.105.34.bc.googleusercontent.com. [34.105.23.239]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb6b974csm34254135ad.65.2026.02.26.16.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 16:51:22 -0800 (PST) Date: Fri, 27 Feb 2026 00:51:18 +0000 From: David Matlack To: Alex Williamson Cc: 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?Q?Micha=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 =?iso-8859-1?Q?Hellstr=F6m?= , 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: References: <20260129212510.967611-1-dmatlack@google.com> <20260129212510.967611-11-dmatlack@google.com> <20260226170030.5a938c74@shazbot.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260226170030.5a938c74@shazbot.org> On 2026-02-26 05:00 PM, Alex Williamson wrote: > On Thu, 29 Jan 2026 21:24:57 +0000 > David Matlack wrote: > > - /* If reset fails because of the device lock, fail this path entirely */ > > - ret = pci_try_reset_function(pdev); > > - if (ret == -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 = vdev->liveupdate_incoming_state->reset_works; > > + } else { > > + /* > > + * If reset fails because of the device lock, fail this path > > + * entirely. > > + */ > > + ret = pci_try_reset_function(pdev); > > + if (ret == -EAGAIN) > > + goto out_disable_device; > > + > > + vdev->reset_works = !ret; > > + } > > This could maybe be incrementally cleaner in a > int vfio_pci_core_probe_reset(struct vfio_pci_core_device *vdev) > helper. Will do. > > > > - vdev->reset_works = !ret; > > pci_save_state(pdev); > > vdev->pci_saved_state = pci_store_saved_state(pdev); > > Isn't this a problem too? In the first kernel we store the initial, > post reset state of the device, now we're storing some arbitrary state. > This is the state we're restore when the device is closed. The previous kernel resets the device and restores it back to its post reset state in vfio_pci_liveupdate_freeze() before handing off control to the next kernel. So my intention here is that VFIO will receive the device in that state, allowing it to call pci_store_saved_state() here to capture the post reset state of the device again. Eventually we want to drop the reset in vfio_pci_liveupdate_freeze() and preserve vdev->pci_saved_state across the Live Update. But I was hoping to add that in a follow up series to avoid this one getting too long. > > diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h > > index 350c30f84a13..95835298e29e 100644 > > --- a/include/linux/vfio_pci_core.h > > +++ b/include/linux/vfio_pci_core.h > > @@ -16,6 +16,7 @@ > > #include > > #include > > #include > > +#include > > > > #ifndef VFIO_PCI_CORE_H > > #define VFIO_PCI_CORE_H > > Wouldn't a forward declaration do, and the kho/abi include can be kept > out of the public header? Also should be in the previous patch? Will do.