All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
To: Peter Hurley <peter@hurleysoftware.com>
Cc: "nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [Nouveau] [PATCH] drm/nouveau: fix vblank deadlock
Date: Mon, 19 Aug 2013 22:01:21 +0200	[thread overview]
Message-ID: <52127991.3020409@canonical.com> (raw)
In-Reply-To: <5212600D.7000203@hurleysoftware.com>

Hey,

Op 19-08-13 20:12, Peter Hurley schreef:
> On 08/12/2013 07:50 AM, Maarten Lankhorst wrote:
>> This fixes a deadlock inversion when vblank is enabled/disabled by drm.
>> &dev->vblank_time_lock is always taken when the vblank state is toggled,
>> which caused a deadlock when &event->lock was also taken during
>> event_get/put.
>>
>> Solve the race by requiring that lock to change enable/disable state,
>> and always keeping vblank on the event list. Core drm ignores unwanted
>> vblanks, so extra calls to drm_handle_vblank are harmless.
>
> I don't feel this is the appropriate solution to the lock inversion
> between vblank_time_lock and event->lock.
>
> Preferably drm core should correct the interface layer bug; ie., calling
> into a sub-driver holding a lock _and_ requiring the sub-driver to call a
> drm helper function which claims the same lock is bad design. The console
> lock suffers from the same design flaw and is a constant problem.
>
> Alternatively, the event trigger could be lockless; ie., the event list
> could be an RCU list instead. In this way, the event->lock does not need
> to be claimed, and thus no lock inversion is possible. The main drawback
> here is that currently the event->lock enforces non-overlapping lifetimes
> between the event handler and the event. Untangling object lifetimes in
> nouveau is a non-trivial exercise.
If only it was so easy..

nouveau is doing a non-standard thing with core/engine/software, specifically the release method.
The real fix is reverting the commit that changes this to a nouveau_event type of thing, and reinstates
the old locking. This is not going to happen though, so the second best fix is just telling it to lock the
other lock too when changing enable state.

~Maarten

      reply	other threads:[~2013-08-19 20:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-12 11:50 [PATCH] drm/nouveau: fix vblank deadlock Maarten Lankhorst
     [not found] ` <5208CC15.8080403-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2013-08-19 18:12   ` Peter Hurley
2013-08-19 20:01     ` Maarten Lankhorst [this message]

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=52127991.3020409@canonical.com \
    --to=maarten.lankhorst@canonical.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=peter@hurleysoftware.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 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.