mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Alan Cox <alan@redhat.com>
Cc: video4linux-list@redhat.com, linux-kernel@vger.kernel.org,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] video4linux: Push down the BKL
Date: Tue, 27 May 2008 10:10:39 -0300	[thread overview]
Message-ID: <20080527101039.1c0a3804@gaivota> (raw)
In-Reply-To: <20080526220154.GA15487@devserv.devel.redhat.com>

On Mon, 26 May 2008 18:01:54 -0400
Alan Cox <alan@redhat.com> wrote:

> On Mon, May 26, 2008 at 06:10:27PM -0300, Mauro Carvalho Chehab wrote:
> > The hardest and optimal scenario is to look inside all drivers, fix the locks
> > (and pray for a further patch to not break them). I'm afraid that this is a long
> > term strategy.
> 
> Ultimately that is where you end up.

Agreed.

> > For example, a very simple scenario would simply replace BKL by one mutex.
> > This way, just one ioctl could be handled at the same time. This is something
> 
> video2_ioctl_serialized() ?

Hmm... it maybe an interesting interim solution to create such function, and
moving the drivers to it.

What if we create 3 functions:

video_ioctl2_bkl()
video_ioctl2_serialized()
video_ioctl2_unlocked()

The first patch will point .ioctl_unlock to video_ioctl2_bkl. 

A next step would be to move the drivers to use the serialized one. I suspect
that this will work properly on all devices that are using video_ioctl2, if
the videobuf locks are now 100% ok. So, it is just a matter of doing some stress
tests. We may start with vivi, since we have a complete domain on what this
driver is doing (e.g. no hardware surprises).

After having all those drivers using the _serialized() one, we can remove the bkl.

Then, we can focus on properly fixing the locks inside the drivers, and moving
one by one to video_ioctl2_unlocked.

IMO, we need to create a multi-thread stress userspace tool for checking the
locks at the ioctls. There are a few testing utils at mercurial tree, under
v4l2-apps/test. This can be a starting point for this tool. Also, Brandon
improved one of those tools to work with multithread.

What do you think?

Cheers,
Mauro

  reply	other threads:[~2008-05-27 13:11 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22 21:37 Alan Cox
2008-05-23  2:08 ` Andy Walls
2008-05-23  6:16   ` Hans Verkuil
2008-05-23  6:28     ` Hans Verkuil
2008-05-26 16:39     ` Mauro Carvalho Chehab
2008-05-23  9:09   ` Alan Cox
2008-05-26 16:34     ` Mauro Carvalho Chehab
2008-05-26 16:46       ` Hans Verkuil
2008-05-26 21:14         ` Mauro Carvalho Chehab
2008-05-23 13:56 ` Jonathan Corbet
2008-05-23 15:39   ` Alan Cox
2008-05-23 16:09     ` Jonathan Corbet
2008-05-23 18:58       ` Alan Cox
2008-05-23 19:05 ` Hans Verkuil
2008-05-25 23:46 ` Mike Isely
2008-05-26 16:59 ` Mauro Carvalho Chehab
2008-05-26 20:23   ` Alan Cox
2008-05-26 21:10     ` Mauro Carvalho Chehab
2008-05-26 22:01       ` Alan Cox
2008-05-27 13:10         ` Mauro Carvalho Chehab [this message]
2008-05-27 15:41           ` Jonathan Corbet
2008-05-27 16:31             ` Mauro Carvalho Chehab
2008-05-27 16:37               ` Jonathan Corbet
2008-05-27 18:59                 ` Mauro Carvalho Chehab
2008-05-27 19:26                   ` Devin Heitmueller
2008-05-27 21:00                     ` Mauro Carvalho Chehab
2008-05-27 21:22                       ` Devin Heitmueller
2008-05-27 23:48                       ` Andy Walls
2008-05-28  0:46                         ` Devin Heitmueller
2008-05-28  2:37                           ` Andy Walls
2008-05-28  2:47                             ` Devin Heitmueller
2008-05-28  8:34                             ` Alan Cox
2008-05-28  6:13                           ` Hans Verkuil
2008-05-27 19:50                   ` Arjan van de Ven
2008-05-27 20:24                     ` Mauro Carvalho Chehab
2008-05-27 18:14               ` Alan Cox

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=20080527101039.1c0a3804@gaivota \
    --to=mchehab@infradead.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=alan@redhat.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

all inboxes | Powered by JetHome®