linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Krzysztof Helt <krzysztof.h1@poczta.fm>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>, linux-fbdev-devel@
Subject: Re: fix fb_info->lock and mm->mmap_sem problem again
Date: Mon, 4 May 2009 08:49:52 +0200	[thread overview]
Message-ID: <10f740e80905032349gabf2908w8d2ecd64664fc768@mail.gmail.com> (raw)
In-Reply-To: <20090503225433.GB17782@sci.fi>

On Mon, May 4, 2009 at 00:54, Ville Syrjälä <syrjala@sci.fi> wrote:
> On Sun, May 03, 2009 at 09:19:38PM +0200, Krzysztof Helt wrote:
>> 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().

Exactly my comment: most drivers that support multiple heads need some memory
management scheme, which means the location and size of the memory allocated
to a specific head may change.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

------------------------------------------------------------------------------
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
_______________________________________________
Linux-fbdev-devel mailing list
Linux-fbdev-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel

  reply	other threads:[~2009-05-04  6:49 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ä
2009-05-04  6:49   ` Geert Uytterhoeven [this message]
  -- 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=10f740e80905032349gabf2908w8d2ecd64664fc768@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=krzysztof.h1@poczta.fm \
    --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).