All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Evans <matt@ozlabs.org>
To: Jason Gunthorpe <jgg@nvidia.com>, Alex Mastro <amastro@fb.com>
Cc: "Leon Romanovsky" <leon@kernel.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Alex Williamson" <alex@shazbot.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Logan Gunthorpe" <logang@deltatee.com>,
	"Kevin Tian" <kevin.tian@intel.com>,
	"Pranjal Shrivastava" <praan@google.com>,
	"Longfang Liu" <liulongfang@huawei.com>,
	"Mahmoud Adam" <mngyadam@amazon.de>,
	"David Matlack" <dmatlack@google.com>,
	"Björn Töpel" <bjorn@kernel.org>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Ankit Agrawal" <ankita@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Vivek Kasireddy" <vivek.kasireddy@intel.com>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	kvm@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v6 9/9] vfio/pci: Permanently revoke a DMABUF on request
Date: Wed, 23 Sep 2026 16:40:03 +0100	[thread overview]
Message-ID: <e33f1d3a-1900-4bf3-9785-3af5447e7e54@ozlabs.org> (raw)
In-Reply-To: <20260922225747.GB2545495@nvidia.com>

Hi Jason, Alex,

On 22/09/2026 23:57, Jason Gunthorpe wrote:
> On Tue, Sep 22, 2026 at 03:31:07PM -0700, Alex Mastro wrote:
> 
>> So I empathize with Matt's contention that the _existing_ behavior that the
>> priv->revoked flag represents is actually "temporarily revoked": the importer
>> can use the same dma-buf again, later, without having to re-import
>> it!
> 
> mlx5 isn't a revoking importer, it is move capable. So the above
> sequence isn't a revoke, it is a move with an unmapped placement for a
> while.
> 
> This is why "temporarily revoked" is a confusing phrase.
> 
> The API is such that move and revoke importers can co-exist like this
> but they experiance a different version of things..

Ahhhhh.  That was very helpful (esp. to contrast with the previous
iommufd statement about invalidate_mappings being permanent), thank you!

So the worry was that the VFIO DMABUF's temp/perm state could be
misconstrued as an implication/guarantee about the future availability
of that DMABUF to importers, OK.  And we want the existing move(false)
behaviour still, for dynamic importers that treat it as a move.

> We probably should not have made it have this move compatible
> restoration and had things more consistent. User space can't know if
> the importer is move capable or not so it has to assume revoke and it
> has to go and unmap things before resetting/etc.
> >> This series doesn't intend to change the behavior of either. Is the
confusion
>> about whether the current behavior is intentional and/or desirable? If the
>> answer to both is "no", then IMO this series paves the way nicely towards making
>> PERM_REVOKED the only supported semantic later.
> 
> Right, I think the only concern is language.
In that case, the VFIO-internal tracking could be:

 priv->status = VFIO_PCI_DMABUF_OK;      /* was priv->revoked = false */
 priv->status = VFIO_PCI_DMABUF_REVOKED; /* was priv->revoked = true */
 priv->status = VFIO_PCI_DMABUF_DEAD;

The latter means that an invalidate_mappings was performed (due to a new
userspace ioctl trigger), and that all future dma_buf_*attach() attempts
must fail.  I'd add a comment to explain this clearly in the enum.

If that's too macabre, DEFUNCT?  (A word implying guaranteed
permanence...).  The userspace action causing all this can IMHO be
called REVOKE still; it's what it does.  (I'll clarify the observable
effect from the POV of an importer in the UAPI.)

WDYT?


Matt


  reply	other threads:[~2026-09-23 15:40 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11 21:41 [PATCH v6 0/9] vfio/pci: Add mmap() for DMABUFs Matt Evans
2026-09-11 21:41 ` [PATCH v6 1/9] vfio/pci: Remove DMABUF export dependency on vdev->memory_lock Matt Evans
2026-09-11 21:41 ` [PATCH v6 2/9] vfio/pci: Un-revoke DMABUFs in LOW_POWER_ENTRY_WITH_WAKEUP resume Matt Evans
2026-09-11 21:41 ` [PATCH v6 3/9] dma-buf: Export dma_buf_set_name() Matt Evans
2026-09-14 11:06   ` Christian König
2026-09-15 13:35     ` Matt Evans
2026-09-11 21:41 ` [PATCH v6 4/9] vfio/pci: Add a helper to look up PFNs for DMABUFs Matt Evans
2026-09-11 21:41 ` [PATCH v6 5/9] vfio/pci: Add a helper to create a DMABUF for a BAR-map VMA Matt Evans
2026-09-15 12:16   ` liulongfang
2026-09-21 13:24     ` Matt Evans
2026-09-22  9:16       ` liulongfang
2026-09-24 12:43         ` Matt Evans
2026-09-11 21:41 ` [PATCH v6 6/9] vfio/pci: Convert BAR mmap() to use a DMABUF Matt Evans
2026-09-11 21:41 ` [PATCH v6 7/9] vfio/pci: Clean up BAR zap and revocation Matt Evans
2026-09-11 21:41 ` [PATCH v6 8/9] vfio/pci: Support mmap() of a VFIO DMABUF Matt Evans
2026-09-11 21:41 ` [PATCH v6 9/9] vfio/pci: Permanently revoke a DMABUF on request Matt Evans
2026-09-13 16:52   ` Leon Romanovsky
2026-09-14 11:36     ` Jason Gunthorpe
2026-09-14 11:54       ` Leon Romanovsky
2026-09-14 11:58         ` Jason Gunthorpe
2026-09-14 12:06           ` Leon Romanovsky
2026-09-14 12:08             ` Jason Gunthorpe
2026-09-14 12:13         ` Matt Evans
2026-09-15  7:20           ` Leon Romanovsky
2026-09-15 11:13             ` Christian König
2026-09-15 14:22               ` Matt Evans
2026-09-16 14:19                 ` Christian König
2026-09-21 13:08                   ` Matt Evans
2026-09-21 13:22                     ` Jason Gunthorpe
2026-09-21 13:45                       ` Christian König
2026-09-21 13:49                         ` Jason Gunthorpe
2026-09-21 14:09                           ` Christian König
2026-09-22 12:41                             ` Jason Gunthorpe
2026-09-22 12:46                               ` Leon Romanovsky
2026-09-22 12:54                                 ` Jason Gunthorpe
2026-09-22 22:31                                   ` Alex Mastro
2026-09-22 22:57                                     ` Jason Gunthorpe
2026-09-23 15:40                                       ` Matt Evans [this message]
2026-09-23 16:13                                         ` Jason Gunthorpe
2026-09-23 16:52                                         ` Leon Romanovsky
2026-09-23 17:06                                           ` Matt Evans
2026-09-24 17:36                                       ` Alex Mastro
2026-09-22 11:40                     ` Leon Romanovsky
2026-09-15 12:35           ` Jason Gunthorpe
2026-09-15 14:30             ` Matt Evans

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=e33f1d3a-1900-4bf3-9785-3af5447e7e54@ozlabs.org \
    --to=matt@ozlabs.org \
    --cc=alex@shazbot.org \
    --cc=amastro@fb.com \
    --cc=ankita@nvidia.com \
    --cc=apopple@nvidia.com \
    --cc=bhelgaas@google.com \
    --cc=bjorn@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=dmatlack@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=leon@kernel.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liulongfang@huawei.com \
    --cc=logang@deltatee.com \
    --cc=mngyadam@amazon.de \
    --cc=praan@google.com \
    --cc=sumit.semwal@linaro.org \
    --cc=vivek.kasireddy@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.