From: Jason Gunthorpe <jgg@ziepe.ca>
To: Zhiping Zhang <zhipingz@meta.com>
Cc: fengchengwen <fengchengwen@huawei.com>,
Leon Romanovsky <leon@kernel.org>,
Michael Guralnik <michaelgur@nvidia.com>,
Sumit Semwal <sumit.semwal@linaro.org>,
Christian Konig <christian.koenig@amd.com>,
Alex Williamson <alex@shazbot.org>,
Bjorn Helgaas <bhelgaas@google.com>,
kvm@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v13 5/5] RDMA/mlx5: get tph for p2p access when registering dma-buf mr
Date: Mon, 28 Sep 2026 14:29:39 -0300 [thread overview]
Message-ID: <20260928172939.GK163130@ziepe.ca> (raw)
In-Reply-To: <CAH3zFs2rhg6-b-pVDps1V8LsM4Dn48t4J4LFVyKOZtT4axdY=Q@mail.gmail.com>
On Thu, Sep 24, 2026 at 11:17:57PM -0700, Zhiping Zhang wrote:
> On Thu, Sep 24, 2026 at 4:31 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> >
> > >
> > On Wed, Sep 23, 2026 at 11:24:56PM -0700, Zhiping Zhang wrote:
> > > I don't think this belongs in the importer. Every in-tree dma-buf
> > > caller of pci_p2pdma_distance() is the exporter, in its .attach,
> > > clearing attach->peer2peer -- amdgpu_dma_buf.c, xe_dma_buf.c,
> > > habanalabs memory.c. There is no importer-side caller.
> >
> > Right, and they shouldn't be doing that, but it still has to be
> > checked that the st is going directly to the peer device not the host
> > bridge. Not using the distance, but by the PCI_P2PDMA_MAP_BUS_ADDR
> > indication.
> >
> > I fear you will need some of Leon's series to make that happen.
> >
> > So probably the proposed change to dmabuf ops is far too simple.
> >
> > Jason
>
> Hi Jason,
>
> Thanks for the comments.
>
> Agreed -- the tag should not be handed out unless the routing is
> PCI_P2PDMA_MAP_BUS_ADDR. That can be enforced conservatively on 7.3
> with two changes. I can fold both into patch 4.
> ```
> In drivers/pci/p2pdma.c, make pci_p2pdma_map_type() callable from
> tristate VFIO_PCI_CORE:
>
> EXPORT_SYMBOL_GPL(pci_p2pdma_map_type);
No, that's been rejected several times already.
> and in drivers/vfio/pci/vfio_pci_dmabuf.c,
> vfio_pci_dma_buf_get_pci_tph() gains:
>
> struct dma_buf_attachment *attach;
>
> if (list_empty(&dmabuf->attachments))
> return -EOPNOTSUPP;
>
> list_for_each_entry(attach, &dmabuf->attachments, node)
> if (pci_p2pdma_map_type(priv->provider, attach->dev) !=
> PCI_P2PDMA_MAP_BUS_ADDR)
> return -EOPNOTSUPP;
> ```
Also no, this has to be done via PCI_P2PDMA_MAP_BUS_ADDR which also
enforces putting the determination in the right place in the code
flow..
> Two properties are worth stating explicitly:
Ah! AI!
Jason
next prev parent reply other threads:[~2026-09-28 17:29 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 21:15 [PATCH v13 0/5] vfio/dma-buf: add TPH support for peer-to-peer access Zhiping Zhang
2026-07-31 21:15 ` [PATCH v13 1/5] PCI/TPH: treat reserved 0b10 completer encoding as unsupported Zhiping Zhang
2026-07-31 21:38 ` sashiko-bot
2026-09-15 22:19 ` Bjorn Helgaas
2026-09-15 23:14 ` Zhiping Zhang
2026-07-31 21:15 ` [PATCH v13 2/5] PCI/TPH: Add requester/completer type helpers Zhiping Zhang
2026-07-31 21:40 ` sashiko-bot
2026-08-03 1:21 ` fengchengwen
2026-09-15 22:23 ` Bjorn Helgaas
2026-09-15 23:27 ` Zhiping Zhang
2026-07-31 21:15 ` [PATCH v13 3/5] dma-buf: add optional get_pci_tph() callback Zhiping Zhang
2026-07-31 21:37 ` sashiko-bot
2026-07-31 21:15 ` [PATCH v13 4/5] vfio/pci: implement get_pci_tph and DMA_BUF_TPH feature Zhiping Zhang
2026-07-31 21:38 ` sashiko-bot
2026-07-31 21:15 ` [PATCH v13 5/5] RDMA/mlx5: get tph for p2p access when registering dma-buf mr Zhiping Zhang
2026-07-31 21:48 ` sashiko-bot
2026-07-31 22:59 ` Zhiping Zhang
2026-09-23 19:11 ` Zhiping Zhang
2026-09-24 1:13 ` fengchengwen
2026-09-24 6:24 ` Zhiping Zhang
2026-09-24 23:30 ` Jason Gunthorpe
2026-09-25 6:17 ` Zhiping Zhang
2026-09-28 17:29 ` Jason Gunthorpe [this message]
2026-09-28 21:47 ` Zhiping Zhang
2026-09-30 12:13 ` Leon Romanovsky
2026-10-05 21:33 ` Zhiping Zhang
2026-08-14 18:08 ` [PATCH v13 0/5] vfio/dma-buf: add TPH support for peer-to-peer access Zhiping Zhang
2026-09-02 20:53 ` Zhiping Zhang
2026-09-10 21:46 ` [PATCH v13 0/5] vfio/dma-buf: add TPH support for peer-to-peer access - ping Zhiping Zhang
2026-09-11 7:58 ` Christian König
2026-09-14 16:44 ` Zhiping Zhang
2026-09-15 20:49 ` Alex Williamson
2026-09-16 0:17 ` Zhiping Zhang
2026-09-15 11:37 ` Leon Romanovsky
2026-09-15 12:59 ` Christian König
2026-09-15 13:37 ` Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260928172939.GK163130@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=alex@shazbot.org \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=fengchengwen@huawei.com \
--cc=kvm@vger.kernel.org \
--cc=leon@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=michaelgur@nvidia.com \
--cc=sumit.semwal@linaro.org \
--cc=zhipingz@meta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox