All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Airlie <airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Chris Wilson
	<chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>,
	Dave Airlie <airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx mailing list
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	dri-devel
	<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 5/8] sync_file: add support for a semaphore object
Date: Thu, 13 Apr 2017 08:42:03 +1000	[thread overview]
Message-ID: <CAPM=9ty5uGa4i-tsRmBEOn77OVju-uvqebQj2J68kHMrkhfRBg@mail.gmail.com> (raw)
In-Reply-To: <20170412223438.GQ12532-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>

On 13 April 2017 at 08:34, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Thu, Apr 13, 2017 at 07:41:28AM +1000, Dave Airlie wrote:
>> >
>> > The problem, as I see it, is that you are taking functionality away from
>> > sync_file. If you are wrapping them up inside a sync_file, we have a
>> > fair expectation that our code to handle sync_files will continue to
>> > work.
>>
>> What code? there is no code existing that should be sharing sync objects
>> with semaphores backing them, and trying to use them as sync_files.
>
> By masquerading semaphores as sync_files, you are inviting them to be
> used with the existing code to handle sync_file.

But what existing code is going to get a sync object from another process
and blindly use it without knowing where it got it.

I'm not buying the argument that just because something is possible,
we have to support it.

>
> And quite different from the existing CPU visible sync_files. Why try
> stuffing them through the same interface? At the moment the only thing
> they have in common is the single fence pointer, and really you want
> them just for their handle/fd to a GPU channel.
>
> After you strip out the fops from the semaphore code, doesn't it boil
> down to:
>
> static void semaphore_file_release(struct inode *inode, struct file *file)
> {
>         struct semaphore_file *s = file->private_data;
>
>         dma_fence_put(s->fence);
>         kfree(s);
> }
>
> static const struct file_operations semaphore_file_fops = {
>         .release = semaphore_file_release,
> };
>
> struct semaphore_file *semaphore_file_create(void)
> {
>         struct semaphore_file *s;
>
>         s = kzalloc(sizeof(*s), GFP_KERNEL);
>         if (!s)
>                 return NULL;
>
>         s->file = anon_inode_getfile("semaphore_"file",
>                                      &semaphore_file_fops, s, 0);
>
>         return s;
> }
>
> Plus your new routines to manipulate the semaphore.
>
> The commonality with the current sync_file {
>                 struct file *file;
>                 struct dma_fence *fence;
>         };
> could be extracted and sync_file become fence_file. Would it not help to
> avoid any further confusion by treating them as two very distinct classes
> of fd?
>
> And for me to stop calling the user interface sync_file.

That's a better argument, but the consideration is that there are probably
use-cases for doing something with these in the future, and we'd be limiting
those by doing this. The current code adds the API we need without constraining
future use cases overly much, and avoids any pitfalls.

I'll consider whether we should just split sync_file, but you still have the
same problems you mention, you get an fd you do something you shouldn't with
it, it doesn't fix any of the problems you are raising.

If you have an opaque fd you don't know the providence of, and except some
operations to just work o nit, you are going to be disappointed.

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

  parent reply	other threads:[~2017-04-12 22:42 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11  3:22 [repost] drm sync objects cleaned up Dave Airlie
2017-04-11  3:22 ` [PATCH 1/8] sync_file: add type/flags to sync file object creation Dave Airlie
     [not found] ` <20170411032220.21101-1-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-11  3:22   ` [PATCH 2/8] sync_file: export some interfaces needed by drm sync objects Dave Airlie
2017-04-11  3:22   ` [PATCH 4/8] sync_file: add a mutex to protect fence and callback members. (v4) Dave Airlie
2017-04-11  3:22   ` [PATCH 6/8] drm/syncobj: add semaphore support helpers Dave Airlie
2017-04-11  3:22   ` [PATCH 7/8] amdgpu/cs: split out fence dependency checking Dave Airlie
2017-04-11  3:22   ` [PATCH 8/8] amdgpu: use sync file for shared semaphores (v2.1) Dave Airlie
     [not found]     ` <20170411032220.21101-9-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-11 12:42       ` Chris Wilson
     [not found]         ` <20170411124217.GC7895-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>
2017-04-12  2:31           ` Dave Airlie
2017-04-12  2:36       ` Mao, David
     [not found]         ` <BN4PR12MB0787C6D1CD93D0FCB6F2069DEE030-aH9FTdWx9BancvD3hK8fMAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-04-12  2:44           ` Dave Airlie
     [not found]             ` <CAPM=9txg84JzHVOpA7mfp4774gT_TLcEiya5fXu9cMTSFdWYWg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-12  2:49               ` Mao, David
2017-04-12  3:17                 ` Dave Airlie
2017-04-12  3:34                   ` Mao, David
     [not found]                     ` <BN4PR12MB07879A581F0E3C7AE9FDA20CEE030-aH9FTdWx9BancvD3hK8fMAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-04-12  3:58                       ` Dave Airlie
     [not found]                         ` <CAPM=9twr+ZNJDe-uCQNUxTavr_W8+AEGygc1V8ei6Q0PaLRhtw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-12  4:13                           ` Mao, David
2017-04-12  8:27                           ` Christian König
2017-04-14  9:45   ` [repost] drm sync objects cleaned up Chris Wilson
     [not found]     ` <20170414094520.GB12532-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>
2017-04-18 19:34       ` Dave Airlie
     [not found]         ` <CAPM=9twmJPkzEL7sFOSAURAVKd7yhKn3dEk=C=vJMQT11sAQQA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-18 20:30           ` Chris Wilson
     [not found]             ` <20170418203037.GB9029-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>
2017-04-18 21:55               ` Jason Ekstrand
2017-04-18 23:54                 ` Dave Airlie
2017-04-11  3:22 ` [PATCH 3/8] drm: introduce sync objects as sync file objects with no fd (v2) Dave Airlie
2017-04-11  3:22 ` [PATCH 5/8] sync_file: add support for a semaphore object Dave Airlie
     [not found]   ` <20170411032220.21101-6-airlied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-11  7:50     ` Chris Wilson
2017-04-12  2:36       ` Dave Airlie
     [not found]         ` <CAPM=9tzgNoSXPoZfJbRcoRmGZL9gENo+TTZCbauMjB7mwayZxw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-12 10:31           ` Chris Wilson
     [not found]             ` <20170412103116.GL4250-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>
2017-04-12 19:05               ` Dave Airlie
     [not found]                 ` <CAPM=9tyiKAH-T2rxwcqxc=LWZ8o_5TyxV3GVhy_JKZv3PZQsCw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-12 20:01                   ` Chris Wilson
     [not found]                     ` <20170412200132.GJ12532-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>
2017-04-12 20:39                       ` Chris Wilson
2017-04-12 20:51                         ` Dave Airlie
     [not found]                           ` <CAPM=9tyk2NvVTfzEmm+psYv2BfL3xNKhEq_CE7gGeHmS3R9BMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-12 21:13                             ` Chris Wilson
2017-04-12 21:41                               ` Dave Airlie
     [not found]                                 ` <CAPM=9tzx8TjPUQ0qH0j=b=U_RyGerCjCNb+2feTuuONB9iRkqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-04-12 22:34                                   ` Chris Wilson
     [not found]                                     ` <20170412223438.GQ12532-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>
2017-04-12 22:42                                       ` Dave Airlie [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-04-04  4:27 [RFC] DRM synchronisation objects Dave Airlie
2017-04-04  4:27 ` [PATCH 5/8] sync_file: add support for a semaphore object Dave Airlie
2017-04-04  7:59   ` Daniel Vetter
2017-04-04 11:52   ` Chris Wilson
2017-04-04 11:59     ` Chris Wilson

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='CAPM=9ty5uGa4i-tsRmBEOn77OVju-uvqebQj2J68kHMrkhfRBg@mail.gmail.com' \
    --to=airlied-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.