public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>, John Kacur <jkacur@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Jan Blunck <jblunck@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Greg KH <gregkh@suse.de>,
	Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH 0/5] Pushdown bkl from v4l ioctls
Date: Sat, 1 May 2010 16:58:50 +0200	[thread overview]
Message-ID: <20100501145848.GA5353@nowhere> (raw)
In-Reply-To: <201005011155.37057.hverkuil@xs4all.nl>

On Sat, May 01, 2010 at 11:55:37AM +0200, Hans Verkuil wrote:
> On Thursday 29 April 2010 09:10:42 Laurent Pinchart wrote:
> > Hi Hans,
> > 
> > On Thursday 29 April 2010 08:44:29 Hans Verkuil wrote:
> > > On Thursday 29 April 2010 05:42:39 Frederic Weisbecker wrote:
> > > > Hi,
> > > > 
> > > > Linus suggested to rename struct v4l2_file_operations::ioctl
> > > > into bkl_ioctl to eventually get something greppable and make
> > > > its background explicit.
> > > > 
> > > > While at it I thought it could be a good idea to just pushdown
> > > > the bkl to every v4l drivers that have an .ioctl, so that we
> > > > actually remove struct v4l2_file_operations::ioctl for good.
> > > > 
> > > > It passed make allyesconfig on sparc.
> > > > Please tell me what you think.
> > > 
> > > I much prefer to keep the bkl inside the v4l2 core. One reason is that I
> > > think that we can replace the bkl in the core with a mutex. Still not
> > > ideal of course, so the next step will be to implement proper locking in
> > > each driver. For this some additional v4l infrastructure work needs to be
> > > done. I couldn't proceed with that until the v4l events API patches went
> > > in, and that happened yesterday.
> > > 
> > > So from my point of view the timeline is this:
> > > 
> > > 1) I do the infrastructure work this weekend. This will make it much easier
> > > to convert drivers to do proper locking. And it will also simplify
> > > v4l2_priority handling, so I'm killing two birds with one stone :-)
> > > 
> > > 2) Wait until Arnd's patch gets merged that pushes the bkl down to
> > > v4l2-dev.c
> > > 
> > > 3) Investigate what needs to be done to replace the bkl with a v4l2-dev.c
> > > global mutex. Those drivers that call the bkl themselves should probably be
> > > converted to do proper locking, but there are only about 14 drivers that do
> > > this. The other 60 or so drivers should work fine if a v4l2-dev global lock
> > > is used. At this point the bkl is effectively removed from the v4l
> > > subsystem.
> > > 
> > > 4) Work on the remaining 60 drivers to do proper locking and get rid of the
> > > v4l2-dev global lock. This is probably less work than it sounds.
> > > 
> > > Since your patch moves everything down to the driver level it will actually
> > > make this work harder rather than easier. And it touches almost all drivers
> > > as well.
> > 
> > Every driver will need to be carefully checked to make sure the BKL can be 
> > replaced by a v4l2-dev global mutex. Why would it be more difficult to do so 
> > if the BKL is pushed down to the drivers ?
> 
> The main reason is really that pushing the bkl into the v4l core makes it
> easier to review. I noticed for example that this patch series forgot to change
> the video_ioctl2 call in ivtv-ioctl.c to video_ioctl2_unlocked. And there may
> be other places as well that were missed. Having so many drivers changed also
> means a lot of careful reviewing.


Indeed, that's because I did it in a half automated way and my script
didn't took the direct calls to video_ioctl2() into account, so I had
to check them manually and probably missed a few, I will fix this one and
double check.


> 
> But I will not block this change. However, I do think it would be better to
> create a video_ioctl2_bkl rather than add a video_ioctl2_unlocked. The current
> video_ioctl2 function *is* already unlocked. So you are subtle changing the
> behavior of video_ioctl2. Not a good idea IMHO. And yes, grepping for
> video_ioctl2_bkl is also easy to do and makes it more obvious that the BKL is
> used in drivers that call this.


Totally agreed, will respin with this rename.

Thanks.


  parent reply	other threads:[~2010-05-01 16:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <alpine.LFD.2.00.1004280750330.3739@i5.linux-foundation.org>
2010-04-29  3:42 ` [PATCH 0/5] Pushdown bkl from v4l ioctls Frederic Weisbecker
2010-04-29  6:44   ` Hans Verkuil
2010-04-29  7:10     ` Laurent Pinchart
2010-04-29  7:38       ` Arnd Bergmann
2010-05-01  9:55       ` Hans Verkuil
2010-05-01 10:47         ` Arnd Bergmann
2010-05-01 14:58         ` Frederic Weisbecker [this message]
2010-05-01 11:11     ` Alan Cox
2010-04-29  3:42 ` [PATCH 1/5] v4l: Pushdown bkl into video_ioctl2 Frederic Weisbecker
2010-04-29  3:42 ` [PATCH 2/5] v4l: Use video_ioctl2_unlocked from drivers that don't want the bkl Frederic Weisbecker
2010-04-29  3:42 ` [PATCH 3/5] v4l: Change users of video_ioctl2 to use unlocked_ioctl Frederic Weisbecker
2010-04-29  3:42 ` [PATCH 4/5] v4l: Pushdown bkl to drivers that implement their own ioctl Frederic Weisbecker

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=20100501145848.GA5353@nowhere \
    --to=fweisbec@gmail.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@suse.de \
    --cc=hverkuil@xs4all.nl \
    --cc=jblunck@gmail.com \
    --cc=jkacur@redhat.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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