[PATCH 5/8] sync_file: add support for a semaphore object
Dave Airlie
airlied at gmail.com
Wed Apr 12 20:51:17 UTC 2017
On 13 April 2017 at 06:39, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> On Wed, Apr 12, 2017 at 09:01:32PM +0100, Chris Wilson wrote:
>> On Thu, Apr 13, 2017 at 05:05:27AM +1000, Dave Airlie wrote:
>> > >>
>> > >> Not sure what the best semantics are there, any opinions on barring
>> > >> wakeups/polling on semaphore sync_files, and just punting this
>> > >> until we need it.
>> > >
>> > > I think getting it right now will make writing sw_sync-esque (i.e. cpu)
>> > > tests easier and more complete.
>> >
>> > I just don't have any use case for it, so we would be writing code to
>> > write tests for it.
>> >
>> > That doesn't seem smart.
>> >
>> > If there is a future non-testing use case, the API is expressive
>> > enough for someone
>> > to add a flag or new sync obj to allow polling and to add support in a
>> > nice easily
>> > digestible patch.
>>
>> My first thought was to check the signaled status would be to use
>> poll(0), but that can be retrieved from the sync_file_status ioctl. But
>> to get that still needs for us to acquire an fd from the syncobj. And if
>> we were to want check the flag on a driver syncobj, we would need to be
>> able to export one. That doesn't look very promising...
>
> Hmm, you do export fd to pass syncobj between processes. Let's not start
> with syncobj being a second class sync_file.
It's not the same semantics as a sync_file. Userspace should never be polling on
semaphores.
Semaphores are one process signals, one process waits, no semantics for
sniffing or use cases. Unless you have a practical use case for an new
or proposed
API I don't think we should start with adding functionality.
Dave.
More information about the amd-gfx
mailing list