[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKUa8HZjfFW2Dhb1@t490s>
Date: Wed, 19 May 2021 10:04:32 -0400
From: Peter Xu <peterx@...hat.com>
To: Alistair Popple <apopple@...dia.com>
Cc: Jason Gunthorpe <jgg@...dia.com>, linux-mm@...ck.org,
nouveau@...ts.freedesktop.org, bskeggs@...hat.com,
akpm@...ux-foundation.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
jhubbard@...dia.com, rcampbell@...dia.com, jglisse@...hat.com,
hch@...radead.org, daniel@...ll.ch, willy@...radead.org,
bsingharora@...il.com, Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v8 5/8] mm: Device exclusive memory access
On Wed, May 19, 2021 at 11:11:55PM +1000, Alistair Popple wrote:
> On Wednesday, 19 May 2021 10:15:41 PM AEST Peter Xu wrote:
> > External email: Use caution opening links or attachments
> >
> > On Wed, May 19, 2021 at 09:04:53PM +1000, Alistair Popple wrote:
> > > Failing fork() because we couldn't take a lock doesn't seem like the right
> > > approach though, especially as there is already existing code that
> > > retries. I get this adds complexity though, so would be happy to take a
> > > look at cleaning copy_pte_range() up in future.
> >
> > Yes, I proposed that as this one won't affect any existing applications
> > (unlike the existing ones) but only new userspace driver apps that will use
> > this new atomic feature.
> >
> > IMHO it'll be a pity to add extra complexity and maintainance burden into
> > fork() if only for keeping the "logical correctness of fork()" however the
> > code never triggers. If we start with trylock we'll know whether people
> > will use it, since people will complain with a reason when needed; however
> > I still doubt whether a sane userspace device driver should fork() within
> > busy interaction with the device underneath..
>
> I will refrain from commenting on the sanity or otherwise of doing that :-)
>
> Agree such a scenario seems unlikely in practice (and possibly unreasonable).
> Keeping the "logical correctness of fork()" still seems worthwhile to me, but
> if the added complexity/maintenance burden for an admittedly fairly specific
> feature is going to stop progress here I am happy to take the fail fork
> approach. I could then possibly fix it up as a future clean up to
> copy_pte_range(). Perhaps others have thoughts?
Yes, it's more about making this series easier to be accepted, and it'll be
great to have others' input.
Btw, just to mention that I don't even think fail fork() on failed trylock() is
against "logical correctness of fork()": IMHO it's still 100% correct just like
most syscalls can return with -EAGAIN, that suggests the userspace to try again
the syscall, and I hope that also works for fork(). I'd be more than glad to
be corrected too.
--
Peter Xu
Powered by blists - more mailing lists