Re: [PATCH v5 8/9] vfio/pci: Enable peer-to-peer DMA transactions by default

Leon Romanovsky
2025-10-16T06:10:29Z

On Wed, Oct 15, 2025 at 09:09:53PM -0700, Nicolin Chen wrote:
> Hi Leon,
>
> On Mon, Oct 13, 2025 at 06:26:10PM +0300, Leon Romanovsky wrote:
> > @@ -2090,6 +2092,9 @@ int vfio_pci_core_init_dev(struct vfio_device *core_vdev)
> > INIT_LIST_HEAD(&vdev->dummy_resources_list);
> > INIT_LIST_HEAD(&vdev->ioeventfds_list);
> > INIT_LIST_HEAD(&vdev->sriov_pfs_item);
> > + ret = pcim_p2pdma_init(vdev->pdev);
> > + if (ret != -EOPNOTSUPP)
> > + return ret;
> > init_rwsem(&vdev->memory_lock);
> > xa_init(&vdev->ctx);
>
> I think this should be:
> if (ret && ret != -EOPNOTSUPP)
> return ret;
>
> Otherwise, init_rwsem() and xa_init() would be missed if ret==0.

You absolutely right.

Thanks

>
> Thanks
> Nicolin
>