public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple@vodafone.de>
To: Maarten Lankhorst <maarten.lankhorst@canonical.com>, airlied@linux.ie
Cc: nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [RFC PATCH v1 08/16] drm/radeon: use common fence implementation for fences
Date: Mon, 19 May 2014 16:25:19 +0200	[thread overview]
Message-ID: <537A144F.1070909@vodafone.de> (raw)
In-Reply-To: <537A08BC.7060501@canonical.com>

Am 19.05.2014 15:35, schrieb Maarten Lankhorst:
> op 19-05-14 14:30, Christian König schreef:
>> Am 19.05.2014 12:10, schrieb Maarten Lankhorst:
>>> op 19-05-14 10:27, Christian König schreef:
>>>> Am 19.05.2014 10:00, schrieb Maarten Lankhorst:
>>>> [SNIP]
>>>> The problem here is that the whole approach collides with the way 
>>>> we do reset handling from a conceptual point of view. Every IOCTL 
>>>> or other call chain into the driver is protected by the read side 
>>>> of the exclusive_lock semaphore. So in the case of a GPU lockup we 
>>>> can take the write side of the semaphore and so make sure that we 
>>>> have nobody else accessing the hardware or internal driver 
>>>> structures only changed at init time.
>>>>
>>>> Leaking a drivers IRQ context into another driver as well as 
>>>> calling into a driver in atomic context is just a quite uncommon 
>>>> approach and should be considered very carefully.
>>>>
>>>> I would rather vote for a completely synchronous interface only 
>>>> allowing blocking waits and checks if a fence is signaled from not 
>>>> atomic context.
>>>>
>>>> If a driver needs to avoid blocking it should just use a workqueue 
>>>> and checking a fence outside your own driver is probably be better 
>>>> done in a bottom halve handler anyway.
>>>
>>> Except that you might want to do something like
>>> fence_is_signaled() in another driver to check whether you need to
>>> defer, or can submit the batch buffer immediately, saving a bunch of
>>> context switches. Running the is_signaled atomic is really useful here
>>> because it means you can't do too many scary things in your is_signaled
>>> handler.
>>
>> This is indeed a nice optimization, but nothing more. If you want to 
>> provide a is_signalled interface for atomic context then this should 
>> be optional, not mandatory.
> See below.
>>> In case of enable_signaling it was the only sane solution, because
>>> fence_signal can be called from irq context, and any calls after 
>>> that to
>>> fence_add_callback and fence_wait aren't allowed to do anything, so
>>> fence_enable_sw_signaling and the default wait implementation must be
>>> atomic. fence_wait itself doesn't have to be, so it's easy to grab
>>> exclusive_lock there.
>>
>> I don't think you understood my point here: Completely drop 
>> enable_signaling, it's unnecessary and only complicates the interface.
>>
>> We purposely avoided exactly this paradigm in the past and I haven't 
>> seen any good argument to start with it now.
>
> In the common case a lot more fences will be emitted than will be 
> waited on.
> This means it makes sense to delay signaling a fence with fence_signal 
> for
> as long as possible. But when a fence user wants to work with a fence
> some way is needed to ensure that the fence will complete. This is the 
> idea
> behind .enable_signaling, it tells the fence driver to call 
> fence_signal on
> the fence 'soon' because there are now waiters for it.
>
> The atomic .signaled is optional, and can be set to NULL, but there is
> no guarantee that fence_is_signaled will ever return true in that case,
> unless fence_enable_sw_signaling is called (which calls 
> .enable_signaling).
>
> Providing a custom wait function is optional in the interface, if the 
> default wait
> function is used all waiters are signaled when fence_signal is called.
>
> Removing enable_signaling would only make sense if fence_signal was 
> removed too,
> but that would mean that fence_is_signaled could no longer exist in 
> the core fence
> code, and would mean completely rewriting the interface.
>
And this is what I'm suggesting here.

We have avoided quite hard adding any form of those callbacks in the 
past and I don't really see a reason why that would have changed. For 
example see the discussion here: 
http://lists.freedesktop.org/archives/dri-devel/2012-May/022388.html

Jerome and Dave rejected my approach for handling the sub allocator 
through a callback for exactly the same reason. And that was even for 
call chains inside the same driver, you're suggesting this for cross 
driver synchronization.

Christian.

  reply	other threads:[~2014-05-19 14:25 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 14:57 [RFC PATCH v1 00/16] Convert all ttm drivers to use the new reservation interface Maarten Lankhorst
2014-05-14 14:57 ` [RFC PATCH v1 01/16] drm/ttm: add interruptible parameter to ttm_eu_reserve_buffers Maarten Lankhorst
2014-05-14 14:57 ` [RFC PATCH v1 02/16] drm/ttm: kill off some members to ttm_validate_buffer Maarten Lankhorst
2014-05-14 14:57 ` [RFC PATCH v1 03/16] drm/nouveau: add reservation to nouveau_gem_ioctl_cpu_prep Maarten Lankhorst
2014-05-14 14:57 ` [RFC PATCH v1 04/16] drm/nouveau: require reservations for nouveau_fence_sync and nouveau_bo_fence Maarten Lankhorst
2014-05-14 14:57 ` [RFC PATCH v1 05/16] drm/ttm: call ttm_bo_wait while inside a reservation Maarten Lankhorst
2014-05-14 14:57 ` [RFC PATCH v1 06/16] drm/ttm: kill fence_lock Maarten Lankhorst
2014-05-14 14:58 ` [RFC PATCH v1 07/16] drm/nouveau: rework to new fence interface Maarten Lankhorst
2014-05-14 14:58 ` [RFC PATCH v1 08/16] drm/radeon: use common fence implementation for fences Maarten Lankhorst
2014-05-14 15:29   ` Christian König
2014-05-15  1:06     ` Maarten Lankhorst
2014-05-15  9:21       ` Christian König
2014-05-15  9:38         ` Maarten Lankhorst
2014-05-15  9:42           ` Christian König
2014-05-15 13:04             ` Maarten Lankhorst
2014-05-15 13:19               ` Christian König
2014-05-15 14:18                 ` Maarten Lankhorst
2014-05-15 15:48                   ` Christian König
2014-05-15 15:58                     ` Maarten Lankhorst
2014-05-15 16:13                       ` Christian König
2014-05-19  8:00                         ` Maarten Lankhorst
2014-05-19  8:27                           ` Christian König
2014-05-19 10:10                             ` Maarten Lankhorst
2014-05-19 12:30                               ` Christian König
2014-05-19 13:35                                 ` Maarten Lankhorst
2014-05-19 14:25                                   ` Christian König [this message]
2014-06-02 10:09                                     ` [RFC PATCH v1.2 " Maarten Lankhorst
2014-06-02 10:45                                       ` Christian König
2014-06-02 13:14                                         ` [RFC PATCH v1.3 08/16 1/2] drm/radeon: add timeout argument to radeon_fence_wait_seq Maarten Lankhorst
2014-06-02 13:27                                           ` Christian König
2014-06-03  7:50                                             ` [RFC PATCH v1.4 " Maarten Lankhorst
2014-06-02 13:16                                         ` [RFC PATCH v1.3 08/16 2/2] drm/radeon: use common fence implementation for fences Maarten Lankhorst
2014-05-14 14:58 ` [RFC PATCH v1 09/16] drm/qxl: rework to new fence interface Maarten Lankhorst
2014-05-14 14:58 ` [RFC PATCH v1 10/16] drm/vmwgfx: get rid of different types of fence_flags entirely Maarten Lankhorst
2014-05-14 14:58 ` [RFC PATCH v1 11/16] drm/vmwgfx: rework to new fence interface Maarten Lankhorst
2014-05-14 14:58 ` [RFC PATCH v1 12/16] drm/ttm: flip the switch, and convert to dma_fence Maarten Lankhorst
2014-05-14 14:58 ` [RFC PATCH v1 13/16] drm/nouveau: use rcu in nouveau_gem_ioctl_cpu_prep Maarten Lankhorst
2014-05-14 14:58 ` [RFC PATCH v1 14/16] drm/radeon: use rcu waits in some ioctls Maarten Lankhorst
2014-05-14 14:58 ` [RFC PATCH v1 15/16] drm/vmwgfx: use rcu in vmw_user_dmabuf_synccpu_grab Maarten Lankhorst
2014-05-14 14:58 ` [RFC PATCH v1 16/16] drm/ttm: use rcu in core ttm Maarten Lankhorst

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=537A144F.1070909@vodafone.de \
    --to=deathsimple@vodafone.de \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@canonical.com \
    --cc=nouveau@lists.freedesktop.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