AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: zhoucm1 <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: "Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>,
	"Dave Airlie" <airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "Mao, David" <David.Mao-5C7GfCeVMHo@public.gmane.org>,
	"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	Andres Rodriguez
	<andresr-38hxoXRICFZx67MzidHQgQC/G2K4zDHf@public.gmane.org>,
	Andres Rodriguez
	<andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Dave Airlie <airlied-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"Cui, Flora" <Flora.Cui-5C7GfCeVMHo@public.gmane.org>,
	Pierre-Loup Griffais
	<pgriffais-38hxoXRICFZx67MzidHQgQC/G2K4zDHf@public.gmane.org>
Subject: Re: Shared semaphores for amdgpu
Date: Thu, 9 Mar 2017 17:43:02 +0800	[thread overview]
Message-ID: <58C123A6.70209@amd.com> (raw)
In-Reply-To: <37118a87-28f2-c96d-18dc-a71292ea35d4-5C7GfCeVMHo@public.gmane.org>



On 2017年03月09日 17:12, Christian König wrote:
> Am 09.03.2017 um 09:15 schrieb Dave Airlie:
>> On 9 March 2017 at 17:38, Christian König <christian.koenig@amd.com> 
>> wrote:
>>>> I do wonder if we need the separate sem signal/wait interface, I think
>>>> we should just add
>>>> semaphore chunks to the CS interface.
>>> Yeah, that's what I've said as well from the very first beginning.
>>>
>>> Another question is if we should really create another 
>>> implementation to
>>> share semaphores between processes.
>>>
>>> In other words putting the current fences inside the semaphore into a
>>> sync_file with the signal_on_any bit set would have pretty much the 
>>> same
>>> effect, except that the resulting object then had the sync_file 
>>> semantics
>>> for adding new fences and can be used in the atomic IOCTLs as well.
>> So the vulkan external semaphore spec has two different type of 
>> semaphore
>> semantics, I'm not sure the sync_file semantics match the first type,
>> only the second.
>
> I haven't completely read that part of the spec yet, but from what I 
> know the first semantics is actually a bit scary and I'm not sure if 
> we want to fully support that.
>
> Especially that you can wait on a semaphore object which is not 
> signaled yet can easily lead to deadlocks and bound resources in the 
> kernel and windowing system.
>
> Imagine that you send a command submission to the kernel with the 
> request to wait for a semaphore object and then never signal that 
> semaphore object. At least for amdgpu the kernel driver would accept 
> that CS and push it into the scheduler. This operation needs memory, 
> so by doing this the application would bind kernel memory without the 
> prospect of releasing it anytime soon.
>
> We could of course try to limit the amounts of waiting CS in the 
> kernel, but then we have the problem of deadlocks again. E.g. the 
> signaling CS wouldn't be accepted by the kernel because we have so 
> many waiters.
>
> Additional to that you can easily build deadlocks in the form CS A 
> depends on CS B and CS B depends on CS A. The exact same problem for 
> Android fences where discussed on the list as well, but the semantic 
> there is especially designed so that you can't build deadlocks with it.
Forbidding to wait un-sginaled sem will be enough for your this concern.

>
>> I think we would still need separate objects to do the first type,
Agreed, the implementation indeed do this.
>> which I want for VR stuff..
>
> Which is perfectly reasonable, sharing the object between processes 
> takes time. So you only want to do this once.
>
> As a possible solution what do you think about adding some new 
> functionality to the sync file IOCTLs?
>
> IIRC we currently only support adding new fences to the sync file and 
> then waiting for all of the in the CS/Atomic page flip.
>
> But what if we also allow replacing the fence(s) in the sync file? And 
> then additional to that consuming the fence in the CS/Atomic page flip 
> IOCTL?
I feel the new sem implementation of what I attached is very good, at 
least a good start, maybe we could discuss from there, not talk in the 
fly, so that any problem we can improve it.

Regards,
David Zhou
>
> That's trivial to implement and should give us pretty much the same 
> semantics as the shared semaphore object in Vulkan.
>
> Christian.
>
>>
>> I'll try and think about it a bit harder tomorrow.
>>
>> Dave.
>
>

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-03-09  9:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-05  4:09 Shared semaphores for amdgpu Andres Rodriguez
     [not found] ` <544E607D03B20249AA404517E498FC469A558B-Lp/cVzEoVyaisxZYEgh0i620KmCxYQEWVpNB7YpNyf8@public.gmane.org>
2017-01-05  4:13   ` Mao, David
     [not found]     ` <BN4PR12MB0787AE3A185BE4D6916CE42AEE600-aH9FTdWx9BancvD3hK8fMAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-05 17:48       ` Andres Rodriguez
     [not found]         ` <a25fdfeb-be5d-2d23-d7b1-ef14891ba6d5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-27 19:36           ` Dave Airlie
2017-02-28  1:46             ` zhoucm1
     [not found]               ` <58B4D68E.5080606-5C7GfCeVMHo@public.gmane.org>
2017-03-09  3:52                 ` Dave Airlie
     [not found]                   ` <CAPM=9tw3nbGe+gaOpoBZeXfmS5+C3R4eK=uT8AL3krL0PMR0LA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-09  4:24                     ` Dave Airlie
     [not found]                       ` <CAPM=9twMvVoKCCmQUVsB6uD18j1e9cNq9eNqviVFy6F8v7OdOg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-09  7:00                         ` zhoucm1
     [not found]                           ` <58C0FD86.8040808-5C7GfCeVMHo@public.gmane.org>
2017-03-09  7:38                             ` Christian König
     [not found]                               ` <d5a5f1ba-4bcb-f374-f18e-b060cc40aa9e-5C7GfCeVMHo@public.gmane.org>
2017-03-09  8:15                                 ` Dave Airlie
     [not found]                                   ` <CAPM=9twfZhb7vt_gEBE6LaUfthseX_PC_BZctCyu520MK32QCQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-09  9:12                                     ` Christian König
     [not found]                                       ` <37118a87-28f2-c96d-18dc-a71292ea35d4-5C7GfCeVMHo@public.gmane.org>
2017-03-09  9:43                                         ` zhoucm1 [this message]
     [not found]                                           ` <58C123A6.70209-5C7GfCeVMHo@public.gmane.org>
2017-03-09 10:31                                             ` Christian König
     [not found]                                               ` <a6a3ea27-aae2-dc69-1ec2-f463d8417712-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-03-09 23:19                                                 ` Dave Airlie
     [not found]                                                   ` <CAPM=9tyn1gvTW5W3JbbxmzkN3PTwJjmOKCHiiU52ZOqGDJf_6A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-10  0:46                                                     ` Christian König
     [not found]                                                       ` <85322d42-e585-659d-6f98-fc5baf0d6b14-5C7GfCeVMHo@public.gmane.org>
2017-03-10  3:25                                                         ` Dave Airlie
     [not found]                                                           ` <CAPM=9tz+3DB8zZTH1kRUt8KE-wU7RNeoOE6zQWn_dWDvVRSBMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-10  4:27                                                             ` Dave Airlie
     [not found]                                                               ` <CAPM=9tyDjtgzYEo7FET6jY9zZrWEd1LoLGWLNRkbbRnWTsnzkw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-10  4:43                                                                 ` Dave Airlie
     [not found]                                                                   ` <CAPM=9tzoqKE=F+JjWwUXv7cGTxwJ1u15jTNuTxqL_jSQwQMRAQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-10  9:12                                                                     ` 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=58C123A6.70209@amd.com \
    --to=david1.zhou-5c7gfcevmho@public.gmane.org \
    --cc=David.Mao-5C7GfCeVMHo@public.gmane.org \
    --cc=Flora.Cui-5C7GfCeVMHo@public.gmane.org \
    --cc=airlied-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=andresr-38hxoXRICFZx67MzidHQgQC/G2K4zDHf@public.gmane.org \
    --cc=andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=pgriffais-38hxoXRICFZx67MzidHQgQC/G2K4zDHf@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