From: "Koenig, Christian" <Christian.Koenig@amd.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: "dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"sumit.semwal@linaro.org" <sumit.semwal@linaro.org>,
"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 1/4] dma-buf: change DMA-buf locking convention
Date: Tue, 24 Sep 2019 09:51:01 +0000 [thread overview]
Message-ID: <97bb8f03-7fa3-6e61-a1ff-0ffcadbc1a39@amd.com> (raw)
In-Reply-To: <CAKMK7uFc6CKyF-dW6FE7Hzdz5La7N265DZu_PR7=rKXFjg4QBw@mail.gmail.com>
Am 17.09.19 um 16:56 schrieb Daniel Vetter:
> [SNIP]
>>>>>>>>>>> + /* When either the importer or the exporter can't handle dynamic
>>>>>>>>>>> + * mappings we cache the mapping here to avoid issues with the
>>>>>>>>>>> + * reservation object lock.
>>>>>>>>>>> + */
>>>>>>>>>>> + if (dma_buf_attachment_is_dynamic(attach) !=
>>>>>>>>>>> + dma_buf_is_dynamic(dmabuf)) {
>>>>>>>>>>> + struct sg_table *sgt;
>>>>>>>>>>> +
>>>>>>>>>>> + if (dma_buf_is_dynamic(attach->dmabuf))
>>>>>>>>>>> + dma_resv_lock(attach->dmabuf->resv, NULL);
>>>>>>>>>>> +
>>>>>>>>>>> + sgt = dmabuf->ops->map_dma_buf(attach, DMA_BIDIRECTIONAL);
>>>>>>>>>> Now we're back to enforcing DMA_BIDI, which works nicely around the
>>>>>>>>>> locking pain, but apparently upsets the arm-soc folks who want to
>>>>>>>>>> control
>>>>>>>>>> this better.
>>>>>>>>> Take another look at dma_buf_map_attachment(), we still try to get the
>>>>>>>>> caching there for ARM.
>>>>>>>>>
>>>>>>>>> What we do here is to bidirectionally map the buffer to avoid the
>>>>>>>>> locking hydra when importer and exporter disagree on locking.
>>>>>>>>>
>>>>>>>>> So the ARM folks can easily avoid that by switching to dynamic locking
>>>>>>>>> for both.
>>>>>>> So you still break the contract between importer and exporter, except not
>>>>>>> for anything that's run in intel-gfx-ci so all is good?
>>>>>> No, the contract between importer and exporter stays exactly the same it
>>>>>> is currently as long as you don't switch to dynamic dma-buf handling.
>>>>>>
>>>>>> There is no functional change for the ARM folks here. The only change
>>>>>> which takes effect is between i915 and amdgpu and that is perfectly
>>>>>> covered by intel-gfx-ci.
>>>>> There's people who want to run amdgpu on ARM?
>>>> Sure there are, we even recently fixed some bugs for this.
>>>>
>>>> But as far as I know there is no one currently which is affect by this
>>>> change on ARM with amdgpu.
>>> But don't you break them with this now?
>> No, we see the bidirectional attachment as compatible with the other ones.
>>
>>> amdgpu will soon set the dynamic flag on exports, which forces the caching
>>> at create time (to avoid the locking fun), which will then result in a
>>> EBUSY at map_attachment time because we have a cached mapping, but it's
>>> the wrong type.
>> See the check in dma_buf_map_attachment():
>>
>> if (attach->dir != direction && attach->dir != DMA_BIDIRECTIONAL)
>> return ERR_PTR(-EBUSY);
> Hm, I misread this. So yeah should work, +/- the issue that we might
> not flush enough. But I guess that can be fixed whenever, it's not
> like dma-api semantics are a great fit for us. Maybe a fixme comment
> would be useful here ... I'll look at this tomorrow or so because atm
> brain is slow, I'm down with the usual post-conference cold it seems
> :-/
Hope your are feeling better now, adding a comment is of course not a
problem.
With that fixed can I get an reviewed-by or at least and acked-by?
I want to land at least some parts of those changes now.
Regards,
Christian.
> -Daniel
>
next prev parent reply other threads:[~2019-09-24 9:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-29 14:29 Dynamic DMA-buf locking changes Christian König
2019-08-29 14:29 ` [PATCH 1/4] dma-buf: change DMA-buf locking convention Christian König
2019-09-03 8:05 ` Daniel Vetter
2019-09-11 10:53 ` Christian König
2019-09-16 12:23 ` Christian König
2019-09-17 12:31 ` Daniel Vetter
2019-09-17 12:40 ` Koenig, Christian
2019-09-17 13:13 ` Daniel Vetter
2019-09-17 13:24 ` Koenig, Christian
2019-09-17 13:45 ` Daniel Vetter
2019-09-17 14:47 ` Koenig, Christian
2019-09-17 14:56 ` Daniel Vetter
2019-09-24 9:51 ` Koenig, Christian [this message]
2019-10-02 8:37 ` Koenig, Christian
2019-10-08 8:55 ` Daniel Vetter
2019-10-16 13:46 ` Koenig, Christian
2019-10-16 14:23 ` Daniel Vetter
2019-10-17 9:04 ` Koenig, Christian
2019-10-08 8:55 ` Daniel Vetter
2019-08-29 14:29 ` [PATCH 2/4] drm/ttm: use the parent resv for ghost objects v2 Christian König
2019-10-08 9:25 ` Daniel Vetter
2019-10-09 13:10 ` Christian König
2019-10-09 14:09 ` Daniel Vetter
2019-08-29 14:29 ` [PATCH 3/4] drm/amdgpu: add independent DMA-buf export v7 Christian König
2019-08-29 14:29 ` [PATCH 4/4] drm/amdgpu: add independent DMA-buf import v8 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=97bb8f03-7fa3-6e61-a1ff-0ffcadbc1a39@amd.com \
--to=christian.koenig@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-media@vger.kernel.org \
--cc=sumit.semwal@linaro.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;
as well as URLs for NNTP newsgroup(s).