mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Adrian Bunk <bunk@kernel.org>
Cc: Shane <gnome42@gmail.com>, Brandon Philips <brandon@ifup.org>,
	linux-kernel@vger.kernel.org,
	video4linux-list <video4linux-list@redhat.com>
Subject: Re: 2.6.24-rc5 "videobuf_read_start" [drivers/media/video/videobuf-dvb.ko] undefined!
Date: Wed, 12 Dec 2007 12:21:56 -0200	[thread overview]
Message-ID: <1197469316.4744.22.camel@gaivota> (raw)
In-Reply-To: <20071212120308.GG14204@stusta.de>

Em Qua, 2007-12-12 às 13:03 +0100, Adrian Bunk escreveu:
> On Wed, Dec 12, 2007 at 09:03:14AM -0200, Mauro Carvalho Chehab wrote:
> >...
> > I'm afraid that this wouldn't avoid this bug, however. 
> > 
> > The removal of the EXPORT_SYMBOL_GPL seemed to be the intention of
> > Brandon, since he renamed the function, removing the locks. I think he
> > didn't noticed that videobuf_dvb were using videobuf_read_start. The
> > patch I've just send fixes it properly.
> 
> At least in the commit in Linus' tree, videobuf_read_start() stayed 
> nearly unchanged.

Hmm... I should have reviewed the patch instead of trusting on my
memory. Yes, you're right. Brandon didn't rename this function.

What happened is that changeset 19bc5133dae9562e8824ef101464061f9854c1d8
fixed some bad locks. 

After this changeset, videobuf_read_stream() holds q->lock and calls
videobuf_read_start(). To avoid waiting forever for the lock to be
released, he removed the mutex from videobuf_read_start with this line
[1]:

-       err = videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR);
+       err = __videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR);

So, after the patch, videobuf_read_start() can't be safely called. So,
just adding EXPORT_SYMBOL_GPL() breaks videobuf-dvb at runtime.

The proper solution is provided by this changeset:
http://git.kernel.org/?p=linux/kernel/git/mchehab/v4l-dvb.git;a=commitdiff;h=19fb1457990b6b7e15586ec7331541a184233acc

This renames the old videobuf_read_start() to __videobuf_read_start()
and adds a newer one to be called externally, that holds the lock,
before calling __videobuf_mmap_setup().

[1] After his changeset, all functions with __foo() don't touch on
q->lock.

-- 
Cheers,
Mauro


  reply	other threads:[~2007-12-12 14:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-12  5:20 Shane
2007-12-12  9:07 ` Adrian Bunk
2007-12-12 11:03   ` Mauro Carvalho Chehab
2007-12-12 12:03     ` Adrian Bunk
2007-12-12 14:21       ` Mauro Carvalho Chehab [this message]
2007-12-12 16:37         ` Shane
2007-12-12 18:57           ` Shane
2007-12-12 19:44             ` [2.6 patch] videobuf-core.c locking fixes Adrian Bunk
2007-12-12 20:35               ` Shane
2007-12-12 21:22                 ` Shane
2007-12-14  9:26                   ` Mauro Carvalho Chehab
2007-12-13  9:59                 ` Mauro Carvalho Chehab
2007-12-12 22:19         ` 2.6.24-rc5 "videobuf_read_start" [drivers/media/video/videobuf-dvb.ko] undefined! Jean Delvare
2007-12-13 10:33           ` Mauro Carvalho Chehab
2007-12-12 10:36 ` Soeren Sonnenburg
2007-12-12 10:51 ` Mauro Carvalho Chehab

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=1197469316.4744.22.camel@gaivota \
    --to=mchehab@infradead.org \
    --cc=brandon@ifup.org \
    --cc=bunk@kernel.org \
    --cc=gnome42@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=video4linux-list@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome