From: "Koenig, Christian" <Christian.Koenig-5C7GfCeVMHo@public.gmane.org>
To: Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>
Cc: "intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
"dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [Intel-gfx] [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v12
Date: Wed, 26 Jun 2019 09:28:43 +0000 [thread overview]
Message-ID: <edcfb3ce-e13c-fe38-c34c-9933f777ffce@amd.com> (raw)
In-Reply-To: <20190626081711.GH12905-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
Am 26.06.19 um 10:17 schrieb Daniel Vetter:
> On Wed, Jun 26, 2019 at 09:49:03AM +0200, Christian König wrote:
>> Am 25.06.19 um 18:05 schrieb Daniel Vetter:
>>> On Tue, Jun 25, 2019 at 02:46:49PM +0200, Christian König wrote:
>>>> On the exporter side we add optional explicit pinning callbacks. If those
>>>> callbacks are implemented the framework no longer caches sg tables and the
>>>> map/unmap callbacks are always called with the lock of the reservation object
>>>> held.
>>>>
>>>> On the importer side we add an optional invalidate callback. This callback is
>>>> used by the exporter to inform the importers that their mappings should be
>>>> destroyed as soon as possible.
>>>>
>>>> This allows the exporter to provide the mappings without the need to pin
>>>> the backing store.
>>>>
>>>> v2: don't try to invalidate mappings when the callback is NULL,
>>>> lock the reservation obj while using the attachments,
>>>> add helper to set the callback
>>>> v3: move flag for invalidation support into the DMA-buf,
>>>> use new attach_info structure to set the callback
>>>> v4: use importer_priv field instead of mangling exporter priv.
>>>> v5: drop invalidation_supported flag
>>>> v6: squash together with pin/unpin changes
>>>> v7: pin/unpin takes an attachment now
>>>> v8: nuke dma_buf_attachment_(map|unmap)_locked,
>>>> everything is now handled backward compatible
>>>> v9: always cache when export/importer don't agree on dynamic handling
>>>> v10: minimal style cleanup
>>>> v11: drop automatically re-entry avoidance
>>>> v12: rename callback to move_notify
>>>>
>>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>> One thing I've forgotten, just stumbled over ttm_bo->moving. For pinned
>>> buffer sharing that's not needed, and I think for dynamic buffer sharing
>>> it's also not going to be the primary requirement. But I think there's two
>>> reasons we should maybe look into moving that from ttm_bo to resv_obj:
>> That is already part of the resv_obj. The difference is that radeon is
>> overwriting the one in the resv_obj during CS while amdgpu isn't.
> I'm confused here: Atm ->moving isn't in resv_obj, there's only one
> exclusive fence. And yes you need to set that every time you do a move
> (because a move needs to be pretty exclusive access). But I'm not seeing a
> separate not_quite_exclusive fence slot for moves.
Yeah, but shouldn't that be sufficient? I mean why does somebody else
than the exporter needs to know when a BO is moving?
>> So for amdgpu we keep an extra copy in ttm_bo->moving to keep the page fault
>> handler from unnecessary waiting for a fence in radeon.
> Yeah that's the main one. The other is in CS (at least for i915) we could
> run pipeline texture uploads in parallel with other rendering and stuff
> like that (with multiple engines, which atm is also not there yet). I
> think that could be somewhat useful for vk drivers.
>
> Anyway, totally not understand what you wanted to tell me here in these
> two lines.
Sorry it's 33C in my home office here and I mixed up radeon/amdgpu in
the sentence above.
>>> - You sound like you want to use this a lot more, even internally in
>>> amdgpu. For that I do think the sepearate dma_fence just to make sure
>>> the buffer is accessible will be needed in resv_obj.
>>>
>>> - Once we have ->moving I think there's some good chances to extract a bit
>>> of the eviction/pipeline bo move boilerplate from ttm, and maybe use it
>>> in other drivers. i915 could already make use of this in upstream, since
>>> we already pipeline get_pages and clflush of buffers. Ofc once we have
>>> vram support, even more useful.
>> I actually indeed wanted to add more stuff to the reservation object
>> implementation, like finally cleaning up the distinction of readers/writers.
> Hm, more details? Not ringing a bell ...
I'm not yet sure about the details either, so please just wait until I
solved that all up for me first.
>> And cleaning up the fence removal hack we have in the KFD for freed up BOs.
>> That would also allow for getting rid of this in the long term.
> Hm, what's that for?
When the KFD frees up memory it removes their eviction fence from the
reservation object instead of setting it as signaled and adding a new
one to all other used reservation objects.
Christian.
> -Daniel
>
>> Christian.
>>
>>> And doing that slight semantic change is much easier once we only have a
>>> few dynamic exporters/importers. And since it's a pure opt-in optimization
>>> (you can always fall back to the exclusive fence) it should be easy to
>>> roll out.
>>>
>>> Thoughts about moving ttm_bo->moving to resv_obj? Ofc strictly only as a
>>> follow up. Plus maybe with a clearer name :-)
>>>
>>> Cheers, Daniel
>>>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2019-06-26 9:28 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-25 12:46 [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v12 Christian König
2019-06-25 12:46 ` [PATCH 2/6] drm/ttm: remove the backing store if no placement is given Christian König
2019-06-25 12:46 ` [PATCH 3/6] drm/ttm: use the parent resv for ghost objects v2 Christian König
[not found] ` <20190625124654.122364-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2019-06-25 12:46 ` [PATCH 4/6] drm/amdgpu: use allowed_domains for exported DMA-bufs Christian König
2019-06-25 12:46 ` [PATCH 5/6] drm/amdgpu: add independent DMA-buf export v6 Christian König
2019-06-25 12:46 ` [PATCH 6/6] drm/amdgpu: add independent DMA-buf import v7 Christian König
2019-06-25 16:05 ` [Intel-gfx] [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v12 Daniel Vetter
[not found] ` <20190625160539.GB12905-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-06-26 7:49 ` Christian König
[not found] ` <819ef4bd-e862-6390-d2e3-60f9d6c9cab4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-06-26 8:17 ` Daniel Vetter
[not found] ` <20190626081711.GH12905-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-06-26 9:28 ` Koenig, Christian [this message]
2019-06-26 10:57 ` Daniel Vetter
[not found] ` <CAKMK7uH9SmCw-pcRvMrf1OL=jYDOJ5WSR8U8hOK+Amm6bjhnkg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-06-26 11:53 ` Christian König
[not found] ` <24916a7e-e0b5-d2ed-5a7a-0d816690a063-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-06-26 12:15 ` Daniel Vetter
2019-06-25 13:07 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] " Patchwork
2019-06-25 13:08 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-06-25 13:41 ` ✓ Fi.CI.BAT: success " Patchwork
2019-06-25 14:35 ` [PATCH 1/6] " Daniel Vetter
[not found] ` <20190625143548.GX12905-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2019-06-25 14:45 ` [Intel-gfx] " Christian König
2019-06-25 15:07 ` Daniel Vetter
2019-06-25 15:13 ` Christian König
[not found] ` <6fdde041-89f8-ff12-d237-3e280f0af21c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-06-25 15:26 ` [Intel-gfx] " Daniel Vetter
2019-06-25 14:51 ` ✓ Fi.CI.IGT: success for series starting with [1/6] " Patchwork
2019-06-26 12:34 ` ✗ Fi.CI.BAT: failure for series starting with [1/6] dma-buf: add dynamic DMA-buf handling v12 (rev2) Patchwork
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=edcfb3ce-e13c-fe38-c34c-9933f777ffce@amd.com \
--to=christian.koenig-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=daniel-/w4YWyX8dFk@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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