From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
"Lucas De Marchi" <lucas.demarchi@intel.com>
Cc: thomas.hellstrom@linux.intel.com,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
daniel.vetter@ffwll.ch
Subject: Re: [Intel-gfx] [PATCH] drm/syncobj: flatten dma_fence_chains on transfer
Date: Mon, 30 May 2022 13:09:21 +0300 [thread overview]
Message-ID: <442b3a43-2b8b-e9be-6ee4-b4b2357c8cf0@intel.com> (raw)
In-Reply-To: <b54b2cc7-f511-e6ce-72fa-da5c8cd5e7b4@gmail.com>
On 30/05/2022 12:52, Christian König wrote:
> Am 25.05.22 um 23:59 schrieb Lucas De Marchi:
>> On Wed, May 25, 2022 at 12:38:51PM +0200, Christian König wrote:
>>> Am 25.05.22 um 11:35 schrieb Lionel Landwerlin:
>>>> [SNIP]
>>>>
>>>> Err... Let's double check with my colleagues.
>>>>
>>>> It seems we're running into a test failure in IGT with this patch,
>>>> but now I have doubts that it's where the problem lies.
>>>
>>> Yeah, exactly that's what I couldn't understand as well.
>>>
>>> What you describe above should still work fine.
>>>
>>> Thanks for taking a look into this,
>>> Christian.
>>
>> With some additional prints:
>>
>> [ 210.742634] Console: switching to colour dummy device 80x25
>> [ 210.742686] [IGT] syncobj_timeline: executing
>> [ 210.756988] [IGT] syncobj_timeline: starting subtest
>> transfer-timeline-point
>> [ 210.757364] [drm:drm_syncobj_transfer_ioctl] *ERROR* adding fence0
>> signaled=1
>> [ 210.764543] [drm:drm_syncobj_transfer_ioctl] *ERROR* resulting
>> array fence signaled=0
>> [ 210.800469] [IGT] syncobj_timeline: exiting, ret=98
>> [ 210.825426] Console: switching to colour frame buffer device 240x67
>>
>>
>> still learning this part of the code but AFAICS the problem is because
>> when we are creating the array, the 'signaled' doesn't propagate to the
>> array.
>
> Yeah, but that is intentionally. The array should only signal when
> requested.
>
> I still don't get what the test case here is checking.
There must be something I don't know about fence arrays.
You seem to say that creating an array of signaled fences will not make
the array signaled.
This is the situation with this IGT test.
We started with a syncobj with point 1 & 2 signaled.
We take point 2 and import it as a new point 3 on the same syncobj.
We expect point 3 to be signaled as well and it's not.
Thanks,
-Lionel
>
> Regards,
> Christian.
>
>>
>> dma_fence_array_create() {
>> ...
>> atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences);
>> ...
>> }
>>
>> This is not considering the fact that some of the fences could already
>> have been signaled as is the case in the
>> igt@syncobj_timeline@transfer-timeline-point
>> test. See
>> https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11693/shard-dg1-12/igt@syncobj_timeline@transfer-timeline-point.html
>>
>> Quick patch on this function fixes it for me:
>>
>> ---------8<----------------
>> Subject: [PATCH] dma-buf: Honor already signaled fences on array
>> creation
>>
>> When creating an array, array->num_pending is marked with the number of
>> fences. However the fences could alredy have been signaled. Propagate
>> num_pending to the array by looking at each individual fence the array
>> contains.
>>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>> drivers/dma-buf/dma-fence-array.c | 11 ++++++++++-
>> 1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/dma-buf/dma-fence-array.c
>> b/drivers/dma-buf/dma-fence-array.c
>> index 5c8a7084577b..32f491c32fa0 100644
>> --- a/drivers/dma-buf/dma-fence-array.c
>> +++ b/drivers/dma-buf/dma-fence-array.c
>> @@ -158,6 +158,8 @@ struct dma_fence_array
>> *dma_fence_array_create(int num_fences,
>> {
>> struct dma_fence_array *array;
>> size_t size = sizeof(*array);
>> + unsigned num_pending = 0;
>> + struct dma_fence **f;
>>
>> WARN_ON(!num_fences || !fences);
>>
>> @@ -173,7 +175,14 @@ struct dma_fence_array
>> *dma_fence_array_create(int num_fences,
>> init_irq_work(&array->work, irq_dma_fence_array_work);
>>
>> array->num_fences = num_fences;
>> - atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences);
>> +
>> + for (f = fences; f < fences + num_fences; f++)
>> + num_pending += !dma_fence_is_signaled(*f);
>> +
>> + if (signal_on_any)
>> + num_pending = !!num_pending;
>> +
>> + atomic_set(&array->num_pending, num_pending);
>> array->fences = fences;
>>
>> array->base.error = PENDING_ERROR;
>
next prev parent reply other threads:[~2022-05-30 10:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 18:26 [Intel-gfx] [PATCH] drm/syncobj: flatten dma_fence_chains on transfer Christian König
2022-02-16 0:20 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
2022-05-25 6:47 ` [Intel-gfx] [PATCH] " Lionel Landwerlin
[not found] ` <dbdb02cb-26fa-4f08-b125-c4a850e73780@gmail.com>
2022-05-25 9:26 ` Lionel Landwerlin
2022-05-25 9:35 ` Lionel Landwerlin
[not found] ` <419c9bff-4292-3062-b7f2-efeb64b9e79f@gmail.com>
2022-05-25 21:59 ` Lucas De Marchi
[not found] ` <b54b2cc7-f511-e6ce-72fa-da5c8cd5e7b4@gmail.com>
2022-05-30 10:09 ` Lionel Landwerlin [this message]
[not found] ` <d363c177-c874-f7c7-1d53-c0a2ea9510a7@gmail.com>
2022-05-30 12:19 ` Lionel Landwerlin
2022-05-25 22:14 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/syncobj: flatten dma_fence_chains on transfer (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=442b3a43-2b8b-e9be-6ee4-b4b2357c8cf0@intel.com \
--to=lionel.g.landwerlin@intel.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=thomas.hellstrom@linux.intel.com \
/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