All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hans Verkuil" <hverkuil@xs4all.nl>
To: "Arnd Bergmann" <arnd@arndb.de>
Cc: "Mauro Carvalho Chehab" <mchehab@redhat.com>,
	linux-media@vger.kernel.org
Subject: Re: [RFC PATCH 0/8] V4L BKL removal: first round
Date: Tue, 16 Nov 2010 16:30:29 +0100	[thread overview]
Message-ID: <ebc68dfa756290569c3905a79175f65a.squirrel@webmail.xs4all.nl> (raw)
In-Reply-To: <ccc5d34bc1daa662da4af75127256505.squirrel@webmail.xs4all.nl>


>
>> On Tuesday 16 November 2010, Hans Verkuil wrote:
>>> A pointer to this struct is available in vdev->v4l2_dev. However, not
>>> all
>>> drivers implement struct v4l2_device. But on the other hand, most
>>> relevant
>>> drivers do. So as a fallback we would still need a static mutex.
>>
>> Wouldn't that suffer the same problem as putting the mutex into videodev
>> as I suggested? You said that there are probably drivers that need to
>> serialize between multiple devices, so if we have a mutex per
>> v4l2_device,
>> you can still get races between multiple ioctl calls accessing the same
>> per-driver data. To solve this, we'd have to put the lock into a
>> per-driver
>> structure like v4l2_file_operations or v4l2_ioctl_ops, which would add
>> to the ugliness.
>
> I think there is a misunderstanding. One V4L device (e.g. a TV capture
> card, a webcam, etc.) has one v4l2_device struct. But it can have multiple
> V4L device nodes (/dev/video0, /dev/radio0, etc.), each represented by a
> struct video_device (and I really hope I can rename that to v4l2_devnode
> soon since that's a very confusing name).
>
> You typically need to serialize between all the device nodes belonging to
> the same video hardware. A mutex in struct video_device doesn't do that,
> that just serializes access to that single device node. But a mutex in
> v4l2_device is at the right level.

A quick follow-up as I saw I didn't fully answer your question: to my
knowledge there are no per-driver data structures that need a BKL for
protection. It's definitely not something I am worried about.

Regards,

         Hans

-- 
Hans Verkuil - video4linux developer - sponsored by Cisco


  reply	other threads:[~2010-11-16 15:30 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-14 13:21 [RFC PATCH 0/8] V4L BKL removal: first round Hans Verkuil
2010-11-14 13:22 ` [RFC PATCH 1/8] v4l2-dev: use mutex_lock_interruptible instead of plain mutex_lock Hans Verkuil
2010-11-14 13:22 ` [RFC PATCH 2/8] BKL: trivial BKL removal from V4L2 radio drivers Hans Verkuil
2010-11-14 13:22 ` [RFC PATCH 3/8] cadet: use unlocked_ioctl Hans Verkuil
2010-11-14 13:22 ` [RFC PATCH 4/8] tea5764: convert to unlocked_ioctl Hans Verkuil
2010-11-14 13:22 ` [RFC PATCH 5/8] si4713: " Hans Verkuil
2010-11-14 13:22 ` [RFC PATCH 6/8] typhoon: " Hans Verkuil
2010-11-14 13:23 ` [RFC PATCH 7/8] dsbr100: " Hans Verkuil
2010-11-14 13:23 ` [RFC PATCH 8/8] BKL: trivial ioctl -> unlocked_ioctl video driver conversions Hans Verkuil
2010-11-14 21:53 ` [RFC PATCH 0/8] V4L BKL removal: first round Arnd Bergmann
2010-11-14 22:48   ` Hans Verkuil
2010-11-15  9:17     ` Arnd Bergmann
2010-11-15  9:49       ` Hans Verkuil
2010-11-16 12:19         ` Mauro Carvalho Chehab
2010-11-16 12:35           ` Hans Verkuil
2010-11-16 13:06             ` Mauro Carvalho Chehab
2010-11-16 13:20               ` Hans Verkuil
2010-11-16 14:22                 ` Arnd Bergmann
2010-11-16 14:50                   ` Hans Verkuil
2010-11-16 15:13                     ` Arnd Bergmann
2010-11-16 15:27                       ` Hans Verkuil
2010-11-16 15:30                         ` Hans Verkuil [this message]
2010-11-16 16:01                           ` Arnd Bergmann
2010-11-16 16:32                             ` Mauro Carvalho Chehab
2010-11-16 16:49                             ` Hans Verkuil
2010-11-16 18:38                               ` Hans Verkuil
2010-11-16 19:23                                 ` Arnd Bergmann
2010-11-16 19:59                                 ` Andy Walls
2010-11-16 20:29                                   ` Hans Verkuil
2010-11-16 21:10                                     ` Hans Verkuil
2010-11-16 21:32                                       ` David Ellingsworth
2010-11-16 21:42                                         ` Hans Verkuil
2010-11-17 15:36                                           ` David Ellingsworth

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=ebc68dfa756290569c3905a79175f65a.squirrel@webmail.xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=arnd@arndb.de \
    --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.