From: Andy Walls <awalls@md.metrocast.net>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
linux-media@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>
Subject: Re: RFC: BKL, locking and ioctls
Date: Sun, 19 Sep 2010 15:05:46 -0400 [thread overview]
Message-ID: <1284923146.2079.83.camel@morgan.silverblock.net> (raw)
In-Reply-To: <4C95F76F.9090103@redhat.com>
On Sun, 2010-09-19 at 08:43 -0300, Mauro Carvalho Chehab wrote:
> Hi Hans,
>
> A per-dev lock may not be good on devices where you have lots of interfaces, and that allows
> more than one stream per interface.
>
> So, I did a different implementation, implementing the mutex pointer per file handler.
> On devices that a simple lock is possible, all you need to do is to use the same locking
> for all file handles, but if drivers want a finer control, they can use a per-file handler
> lock.
>
> I'm adding the patches I did at media-tree.git. I've created a separate branch there (devel/bkl):
> http://git.linuxtv.org/media_tree.git?a=shortlog;h=refs/heads/devel/bkl
>
> I've already applied there the other BKL-lock removal patches I've sent before, plus one new
> one, fixing a lock unbalance at bttv poll function (changeset 32d1c90c85).
>
> The v4l2 core patches are at:
>
> http://git.linuxtv.org/media_tree.git?a=commit;h=285267378581fbf852f24f3f99d2e937cd200fd5
> http://git.linuxtv.org/media_tree.git?a=commit;h=5f7b2159c87b08d4f0961c233a2d1d1b87c8b38d
>
> The approach I took serializes open, close, ioctl, mmap, read and poll, e. g. all file operations
> done by the V4L devices.
Hi Mauro,
I took a look at your changes in the first link. The approach seems
like it serializes too much for one fd, and not enough for multiple fd's
opened on the same device node.
for a single fd, ioctl() probably doesn't need to be serialized against
read() and poll() at all - at least for drivers that only provide the
read I/O method.
read() and poll() on the same device node in most cases can access to
shared data structure in kernel using test_bit() and atomic_read().
poll() usually just needs to check if a count is > 0 in some incoming
buffer count or incoming byte count somewhere, right?
Multiple opens of the device node (e.g one fd for streaming, one fd for
control) is what MythTV does, so the locking on a per fd basis doesn't
work there.
Regards,
Andy
next prev parent reply other threads:[~2010-09-19 19:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-19 10:29 RFC: BKL, locking and ioctls Hans Verkuil
2010-09-19 11:43 ` Mauro Carvalho Chehab
2010-09-19 14:58 ` Hans Verkuil
2010-09-19 18:29 ` Mauro Carvalho Chehab
2010-09-19 19:06 ` Hans Verkuil
2010-09-19 20:20 ` Mauro Carvalho Chehab
2010-09-19 21:02 ` Andy Walls
2010-09-19 21:17 ` Hans Verkuil
2010-09-20 0:19 ` Devin Heitmueller
2010-09-19 21:10 ` Hans Verkuil
2010-09-20 2:47 ` Mauro Carvalho Chehab
2010-09-19 19:05 ` Andy Walls [this message]
2010-09-19 19:26 ` Mauro Carvalho Chehab
-- strict thread matches above, loose matches on Subject: below --
2010-09-19 15:38 Andy Walls
2010-09-19 16:10 ` Hans Verkuil
2010-09-19 18:08 ` Mauro Carvalho Chehab
2010-09-19 18:38 ` Andy Walls
2010-09-19 19:10 ` Mauro Carvalho Chehab
2010-09-19 19:38 ` Hans Verkuil
2010-09-19 19:45 ` Hans Verkuil
2010-09-19 19:57 ` Andy Walls
2010-09-19 20:51 ` Mauro Carvalho Chehab
2010-09-20 1:52 ` Mauro Carvalho Chehab
2010-09-20 6:33 ` Hans Verkuil
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=1284923146.2079.83.camel@morgan.silverblock.net \
--to=awalls@md.metrocast.net \
--cc=arnd@arndb.de \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.