From: Daniel Vetter <daniel@ffwll.ch>
To: christian.koenig@amd.com
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
dri-devel <dri-devel@lists.freedesktop.org>,
"moderated list:DMA BUFFER SHARING FRAMEWORK"
<linaro-mm-sig@lists.linaro.org>,
amd-gfx list <amd-gfx@lists.freedesktop.org>,
"open list:DMA BUFFER SHARING FRAMEWORK"
<linux-media@vger.kernel.org>
Subject: Re: [Linaro-mm-sig] [PATCH 1/5] dma-buf: add optional invalidate_mappings callback v2
Date: Thu, 22 Mar 2018 08:18:04 +0100 [thread overview]
Message-ID: <20180322071804.GH14155@phenom.ffwll.local> (raw)
In-Reply-To: <327c4bc1-5813-16e8-62fc-4301b19a1a22@gmail.com>
On Wed, Mar 21, 2018 at 12:54:20PM +0100, Christian König wrote:
> Am 21.03.2018 um 09:28 schrieb Daniel Vetter:
> > On Tue, Mar 20, 2018 at 06:47:57PM +0100, Christian König wrote:
> > > Am 20.03.2018 um 15:08 schrieb Daniel Vetter:
> > > > [SNIP]
> > > > For the in-driver reservation path (CS) having a slow-path that grabs a
> > > > temporary reference, drops the vram lock and then locks the reservation
> > > > normally (using the acquire context used already for the entire CS) is a
> > > > bit tricky, but totally feasible. Ttm doesn't do that though.
> > > That is exactly what we do in amdgpu as well, it's just not very efficient
> > > nor reliable to retry getting the right pages for a submission over and over
> > > again.
> > Out of curiosity, where's that code? I did read the ttm eviction code way
> > back, and that one definitely didn't do that. Would be interesting to
> > update my understanding.
>
> That is in amdgpu_cs.c. amdgpu_cs_parser_bos() does a horrible dance with
> grabbing, releasing and regrabbing locks in a loop.
>
> Then in amdgpu_cs_submit() we grab an lock preventing page table updates and
> check if all pages are still the one we want to have:
> > amdgpu_mn_lock(p->mn);
> > if (p->bo_list) {
> > for (i = p->bo_list->first_userptr;
> > i < p->bo_list->num_entries; ++i) {
> > struct amdgpu_bo *bo = p->bo_list->array[i].robj;
> >
> > if
> > (amdgpu_ttm_tt_userptr_needs_pages(bo->tbo.ttm)) {
> > amdgpu_mn_unlock(p->mn);
> > return -ERESTARTSYS;
> > }
> > }
> > }
>
> If anything changed on the page tables we restart the whole IOCTL using
> -ERESTARTSYS and try again.
I'm not talking about userptr here, but general bo eviction. Sorry for the
confusion.
The reason I'm dragging all the general bo management into this
discussions is because we do seem to have fairly fundamental difference in
how that's done, with resulting consequences for the locking hierarchy.
And if this invalidate_mapping stuff should work, together with userptr
and everything else, I think we're required to agree on how this is all
supposed to nest, and how exactly we should back off for the other side
that needs to break the locking circle.
That aside, I don't entirely understand why you need to restart so much. I
figured that get_user_pages is ordered correctly against mmu
invalidations, but I get the impression you think that's not the case. How
does that happen?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-03-22 7:18 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-16 13:20 RFC: unpinned DMA-buf exporting v2 Christian König
2018-03-16 13:20 ` [PATCH 1/5] dma-buf: add optional invalidate_mappings callback v2 Christian König
2018-03-16 13:51 ` Chris Wilson
[not found] ` <152120831102.25315.4326885184264378830-M6iVdVfohj6unts5RBS2dVaTQe2KTcn/@public.gmane.org>
2018-03-16 14:22 ` Christian König
2018-03-19 15:53 ` Chris Wilson
2018-03-19 16:23 ` Christian König
[not found] ` <0bd85f69-c64c-70d1-a4a0-10ae0ed8b4e8-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-03-20 7:44 ` [Linaro-mm-sig] " Daniel Vetter
2018-03-20 10:54 ` Christian König
[not found] ` <19ed21a5-805d-271f-9120-49e0c00f510f-5C7GfCeVMHo@public.gmane.org>
2018-03-20 14:08 ` Daniel Vetter
[not found] ` <20180320140810.GU14155-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-03-20 17:47 ` Christian König
[not found] ` <37ba7394-2a5c-a0bc-cc51-c8a0edc2991d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-03-21 8:18 ` Daniel Vetter
[not found] ` <20180321081800.GW14155-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-03-21 9:34 ` Christian König
[not found] ` <c9070eb2-9b4e-9ac2-ecbc-74dcf5069858-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-03-22 7:14 ` Daniel Vetter
[not found] ` <20180322071425.GG14155-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-03-22 9:37 ` Christian König
2018-03-26 7:51 ` Daniel Vetter
2018-03-21 8:28 ` Daniel Vetter
[not found] ` <20180321082839.GA14155-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-03-21 11:54 ` Christian König
2018-03-22 7:18 ` Daniel Vetter [this message]
[not found] ` <20180322071804.GH14155-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-03-22 9:58 ` Christian König
[not found] ` <ef9fa9a2-c368-1fca-a8ac-8ee8d522b6ab-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-03-26 8:01 ` Daniel Vetter
[not found] ` <20180326080121.GO14155-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-03-26 15:42 ` Jerome Glisse
2018-03-27 7:35 ` Christian König
2018-03-27 7:53 ` Daniel Vetter
2018-03-27 8:06 ` Christian König
[not found] ` <71f3f0cc-263d-bf60-aff8-6f2277884aaf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-03-27 8:27 ` Daniel Vetter
2018-03-19 14:04 ` Daniel Vetter
[not found] ` <20180316132049.1748-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-03-16 13:20 ` [PATCH 2/5] drm/ttm: keep a reference to transfer pipelined BOs Christian König
[not found] ` <20180316132049.1748-3-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-03-27 3:32 ` He, Roger
2018-03-16 13:20 ` [PATCH 3/5] drm/ttm: remove the backing store if no placement is given Christian König
2018-03-16 13:20 ` [PATCH 4/5] drm/amdgpu: add independent DMA-buf export v2 Christian König
2018-03-19 14:09 ` RFC: unpinned DMA-buf exporting v2 Daniel Vetter
2018-03-16 13:20 ` [PATCH 5/5] drm/amdgpu: add independent DMA-buf import v2 Christian König
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=20180322071804.GH14155@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-media@vger.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