public inbox for amd-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: zhoucm1 <zhoucm1@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Chunming Zhou" <david1.zhou@amd.com>,
	dri-devel@lists.freedesktop.org
Cc: Dave Airlie <airlied@redhat.com>,
	Daniel Rakos <Daniel.Rakos@amd.com>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] [RFC]drm: add syncobj timeline support v5
Date: Tue, 18 Sep 2018 10:32:49 +0200	[thread overview]
Message-ID: <2bea4bc7-ce1f-e1ff-8308-d932d108f237@gmail.com> (raw)
In-Reply-To: <29f4106d-1d10-075c-b90a-61b2da7c6957@amd.com>

Am 17.09.2018 um 11:33 schrieb zhoucm1:
> [SNIP]
>>>   +static struct dma_fence *
>>> +drm_syncobj_point_get(struct drm_syncobj *syncobj, u64 point, u64 
>>> flags)
>>> +{
>>> +    struct dma_fence *fence;
>>> +    int ret = 0;
>>> +
>>> +    if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) {
>>> +        ret = wait_event_timeout(syncobj->syncobj_timeline.wq,
>>> +                    point <= syncobj->syncobj_timeline.signal_point,
>>> +                    msecs_to_jiffies(10000)); /* wait 10s */
>>
>> Either don't use a timeout or provide the timeout explicitely, but 
>> don't hard code it here.
>>
>> Additional to that we probably need an incorruptible wait.
> Initially, I used interruptible wait, I found it sometimes often 
> return -ERESTARTSYS without waiting any second when I wrote unit test.
> Any ideas for that?

Yeah, that is perfectly normal. The application just received a signal 
and we need to abort the IOCTL ASAP.

> still need to interruptible wait?

Yes, that should certainly be an interruptible wait.

Otherwise an application could block on this forever when somebody 
forgets to supply a signal point.

>>>   -    for (i = 0; i < args->count_handles; i++)
>>> -        drm_syncobj_replace_fence(syncobjs[i], 0, NULL);
>>> -
>>> +    for (i = 0; i < args->count_handles; i++) {
>>> +        if (syncobjs[i]->type == DRM_SYNCOBJ_TYPE_TIMELINE) {
>>> +            DRM_ERROR("timeline syncobj cannot reset!\n");
>>
>> Why not? I mean that should still work or do I miss anything?
> timeline semaphore spec doesn't require reset interface, it says the 
> timeline value only can be changed by signal operations.

Yeah, but we don't care about the timeline spec in the kernel.

Question is rather if that still makes sense to support that and as far 
as I can see it should be trivial to reinitialize the object.

>>> +            ret = -EINVAL;
>>> +            goto out;
>>> +        }
>>> +        drm_syncobj_timeline_fini(syncobjs[i],
>>> +                      &syncobjs[i]->syncobj_timeline);
>>> +        drm_syncobj_timeline_init(syncobjs[i],
>>> +                      &syncobjs[i]->syncobj_timeline);
>>> +    }
>>> +out:
>>>       drm_syncobj_array_free(syncobjs, args->count_handles);
>>>   -    return 0;
>>> +    return ret;
>>>   }
>>>     int
>>> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
>>> b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
>>> index 0a8d2d64f380..579e91a5858b 100644
>>> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
>>> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
>>> @@ -2137,7 +2137,9 @@ await_fence_array(struct i915_execbuffer *eb,
>>>           if (!(flags & I915_EXEC_FENCE_WAIT))
>>>               continue;
>>>   -        fence = drm_syncobj_fence_get(syncobj);
>>> +        drm_syncobj_search_fence(syncobj, 0,
>>> +                     DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT,
>>
>> Not sure if we can make DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT the 
>> default here.
>>
>> Maybe better if drivers explicitly need to ask for it?
> if you don't like the flag used in specific driver, I can wrap it to a 
> new function.

Yeah, that is probably a good idea.

>>
>>> +                     &fence);
>>>           if (!fence)
>>>               return -EINVAL;
>>>   diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h
>>> index 425432b85a87..9535521e6623 100644
>>> --- a/include/drm/drm_syncobj.h
>>> +++ b/include/drm/drm_syncobj.h
>>> @@ -30,6 +30,25 @@
>>>     struct drm_syncobj_cb;
>>>   +enum drm_syncobj_type {
>>> +    DRM_SYNCOBJ_TYPE_NORMAL,
>>
>> Does anybody have a better suggestion for _TYPE_NORMAL? That sounds 
>> like timeline would be special.
> How about _TYPE_INDIVIDUAL?

Oh, really good idea.

> btw: I encounter a problem after removing advanced wait pt, I debug it 
> two days, but still don't find reason, from log, it's timeount when 
> wait_event_timeout, that means it don't receive signal operation.

Good question. Maybe a race condition? Have you tried to trace both 
threads to the trace buffer, e.g. use trace_printk?

> "./deqp-vk -n dEQP-VK*semaphore*" will fail on 
> 'dEQP-VK.synchronization.basic.semaphore.chain' case, but can pass if 
> only run that one case like "./deqp-vk -n 
> dEQP-VK.synchronization.basic.semaphore.chain".
>
> Both old and my previous implementation can pass and have no this 
> problem.

Can you reproduce that as well with the unit tests in libdrm?

Christian.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-09-18  8:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 10:37 [PATCH] [RFC]drm: add syncobj timeline support v5 Chunming Zhou
2018-09-14 10:49 ` Christian König
     [not found]   ` <9a07a371-8de1-2ebf-66e7-23b93c1bc1c3-5C7GfCeVMHo@public.gmane.org>
2018-09-14 16:10     ` Daniel Vetter
     [not found]       ` <20180914161059.GR11082-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-09-14 16:43         ` Christian König
2018-09-14 18:24           ` Daniel Vetter
     [not found]             ` <CAKMK7uH9jLO0bJe8ek-JyK3u1jbKY6Jk6xgT9ifgcko7Hi2URA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-09-14 18:27               ` Christian König
2018-09-17  2:23         ` Zhou, David(ChunMing)
2018-09-17  8:37 ` Christian König
     [not found]   ` <a5d2d299-4360-4267-046e-40b550239524-5C7GfCeVMHo@public.gmane.org>
2018-09-17  9:33     ` zhoucm1
2018-09-18  8:32       ` Christian König [this message]
2018-09-19  3:20         ` zhoucm1
     [not found]           ` <0231250d-0ed0-e99b-84c6-166b47a0b9cc-5C7GfCeVMHo@public.gmane.org>
2018-09-19  7:21             ` 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=2bea4bc7-ce1f-e1ff-8308-d932d108f237@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=Daniel.Rakos@amd.com \
    --cc=airlied@redhat.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=david1.zhou@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=zhoucm1@amd.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