linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
To: linux-fbdev@vger.kernel.org
Subject: Re: Circular locking (and possible deadlock), when exiting from mplayer -vo fbdev2
Date: Tue, 05 Jun 2012 18:37:59 +0000	[thread overview]
Message-ID: <4FCE5207.6020501@gmx.de> (raw)
In-Reply-To: <20120604173702.GZ16584@smp.if.uj.edu.pl>

Hi,

On 06/05/2012 05:18 PM, Witold Baryluk wrote:
> On 06-05 17:10, Dan Carpenter wrote:
>> My patch can't cause this.  I'd be surprised if my patch has any
>> effect beyond silencing a static checker warning, honestly.
>>
> 
> Yes, you are right. Your patch cannot be cause of it. Sorry for
> confusion.
> 
>> I'm not sure this is a new bug.
>>
> 
> Indeed, last time I used mplayer -vo fbdev2 was years ago, so bug could
> appear anywhere in this period, or it is a more a matter of my
> configuration.
> 
>> The problem is we hold ->mmap_sem when we call fb_release() which
>> takes the info->lock.
>>
>> We take the info->lock in do_fb_ioctl() before we call fb_set_var()
>> which calls drm_fb_helper_set_par() which takes the
>> mode_config.mutex.
>>
>> In drm_mode_getresources() we take the mode_config.mutex() and call
>> put_user() which takes the ->mmap_sem.
>>
>> So on one CPU we are holding the ->mmap_sem and want the info->lock.
>> On another CPU we are holding the info->lock and want the
>> config.mutex.  On the other CPU we hold the config.mutex and want
>> the ->mmap_sem.
>>
>> Deadlock.
> 
> Temporary solution would be to break a cycle, and for example take
> info->lock first on first processor before taking ->mmap_sem and calling
> fb_release - it is just fb release, so performance doesn't matter so
> much. Other possibility is to protect this code paths by separate common
> lock, but it will increase memory and make it slower probably in this
> function and other ones. I do not know which subsystems use
> drm_mode_getresources, and if this is important performance wise.
> 
> There is probably other possibilities, but only fbdev people can tell
> which is best.

That's not true. This is the wrong mailing list as this happens only
with DRM-based framebuffers (in drivers/gpu/drm/ not drivers/video/) and
therefore you should resend your initial mail to
dri-devel@lists.freedesktop.org.


Best regards,

Florian Tobias Schandinat

>>
>> I'm not sure how to make this work with just two CPUs...  Or how to
>> fix it.  But I'm going to disclaim all responsibility and hope the
>> fbdev people can take a look.  ;)
>>
>> regards,
>> dan carpenter
>>
> 
> 
> thanks for analysis,
> 
> Regards,
> Witek
> 


      parent reply	other threads:[~2012-06-05 18:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-04 17:37 Circular locking (and possible deadlock), when exiting from mplayer -vo fbdev2 Witold Baryluk
2012-06-05 14:10 ` Dan Carpenter
2012-06-05 17:18 ` Witold Baryluk
2012-06-05 18:37 ` Florian Tobias Schandinat [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=4FCE5207.6020501@gmx.de \
    --to=florianschandinat@gmx.de \
    --cc=linux-fbdev@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;
as well as URLs for NNTP newsgroup(s).