From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v8
Date: Wed, 22 May 2019 10:49:50 +0200 [thread overview]
Message-ID: <c7324bd8-e003-207e-af80-96bcbdf8870a@gmail.com> (raw)
In-Reply-To: <20190522081949.GU21222@phenom.ffwll.local>
Am 22.05.19 um 10:19 schrieb Daniel Vetter:
> On Wed, May 15, 2019 at 04:38:26PM +0200, Christian König wrote:
> [SNAP]
> Just this functional comment, since I think api detail polishing is
> premature if we're not yet aware of how this works.
>
>> + /* When the importer is dynamic but the exporter isn't we need to cache
>> + * the mapping or otherwise would run into issues with the reservation
>> + * object lock.
>> + */
>> + if (dma_buf_attachment_is_dynamic(attach) &&
>> + !dma_buf_is_dynamic(dmabuf)) {
> Isn't this the wrong way round? dynamic importers should be perfectly fine
> with the reservation locks in their map/unmap paths, it's importers
> calling exporters there.
>
> The real problem is a not-dynamic importer, which hasn't be adjusted to
> allow the reservation lock in their paths where they map/unmap a buffer,
> with a dynamic exporter. That's where we need to cache the mapping to
> avoid the deadlock (or having to change everyone)
Well could be that this is also a problem, but I actually don't think so.
The case I'm describing here certainly is the more obvious problem
because the importer is already holding the lock the exporter wants to take.
On the other hand we could rather easily change that check to
dma_buf_attachment_is_dynamic() != dma_buf_is_dynamic() if that is
indeed a problem.
>> + struct sg_table *sgt;
>> +
>> + sgt = dmabuf->ops->map_dma_buf(attach, DMA_BIDIRECTIONAL);
> And unfortunately the non-dynamic, i.e. legacy/current code importer is
> also the one which uses other flags than DMA_BIDIRECTIONAL. At least on
> ARM, and that's the only place where this matters because there the dma
> api might do cache flushing.
Well the only implementer for now is amdgpu, and amdgpu always requires
a coherent bidirectional mapping.
So this won't be a problem unless the ARM drivers start to implement
dynamic DMA-buf handling themselves or start to talk to amdgpu (which
wouldn't have worked before anyway).
Christian.
> Cheers, Daniel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-05-22 8:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 14:38 [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v8 Christian König
2019-05-15 14:38 ` [PATCH 2/6] drm/ttm: remove the backing store if no placement is given Christian König
2019-05-15 14:38 ` [PATCH 3/6] drm/ttm: use the parent resv for ghost objects Christian König
2019-05-15 14:38 ` [PATCH 4/6] drm/amdgpu: use allowed_domains for exported DMA-bufs Christian König
2019-05-15 14:38 ` [PATCH 5/6] drm/amdgpu: add independent DMA-buf export v3 Christian König
2019-05-15 14:38 ` [PATCH 6/6] drm/amdgpu: add independent DMA-buf import v6 Christian König
2019-05-22 8:19 ` [PATCH 1/6] dma-buf: add dynamic DMA-buf handling v8 Daniel Vetter
2019-05-22 8:49 ` Christian König [this message]
2019-05-22 11:27 ` Daniel Vetter
2019-05-22 11:29 ` Daniel Vetter
2019-05-23 11:16 ` Koenig, Christian
2019-05-22 11:28 ` Daniel Vetter
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=c7324bd8-e003-207e-af80-96bcbdf8870a@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.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