From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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 EA32E32939C for ; Thu, 29 Jan 2026 22:33:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769726002; cv=none; b=rJnckRQG8ZpN6mOphNOt8Z6xNw9UVogS/Rf5IUcX6R9tW43FMK0up/U2V5Mj0vZfO1hqAe9qMMN0dscrbEsupvavLGfR7mBrgEBNXtva0z1OtmZL58rQYZNrHBaE8lN69kNchJb+BcAlAQzPAB6LMpUbvt9FjPcoDyAgSM0U4e8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769726002; c=relaxed/simple; bh=v63/Q89R1FZp3eIace6yEluQWPmCvUnvUR/7uDkLuXk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ASTEl6m6ZuRswvv195LtduE8dsoKKpWkjsyVRKjON50bjkcsrRqK603h5NzrgGBNVsxUeqzMUVU5RRbNtX52BIR5y1sWhoBmH8vsALmwVYY9VTFiXLzLt6oFPOMgvGVJgtdBkaCQdMIAs0sQ/aWrX3CDbwAgdZU/YKcycSy32IQ= 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=ByDLftJw; arc=none smtp.client-ip=209.85.210.172 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="ByDLftJw" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-81f47610542so876057b3a.0 for ; Thu, 29 Jan 2026 14:33:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769726000; x=1770330800; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=dBZ3PFz9KqTT7KdM5e4cMtXwD446xZIZixlzxugjwak=; b=ByDLftJwm+ggKAtpqCU9sPZffMWsEUrPGlXYxLmcxXvEW2byFmmvqfi2d01fyEQEMb MwhFVh3cp4Y5o0bKokJMPdnGLYqEXcrActt5hjA6Zte2xnVh0jf/E3MPQ2Z6fRih8t1m lxR4LUyDfzoBoC5OH0lWEf6RuUHQpGHPtiHoOiZpgaWlOfdFQZ3hiJoXZ0VsorP7VNwt zbXj9JvDROjUvSKfSMLwr9R0sIDSR1JipmmZRm5xbVwZnNbvyQYg9vZt4NRHkezN3bEs qm9OC7jqRQeTcAdtpZgNSTOUzwAwWzJgmACaT4toFUT5eFZrRiThC4MtKcUDKYWSt7we VK/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769726000; x=1770330800; h=in-reply-to:content-transfer-encoding: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=dBZ3PFz9KqTT7KdM5e4cMtXwD446xZIZixlzxugjwak=; b=hfnuTltPA0RPFir4uRNshY9tCw6AY/yPgewuwQXKWhVtn7mUB0Co693K4zCSYS7ut/ J94G3rNtYvT1LcbQEKGi3Whai8yz8tpwKzDvhMRbO0i0aF3Snlyx8hcl0WwXdJ5rspul wNkgBWLtF/v5DtnOZfsmpP1TSQ8l6dFzg4jvFIrTHQOjhwA4z32g4A5Wy0G+Wgyr1bal 6VmCF/7mvUiGiSM+0GZXuNnehsdmNVWzGMgwVmrVAeG/v7vpXApx51N/q1f9t6IJFIWr bB1F08gCxX09ogH7KD759rq+wB+XuBuz2VGbczmYKEth6mvmCwWaM0PMEORzWFvfAM8m DQBg== X-Forwarded-Encrypted: i=1; AJvYcCWv9DoA162IDfFkaigQEDlWT/TdmlirHymiPjnyDamHb4u1cIxnmBKGUoUqsvTPi3D5Z0xFgd6jVh3HpKo=@vger.kernel.org X-Gm-Message-State: AOJu0Ywf5w1g4SAXQZm5kNBUq7Dmtc9+s0C+5XnHDA2U6UWBAPIBhcdP fAwMRDkDc4AnRO+snE+sQa10VRR3nCPsQkErF+kV2XswVPq7AXiNUUgY3u2Pwp1Plw== X-Gm-Gg: AZuq6aIpWVa/9qaPv850HOtrpMhjaIXf+p3lfDrSEg+thodsbIM5X0nN7M4Sf+wy4bO /1/nV2Opw7SaoqAeCQT0fUo+AJH2jxQ0JUfJS9XW2Do5tIv0EZflvkklLXztanNTuAS3aiFNRfP r431nqORSa6TJRS/x8XpdxfwnPowH5kEhfujewPh0L1gR/CUdUb0wKCxNTa2rkbENaFuRG/yXwq kIIMXFi6OQw5OU/mSXt5bLry6TIaDicLE6NxPSsSjoC9P11iJ+E77ktFMCvQvsTkC4uWGalsfTW jZewny7d05xH5yOzqB53ZfkL1d6XG0MfMH0h3FVo6C4RR2TuDXAsbWpBPzfNbhCumpraEF65vhS +xGVixCw0+k3mRPxiF7KlzsApFi4uEOsR1fagV3PlR5XNUw9KHPx3slQ8l+os9y0ve7AjwoilTR cBmAfHkVZpLqo3IroU4I9InavBVy33zBHFNjk4/3UEDgO6iOGHqQ== X-Received: by 2002:a05:6a00:1f0d:b0:81f:5ec1:8bcd with SMTP id d2e1a72fcca58-823ab684bffmr621422b3a.20.1769726000049; Thu, 29 Jan 2026 14:33:20 -0800 (PST) Received: from google.com (79.217.168.34.bc.googleusercontent.com. [34.168.217.79]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82379bfd797sm6165100b3a.43.2026.01.29.14.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jan 2026 14:33:17 -0800 (PST) Date: Thu, 29 Jan 2026 22:33:13 +0000 From: David Matlack To: Jacob Pan 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?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> <20260129142158.00004cdc@linux.microsoft.com> 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260129142158.00004cdc@linux.microsoft.com> On 2026-01-29 02:21 PM, Jacob Pan wrote: > On Thu, 29 Jan 2026 21:24:57 +0000 David Matlack wrote: > > 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; > > > > - /* 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; > > Just wondering what happened to skipping the bus master clearing. I > understand this version does not preserve the device itself yet; I’m > just curious whether there were specific difficulties that led to > dropping the earlier patch which skipped clearing bus master. Hi Jacob, There's several places where bus master gets cleared that we need to eventually eliminate to fully preserve the device. 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()). 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. But I don't think it would be safe to skip (1) or (2) until the attached iommufd is fully preserved. If you are just asking about (3) then I agree it could be skipped and I can include that in the next version.