From: Jason Gunthorpe <jgg@ziepe.ca>
To: Christoph Hellwig <hch@infradead.org>
Cc: Martin Oliveira <martin.oliveira@eideticom.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Artemy Kovalyov <artemyko@nvidia.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Leon Romanovsky <leon@kernel.org>,
Logan Gunthorpe <logang@deltatee.com>,
Michael Guralnik <michaelgur@nvidia.com>,
Mike Marciniszyn <mike.marciniszyn@intel.com>,
Shiraz Saleem <shiraz.saleem@intel.com>,
Tejun Heo <tj@kernel.org>, John Hubbard <jhubbard@nvidia.com>,
Dan Williams <dan.j.williams@intel.com>,
David Sloan <david.sloan@eideticom.com>
Subject: Re: [PATCH v5 3/4] mm/gup: allow FOLL_LONGTERM & FOLL_PCI_P2PDMA
Date: Thu, 15 Aug 2024 13:38:11 -0300 [thread overview]
Message-ID: <20240815163811.GN3468552@ziepe.ca> (raw)
In-Reply-To: <ZrwyD10ejPxowETN@infradead.org>
On Tue, Aug 13, 2024 at 09:26:55PM -0700, Christoph Hellwig wrote:
> On Tue, Aug 13, 2024 at 01:05:02PM -0300, Jason Gunthorpe wrote:
> > > Where do we block driver unbind with an open resource?
> >
> > I keep seeing it in different subsystems, safe driver unbind is really
> > hard. :\ eg I think VFIO has some waits in it
>
> Well, waits for what?
Looks like it waits for the fds to close at least. It has weird
handshake where it notifies userspace that the device is closing and
the userspace needs to close the fd. See vfio_unregister_group_dev()
In the past VFIO couldn't do anything else because it had VMAs open
that point to the device's mmio and it would be wrong to unbind the
driver and leave those uncleaned. VFIO now knows how to zap VMA so
maybe this could be improved, but it looks like a sizable uplift.
> Usuaully an unbind has to wait for something, but waiting for
> unbound references is always a bug. And I can't think of any
> sensible subsystem doing this.
I've seen several cases over the years.. It can be hard in many cases
to deal with the issue. Like the VMA's above for instance. rdma also
had to learn how to do zap before it could do fast unbind.
Some places just have bugs where they don't wait and Weird Stuff
happens. There is a strange misconception that module refcounts
protect against unbind :\
Not saying this is good design, or desirable, just pointing out we
seem to tolerate this in enough other places.
In this case the only resolution I could think of would be to have the
rdma stack somehow register a notifier on the pgmap. Then we could
revoke the RDMA access synchronously during destruction and return
those refcounts.
That does seems a bit complicated though..
Jason
next prev parent reply other threads:[~2024-08-15 16:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-08 18:33 [PATCH v5 0/4] Enable P2PDMA in Userspace RDMA Martin Oliveira
2024-08-08 18:33 ` [PATCH v5 1/4] kernfs: add a WARN_ON_ONCE if ->close is set Martin Oliveira
2024-08-09 5:37 ` Greg Kroah-Hartman
2024-08-09 15:41 ` Martin Oliveira
2024-08-11 8:31 ` Greg Kroah-Hartman
2024-08-12 6:38 ` Christoph Hellwig
2024-08-12 6:38 ` Christoph Hellwig
2024-08-08 18:33 ` [PATCH v5 2/4] kernfs: remove page_mkwrite() from vm_operations_struct Martin Oliveira
2024-08-12 6:38 ` Christoph Hellwig
2024-08-08 18:33 ` [PATCH v5 3/4] mm/gup: allow FOLL_LONGTERM & FOLL_PCI_P2PDMA Martin Oliveira
2024-08-12 6:39 ` Christoph Hellwig
2024-08-12 23:12 ` Jason Gunthorpe
2024-08-13 5:41 ` Christoph Hellwig
2024-08-13 16:05 ` Jason Gunthorpe
2024-08-13 17:03 ` Dan Williams
2024-08-14 0:02 ` Jason Gunthorpe
2024-08-14 4:26 ` Christoph Hellwig
2024-08-15 16:38 ` Jason Gunthorpe [this message]
2024-08-08 18:33 ` [PATCH v5 4/4] RDMA/umem: add support for P2P RDMA Martin Oliveira
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=20240815163811.GN3468552@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=akpm@linux-foundation.org \
--cc=artemyko@nvidia.com \
--cc=dan.j.williams@intel.com \
--cc=david.sloan@eideticom.com \
--cc=gregkh@linuxfoundation.org \
--cc=hch@infradead.org \
--cc=jhubbard@nvidia.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=martin.oliveira@eideticom.com \
--cc=michaelgur@nvidia.com \
--cc=mike.marciniszyn@intel.com \
--cc=shiraz.saleem@intel.com \
--cc=tj@kernel.org \
/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