linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <syrjala@sci.fi>
To: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	linux-fbdev-devel@lists.sourceforge.net,
	Andrew Morton <akpm@linux-foundation.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	"Antonino A. Daplas" <adaplas@gmail.com>
Subject: Re: fix fb_info->lock and mm->mmap_sem problem	again
Date: Mon, 4 May 2009 01:54:33 +0300	[thread overview]
Message-ID: <20090503225433.GB17782@sci.fi> (raw)
In-Reply-To: <20090503211938.c9293813.krzysztof.h1@poczta.fm>

On Sun, May 03, 2009 at 09:19:38PM +0200, Krzysztof Helt wrote:
> Hi,
> 
> I have run into the lockdep problem between the fb_info->lock and mm->mmap_sem again.
> I run the Mplayer with fbdev output device. The latest git tree.
> 
> I looked through the fb_info->lock usage and I have some questions.
> 
> The main issue is that fb_mmap acquires the fb_info->lock. I wonder
> what is protected there. The part of the fb_mmap which uses the lock
> is below:
> 
> ...
>     if (fb->fb_mmap) {
>         int res;
>         mutex_lock(&info->lock);
>         res = fb->fb_mmap(info, vma);
>         mutex_unlock(&info->lock);
>         return res;
>     }
> 
>     mutex_lock(&info->lock);
> 
>     /* frame buffer memory */
>     start = info->fix.smem_start;
>     len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len);
>     if (off >= len) {
>         /* memory mapped io */
>         off -= len;
>         if (info->var.accel_flags) {
>             mutex_unlock(&info->lock);
>             return -EINVAL;
>         }
>         start = info->fix.mmio_start;
>         len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len);
>     }
>     mutex_unlock(&info->lock);
> ...
> 
> The lock protects two things:
> 1. Read of the info->fix.smem_start and info->fix.smem_len.
> 2. The fbops->fb_mmap call.
> 
> The first point seems redundant as I have checked and
> the smem_start and smem_len are only set in the
> probe and release functions. They are always set
> before the register_framebuffer() is called and
> after the unregister_framebuffer() call.

matroxfb changes smem_start/len in set_par().

-- 
Ville Syrjälä
syrjala@sci.fi
http://www.sci.fi/~syrjala/

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf

  reply	other threads:[~2009-05-03 22:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-03 19:19 fix fb_info->lock and mm->mmap_sem problem again Krzysztof Helt
2009-05-03 22:54 ` Ville Syrjälä [this message]
2009-05-04  6:49   ` Geert Uytterhoeven
  -- strict thread matches above, loose matches on Subject: below --
2009-05-04  8:18 krzysztof.h1

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=20090503225433.GB17782@sci.fi \
    --to=syrjala@sci.fi \
    --cc=adaplas@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=geert@linux-m68k.org \
    --cc=krzysztof.h1@poczta.fm \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=rjw@sisk.pl \
    /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).