From: Maarten Lankhorst <maarten.lankhorst-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: "Christian König"
<deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 1/2] dma-buf: make reservation_object_copy_fences rcu save
Date: Mon, 11 Sep 2017 17:13:28 +0200 [thread overview]
Message-ID: <970bf678-49b3-c869-0e63-5eb6fb411244@linux.intel.com> (raw)
In-Reply-To: <88b860d7-3377-0378-93fd-a64c274538f3-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
Op 11-09-17 om 16:45 schreef Christian König:
> Am 11.09.2017 um 15:56 schrieb Maarten Lankhorst:
>> Op 11-09-17 om 14:53 schreef Christian König:
>>> Am 10.09.2017 um 09:30 schrieb Maarten Lankhorst:
>>>> Op 04-09-17 om 21:02 schreef Christian König:
>>>>> From: Christian König <christian.koenig@amd.com>
>>>>>
>>>>> Stop requiring that the src reservation object is locked for this operation.
>>>>>
>>>>> Signed-off-by: Christian König <christian.koenig@amd.com>
>>>>> ---
>>>>> drivers/dma-buf/reservation.c | 56 ++++++++++++++++++++++++++++++++-----------
>>>>> 1 file changed, 42 insertions(+), 14 deletions(-)
>>>>>
>>>>> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
>>>>> index dec3a81..b44d9d7 100644
>>>>> --- a/drivers/dma-buf/reservation.c
>>>>> +++ b/drivers/dma-buf/reservation.c
>>>>> @@ -266,8 +266,7 @@ EXPORT_SYMBOL(reservation_object_add_excl_fence);
>>>>> * @dst: the destination reservation object
>>>>> * @src: the source reservation object
>>>>> *
>>>>> -* Copy all fences from src to dst. Both src->lock as well as dst-lock must be
>>>>> -* held.
>>>>> +* Copy all fences from src to dst. dst-lock must be held.
>>>>> */
>>>>> int reservation_object_copy_fences(struct reservation_object *dst,
>>>>> struct reservation_object *src)
>>>> Could this be implemented using reservation_object_get_fences_rcu? You're essentially duplicating its functionality.
>>> I've considered this as well, but reservation_object_get_fences_rcu() returns an array and here we need an reservation_object_list.
>> Doesn't seem too hard, below is the result from fiddling with the allocation function..
>> reservation_object_list is just a list of fences with some junk in front.
>>
>> Here you go, but only tested with the compiler. O:)
>> -----8<-----
>> drivers/dma-buf/reservation.c | 192 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------
>> 1 file changed, 109 insertions(+), 83 deletions(-)
>
> To be honest that looks rather ugly to me for not much gain.
>
> Additional to that we loose the optimization I've stolen from the wait function.
Right now your version does exactly the same as reservation_object_get_fences_rcu,
but with a reservation_object_list instead of a fence array.
Can't you change reservation_object_get_fences_rcu to return a
reservation_object_list? All callsites look like they could be easily converted.
So the new patch series would be:
1. Make reservation_object_get_fences_rcu return a reservation_object_list
2. Add optimization
3. Convert reservation_object_copy_fences to use rcu.
Cheers,
Maarten
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-09-11 15:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-04 19:02 [PATCH 1/2] dma-buf: make reservation_object_copy_fences rcu save Christian König
[not found] ` <1504551766-5093-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-09-04 19:02 ` [PATCH 2/2] drm/ttm: fix ttm_bo_cleanup_refs_or_queue once more Christian König
[not found] ` <1504551766-5093-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-09-07 7:33 ` zhoucm1
2017-09-07 7:13 ` [PATCH 1/2] dma-buf: make reservation_object_copy_fences rcu save Christian König
[not found] ` <6a9be9a4-34b2-c8de-0da8-d8f4024bac74-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-09-07 7:24 ` zhoucm1
2017-09-08 6:17 ` Daniel Vetter
2017-09-10 7:30 ` Maarten Lankhorst
[not found] ` <6b53a3c4-87ee-437d-63b3-4d2369ba2208-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-11 12:53 ` Christian König
2017-09-11 13:56 ` Maarten Lankhorst
[not found] ` <dbcc9a56-f6bf-c552-bdd1-363042536fb2-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-11 14:45 ` Christian König
[not found] ` <88b860d7-3377-0378-93fd-a64c274538f3-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-09-11 15:13 ` Maarten Lankhorst [this message]
2017-09-11 15:22 ` Christian König
[not found] ` <1e15bc3d-e2c8-4c95-fe0c-e91d08f19fb8-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-09-11 15:24 ` Christian König
[not found] ` <5c473978-55b5-e284-7012-33d0d098d964-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-09-11 15:29 ` Maarten Lankhorst
[not found] ` <3944c1e3-aaa9-27cb-7017-f9345d9c8a6f-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-11 15:45 ` 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=970bf678-49b3-c869-0e63-5eb6fb411244@linux.intel.com \
--to=maarten.lankhorst-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org \
--cc=dri-devel-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