[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240502183408.GC3341011@nvidia.com>
Date: Thu, 2 May 2024 15:34:08 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: John Hubbard <jhubbard@...dia.com>
Cc: David Hildenbrand <david@...hat.com>,
Alistair Popple <apopple@...dia.com>,
Christoph Hellwig <hch@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>, linux-rdma@...r.kernel.org,
linux-mm@...ck.org, Mike Marciniszyn <mike.marciniszyn@...el.com>,
Leon Romanovsky <leon@...nel.org>,
Artemy Kovalyov <artemyko@...dia.com>,
Michael Guralnik <michaelgur@...dia.com>,
Pak Markthub <pmarkthub@...dia.com>
Subject: Re: [RFC] RDMA/umem: pin_user_pages*() can temporarily fail due to
migration glitches
On Thu, May 02, 2024 at 11:10:05AM -0700, John Hubbard wrote:
> On 5/1/24 11:56 PM, David Hildenbrand wrote:
> > On 02.05.24 03:05, Alistair Popple wrote:
> > > Jason Gunthorpe <jgg@...dia.com> writes:
> ...
> > > > > This doesn't make sense. IFF a blind retry is all that is needed it
> > > > > should be done in the core functionality. I fear it's not that easy,
> > > > > though.
> > > >
> > > > +1
> > > >
> > > > This migration retry weirdness is a GUP issue, it needs to be solved
> > > > in the mm not exposed to every pin_user_pages caller.
> > > >
> > > > If it turns out ZONE_MOVEABLE pages can't actually be reliably moved
> > > > then it is pretty broken..
> > >
> > > I wonder if we should remove the arbitrary retry limit in
> > > migrate_pages() entirely for ZONE_MOVEABLE pages and just loop until
> > > they migrate? By definition there should only be transient references on
> > > these pages so why do we need to limit the number of retries in the
> > > first place?
> >
> > There are some weird things that still needs fixing: vmsplice() is the
> > example that doesn't use FOLL_LONGTERM.
> >
>
> Hi David!
>
> Do you have any other call sites in mind? It sounds like one way forward
> is to fix each call site...
>
> This is an unhappy story right now: the pin_user_pages*() APIs are
> significantly worse than before the "migrate pages away automatically"
> upgrade, from a user point of view. Because now, the APIs fail
> intermittently for callers who follow the rules--because
> pin_user_pages() is not fully working yet, basically.
>
> Other ideas, large or small, about how to approach a fix?
IMHO pin_user_pages() should sleep and spin in an interruptable sleep
until we get all the migrations done. Not sure how hard it would be to
add some kind of proper waiting event sleep?
If userspace has got itself into knots then pin_user_pages() will
block in the kernel and ctrl-c will rescue it.
Even the temporary pins for something like O_DIRECT are long enough
that we wouldn't want to just spin the CPU.
Jason
Powered by blists - more mailing lists