lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251102151253.GA50752@unreal>
Date: Sun, 2 Nov 2025 17:12:53 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Alex Williamson <alex@...zbot.org>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
	Logan Gunthorpe <logang@...tatee.com>, Jens Axboe <axboe@...nel.dk>,
	Robin Murphy <robin.murphy@....com>, Joerg Roedel <joro@...tes.org>,
	Will Deacon <will@...nel.org>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	Jason Gunthorpe <jgg@...pe.ca>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jonathan Corbet <corbet@....net>,
	Sumit Semwal <sumit.semwal@...aro.org>,
	Christian König <christian.koenig@....com>,
	Alex Williamson <alex.williamson@...hat.com>,
	Kees Cook <kees@...nel.org>,
	"Gustavo A. R. Silva" <gustavoars@...nel.org>,
	Ankit Agrawal <ankita@...dia.com>,
	Yishai Hadas <yishaih@...dia.com>,
	Shameer Kolothum <skolothumtho@...dia.com>,
	Kevin Tian <kevin.tian@...el.com>,
	Krishnakant Jaju <kjaju@...dia.com>, Matt Ochs <mochs@...dia.com>,
	linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-block@...r.kernel.org, iommu@...ts.linux.dev,
	linux-mm@...ck.org, linux-doc@...r.kernel.org,
	linux-media@...r.kernel.org, dri-devel@...ts.freedesktop.org,
	linaro-mm-sig@...ts.linaro.org, kvm@...r.kernel.org,
	linux-hardening@...r.kernel.org,
	Vivek Kasireddy <vivek.kasireddy@...el.com>
Subject: Re: [PATCH v6 10/11] vfio/pci: Add dma-buf export support for MMIO
 regions

On Sun, Nov 02, 2025 at 08:01:37AM -0700, Alex Williamson wrote:
> On Sun,  2 Nov 2025 10:00:58 +0200
> Leon Romanovsky <leon@...nel.org> wrote:
> > @@ -2391,6 +2403,7 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
> >  				      struct iommufd_ctx *iommufd_ctx)
> >  {
> >  	struct vfio_pci_core_device *vdev;
> > +	bool restore_revoke = false;
> >  	struct pci_dev *pdev;
> >  	int ret;
> >  
> > @@ -2459,6 +2472,8 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
> >  			break;
> >  		}
> >  
> > +		vfio_pci_dma_buf_move(vdev, true);
> > +		restore_revoke = true;
> >  		vfio_pci_zap_bars(vdev);
> >  	}
> >  
> > @@ -2486,6 +2501,12 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
> >  			       struct vfio_pci_core_device, vdev.dev_set_list);
> >  
> >  err_undo:
> > +	if (restore_revoke) {
> > +		list_for_each_entry(vdev, &dev_set->device_list, vdev.dev_set_list)
> > +			if (__vfio_pci_memory_enabled(vdev))
> > +				vfio_pci_dma_buf_move(vdev, false);
> > +	}
> > +
> >  	list_for_each_entry_from_reverse(vdev, &dev_set->device_list,
> >  					 vdev.dev_set_list)
> 
> We don't need the separate loop or flag, and adding it breaks the
> existing reverse list walk.  Thanks,

Do you want me to send v7? I have a feeling that v6 is good to be merged.

Thanks

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index 24204893e221..51a3bcc26f8b 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -2403,7 +2403,6 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
                                      struct iommufd_ctx *iommufd_ctx)
 {
        struct vfio_pci_core_device *vdev;
-       bool restore_revoke = false;
        struct pci_dev *pdev;
        int ret;
 
@@ -2473,7 +2472,6 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
                }
 
                vfio_pci_dma_buf_move(vdev, true);
-               restore_revoke = true;
                vfio_pci_zap_bars(vdev);
        }
 
@@ -2501,15 +2499,12 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
                               struct vfio_pci_core_device, vdev.dev_set_list);
 
 err_undo:
-       if (restore_revoke) {
-               list_for_each_entry(vdev, &dev_set->device_list, vdev.dev_set_list)
-                       if (__vfio_pci_memory_enabled(vdev))
-                               vfio_pci_dma_buf_move(vdev, false);
-       }
-
        list_for_each_entry_from_reverse(vdev, &dev_set->device_list,
-                                        vdev.dev_set_list)
+                                        vdev.dev_set_list) {
+               if (__vfio_pci_memory_enabled(vdev))
+                       vfio_pci_dma_buf_move(vdev, false);
                up_write(&vdev->memory_lock);
+       }
 
        list_for_each_entry(vdev, &dev_set->device_list, vdev.dev_set_list)
                pm_runtime_put(&vdev->pdev->dev);


> 
> Alex
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ