From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f49.google.com (mail-dl1-f49.google.com [74.125.82.49]) (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 245F3384CFB for ; Tue, 12 May 2026 21:29:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778621370; cv=none; b=M5GsjH8IoIVJhzWpIZQRUT3jCZHdRlVg9oEchCsZSaEpO0tN/ZPz7W9ctx4cUKa4lBom1V0df6hmgmScRy/6Mqb/3Le0yUL1QJmhVUK/fF4wnMegbG961AfXoK5xm6KLs0JwWh6JSeaxLY2SPQ7Sbl0myWUvCSyWo9ZXUmcNmvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778621370; c=relaxed/simple; bh=PVEZ6lDsqfrkheYFwj2coqzGfYHxktZ0uXkER3yjEWc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tc3r1Cj433lNTP3bVmWErNdkNLobxAOQGiV/0NOZ0rLHXgdthHWmuLzLK5mby2qnaG1R7sPw+iHNPhgU+oRDucmpmfoiDEgmT7muCQNvyqEuE3ZP6Y6El5AqoiI3QozGIQV6eQDej9RpA0nDFdQTHgL18HJAPJ82BKi2NBDWxKg= 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=joIsy5ya; arc=none smtp.client-ip=74.125.82.49 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="joIsy5ya" Received: by mail-dl1-f49.google.com with SMTP id a92af1059eb24-1336742714fso105c88.1 for ; Tue, 12 May 2026 14:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778621368; x=1779226168; 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=9as17r1aSDL1/IjkeK3rxFdLzhg/o+IZ2HDHZMfPp0s=; b=joIsy5yapzhC98P2M4vACUwA40DOUqKZWvv9YrvwP24uwPFJL0dtdQ9iKvqMSayD1U JoFjy7eWsnCrehQqJkeNAPwnlZPdd/qB6Tx1jlf+8NHIgZU+BcRM+CQ8cOJ9CEBP0Txh s++8bMjVvBasJwV7a1cxxWiH8pdmgcfDv5y6mxVF6B+KMfHRc2kiBMABvrZpp/QhHU+q rUsEOZ6+kTduiCsQzKyqqO0uhK9O9pGfADe7mtlpZE4uNMG/al6Hr/jxpiOj2LayZqkJ brqtiDwDq6zBASxCanooiIJ8/SPurupPOu/zvBt1/6UQ1eYIuivGtMkfET6BlQ7kBg6G cS2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778621368; x=1779226168; 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=9as17r1aSDL1/IjkeK3rxFdLzhg/o+IZ2HDHZMfPp0s=; b=TeR6YOUfA62K3DXY8UTN3DiS+znAhZ6yC/TItPzmUnuDEaT+3/Cn6oH+gqmTVaj4X8 e8GDxuVb2+qhp80t5K1r5ufSHfg0XJ1kUeKtj+jimI/KuE2H/c7gl14Yl7WQ6bAgshvu JieUBqvul8xx8hHq7uQkTnMZN1PTv5aWWqJ9jnsS5MD7xdAzslCcE3qRXnMRRhWuccKy pdI8KcTd/AnmputA0EgB3bmCW3Utav8JnlMas0jy5k/89MSAz4cOH5J+HGok85cAyxAP QAy0zoSqQFhRCSepsL8th3hTHEe+RV8ln5gvS1STRDXGghTu53R2sOMQ1SC2fNvXlQEF s8sw== X-Forwarded-Encrypted: i=1; AFNElJ/Jo9y0LmapiVQ8J4qQReB+E+ZHiZafrHdP4eJZJ8iO+wf6pLOmi+nrHyES8XLGj3kYEQwDrzSrxh4BYQc=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1oIAYagF9xaCleJP9AVqVU2/AFH96KbscPwWE1zoYQwxQSAEU cCiyV/LAih9H6fpKKtMAmnXIWa4uidcu4sgqvJfkxmV1vmf9z4ozCbGex7gbcFVR5Q== X-Gm-Gg: Acq92OGiS/ede0kpGJfA+DZYWMLwPATNumOj8ZJpafchM1LnQHbNn6Zvkh8ep/ru5WZ mzSjd/FcninpN4gGoYl27aDTs7OoinvN/mVq8uNVz/dvSwJ+0Em7iFrU7pHi+kB0LONFaaNiirM 5wFGV+C9TpZnivGiWlBR4c2BtHIHtnIGhCZdEUtYMctsVG8mvgqDgHgtUyTpX+gKUMYmz7yIoNE 1cjobxsZzwLTX6hCpO8VBfZuZJvkMpuwCJ0rWtuHFguC26OmGOUvaaePodh4uo0qYATH1K7bDOx aLLAADl7S9SnIAzwUuIeYPmrWSET0xB/MxAA1dFOWo83agdAwGgSra1r+nztRP0o8KnDxaUuajf fwKNgkMSBK+CDuOc2+dzVQVIVrBarEGoVBxlMF/3rbog8qzD9G7pZ3GvlzgtF1SUzxlnq6R9fTA nrcvuxiMzRWWj3dQmA3DYR4Bh9CQKNQYIMtvzqBmdAZ5f8TDXTKGWT0xiO254ZpxFMPh2mqUg4 X-Received: by 2002:a05:7022:699a:b0:132:1e01:2d6d with SMTP id a92af1059eb24-13401ba684emr108868c88.2.1778621364956; Tue, 12 May 2026 14:29:24 -0700 (PDT) Received: from google.com (176.13.105.34.bc.googleusercontent.com. [34.105.13.176]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1327821fc59sm23087120c88.7.2026.05.12.14.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2026 14:29:24 -0700 (PDT) Date: Tue, 12 May 2026 14:29:19 -0700 From: Vipin Sharma To: David Matlack Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-pci@vger.kernel.org, ajayachandra@nvidia.com, alex@shazbot.org, amastro@fb.com, ankita@nvidia.com, apopple@nvidia.com, chrisl@kernel.org, corbet@lwn.net, graf@amazon.com, jacob.pan@linux.microsoft.com, jgg@nvidia.com, jgg@ziepe.ca, jrhilke@google.com, julianr@linux.ibm.com, kevin.tian@intel.com, leon@kernel.org, leonro@nvidia.com, lukas@wunner.de, michal.winiarski@intel.com, parav@nvidia.com, pasha.tatashin@soleen.com, praan@google.com, pratyush@kernel.org, rananta@google.com, rientjes@google.com, rodrigo.vivi@intel.com, rppt@kernel.org, saeedm@nvidia.com, skhan@linuxfoundation.org, skhawaja@google.com, vivek.kasireddy@intel.com, witu@nvidia.com, yanjun.zhu@linux.dev, yi.l.liu@intel.com Subject: Re: [PATCH v4 02/16] vfio/pci: Preserve vfio-pci device files across Live Update Message-ID: <20260512211412.GA2819150.vipinsh@google.com> References: <20260511234802.2280368-1-vipinsh@google.com> <20260511234802.2280368-3-vipinsh@google.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: On Tue, May 12, 2026 at 01:59:51PM -0700, David Matlack wrote: > On Mon, May 11, 2026 at 4:48 PM Vipin Sharma wrote: > > > diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig > > index c12d614fc6c4..019de053f116 100644 > > --- a/drivers/vfio/pci/Kconfig > > +++ b/drivers/vfio/pci/Kconfig > > @@ -45,13 +45,15 @@ config VFIO_PCI_IGD > > > > config VFIO_PCI_LIVEUPDATE > > bool "VFIO PCI support for Live Update (EXPERIMENTAL)" > > - depends on PCI_LIVEUPDATE > > + depends on PCI_LIVEUPDATE && VFIO_DEVICE_CDEV > > help > > Support for preserving devices bound to vfio-pci across a Live > > Update. This option should only be enabled by developers working on > > implementing this support. Once enough support has landed in the > > kernel, this option will no longer be marked EXPERIMENTAL. > > > > + Enabling this will disable support for VFIO PCI DMA buffer. > > + > > If you don't know what to do here, say N. > > > > endif > > @@ -68,7 +70,7 @@ config VFIO_PCI_ZDEV_KVM > > To enable s390x KVM vfio-pci extensions, say Y. > > > > config VFIO_PCI_DMABUF > > - def_bool y if VFIO_PCI_CORE && PCI_P2PDMA && DMA_SHARED_BUFFER > > + def_bool y if VFIO_PCI_CORE && PCI_P2PDMA && DMA_SHARED_BUFFER && !VFIO_PCI_LIVEUPDATE > > Why does enabling VFIO_PCI_LIVEUPDATE require disabling > VFIO_PCI_DMABUF? I saw the cover letter says "to keep things simple", > but what specific problem does this solve or simplify? I should have provided more details there. When device is getting reset in vfio_pci_liveupdate_freeze(), we are zapping userspace mapped bars, we also need to use vfio_pci_dma_buf_move() to revoke dma buffer access or vfio_pci_dma_buf_cleanup() combination. Cleanup takes the memory lock which freeze already takes, and there are some refcounts which are managed in both of these APIs. This was causing complexities with code flow based on result of pci_load_saved_state(). All this was adding more refactoring than I wanted in the series. I decided to just drop the change and disable the support of DMA Buffer for now to keep number of patches less in the series. This will go away once we remove reset condition in freeze.