mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Dave Airlie <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: Locking question for DRM
Date: Fri, 23 Apr 2010 12:00:54 +0100	[thread overview]
Message-ID: <20100423120054.0987f3e4@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <u2l21d7e9971004230344u491d3d6bqd093884ce8b21e7c@mail.gmail.com>

> > I don't think that works. drm_open_helper doesn't appear to be under the
> > BKL merely the struct mutex.
> 
> It blocks the case you specified of two releases happening together.

But not parallel open/release

> > But setmaster can sleep so the BKL is dropped on contention of the
> > struct_mutex, ditto dropmaster
> 
> they should only sleep in the mutex lock nuless the driver callback is
> allocating memory. but yeah its a bit of a mess.

With the mutex alone the damage is done. Consider two setmasters and some
other action which is making the mutex contend

		CPU1				CPU2

file->priv->minor->master == NULL ?
file_priv->minor->master != file_priv->master

mutex_lock	(drop BKL)
				file->priv->minor->master === NULL
				master != file_priv->master
				mutex_lock   [drop BKL]
takes mutex
minor->master = drm_master_get
is_master = 1
master_set
drop mutex
return 0
				takes mutex
				minor->master = drm_master_get
				is_master = 1
				master_set
				drops mutex
				return 0


Alan

      reply	other threads:[~2010-04-23 10:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-23 10:22 Alan Cox
2010-04-23 10:24 ` Dave Airlie
2010-04-23 10:37   ` Alan Cox
2010-04-23 10:44     ` Dave Airlie
2010-04-23 11:00       ` Alan Cox [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=20100423120054.0987f3e4@lxorguk.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®