From: Jason Gunthorpe <jgg@mellanox.com>
To: Christoph Hellwig <hch@lst.de>
Cc: "Jérôme Glisse" <jglisse@redhat.com>,
"Ben Skeggs" <bskeggs@redhat.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Ralph Campbell" <rcampbell@nvidia.com>
Subject: Re: [PATCH 1/5] mm: return valid info from hmm_range_unregister
Date: Wed, 3 Jul 2019 20:40:08 +0000 [thread overview]
Message-ID: <20190703204002.GO18688@mellanox.com> (raw)
In-Reply-To: <20190703202857.GA15690@lst.de>
On Wed, Jul 03, 2019 at 10:28:57PM +0200, Christoph Hellwig wrote:
> On Wed, Jul 03, 2019 at 07:00:50PM +0000, Jason Gunthorpe wrote:
> > I don't think the API should be encouraging some shortcut here..
> >
> > We can't do the above pattern because the old hmm_vma API didn't allow
> > it, which is presumably a reason why it is obsolete.
> >
> > I'd rather see drivers move to a consistent pattern so we can then
> > easily hoist the seqcount lock scheme into some common mmu notifier
> > code, as discussed.
>
> So you don't like the version in amdgpu_ttm_tt_get_user_pages_done in
> linux-next either?
I looked at this for 5 mins, and I can't see the key elements of the
collision retry lock:
- Where is the retry loop?
- Where is the lock around the final test to valid prior to using
the output of range?
For instance looking at amdgpu_gem_userptr_ioctl()..
We can't be holding a lock when we do hmm_range_wait_until_valid()
(inside amdgpu_ttm_tt_get_user_pages), otherwise it deadlocks, and
there are not other locks that would encompass the final is_valid check.
And amdgpu_gem_userptr_ioctl() looks like a syscall entry point, so
having it fail just because the lock collided (ie is_valid == false)
can't possibly be the right thing.
I'm also unclear when the device data is updated in that sequence..
So.. I think this locking is wrong. Maybe AMD team can explain how it
should work?
Jason
next prev parent reply other threads:[~2019-07-03 20:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-03 18:44 hmm_range_fault related fixes and legacy API removal Christoph Hellwig
2019-07-03 18:44 ` Christoph Hellwig
[not found] ` <20190703184502.16234-1-hch-jcswGhMUV9g@public.gmane.org>
2019-07-03 18:44 ` [PATCH 1/5] mm: return valid info from hmm_range_unregister Christoph Hellwig
2019-07-03 18:44 ` Christoph Hellwig
[not found] ` <20190703184502.16234-2-hch-jcswGhMUV9g@public.gmane.org>
2019-07-03 19:00 ` Jason Gunthorpe
2019-07-03 19:00 ` Jason Gunthorpe
[not found] ` <20190703190045.GN18688-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2019-07-03 20:28 ` Christoph Hellwig
2019-07-03 20:28 ` Christoph Hellwig
2019-07-03 20:40 ` Jason Gunthorpe [this message]
2019-07-03 18:44 ` [PATCH 2/5] mm: always return EBUSY for invalid ranges in hmm_range_{fault, snapshot} Christoph Hellwig
2019-07-03 18:44 ` [PATCH 2/5] mm: always return EBUSY for invalid ranges in hmm_range_{fault,snapshot} Christoph Hellwig
2019-07-03 18:45 ` [PATCH 5/5] mm: remove the legacy hmm_pfn_* APIs Christoph Hellwig
2019-07-03 18:45 ` Christoph Hellwig
2019-07-03 20:26 ` Ralph Campbell
2019-07-03 20:26 ` Ralph Campbell
2019-07-03 18:45 ` [PATCH 3/5] mm: move hmm_vma_fault to nouveau Christoph Hellwig
2019-07-03 18:45 ` [PATCH 4/5] nouveau: unlock mmap_sem on all errors from nouveau_range_fault Christoph Hellwig
2019-07-03 20:46 ` Ralph Campbell
2019-07-03 20:46 ` Ralph Campbell
2019-07-03 21:51 ` Christoph Hellwig
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=20190703204002.GO18688@mellanox.com \
--to=jgg@mellanox.com \
--cc=bskeggs@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@lst.de \
--cc=jglisse@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nouveau@lists.freedesktop.org \
--cc=rcampbell@nvidia.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.