public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
	Jonathan Corbet <corbet@lwn.net>,
	linux-media@vger.kernel.org,
	Florian Tobias Schandinat <FlorianSchandinat@gmx.de>,
	Daniel Drake <dsd@laptop.org>
Subject: Re: [PATCH] viafb camera controller driver
Date: Tue, 19 Oct 2010 12:49:25 -0200	[thread overview]
Message-ID: <4CBDAFF5.1090509@infradead.org> (raw)
In-Reply-To: <201010191505.04436.laurent.pinchart@ideasonboard.com>

Em 19-10-2010 11:05, Laurent Pinchart escreveu:
> Hi Mauro,
> 
>> It is not a "big lock": it doesn't stop other CPU's, doesn't affect other
>> hardware, not even another V4L device. Basically, what this new lock does
>> is to serialize access to the hardware and to the hardware-mirrored data.
> 
> The lock serializes all ioctls. That's much more than protecting access to 
> data (both in system memory and in the hardware).

It is not much more. What ioctl's doesn't access the hardware directly nor access
some struct that caches the hardware data? None, at the most complex devices.

For simpler devices, there are very few VIDIOC*ENUM stuff that may just return
a fixed set of values, but the userspace applications that call them serializes 
the access anyway (as they are the enum ioctls, used during the hardware detection 
phase of the userspace software).

So, in practice, it makes no difference to serialize everything or to remove
the lock for the very few ioctls that just return a fixed set of info.

>> There are basically several opinions about this new schema: some that think
>> that this is the right thing to do, others think that think that this is
>> the wrong thing or that this is acceptable only as a transition for
>> BKL-free drivers.
> 
> Indeed, and I belong to the second group.

And Hans belong to the first one.

>> IMO, I think that both ways are acceptable: a core-assisted
>> "hardware-access lock" helps to avoid having lots of lock/unlock code at
>> the driver, making drivers cleaner and easier to review, and reducing the
>> risk of lock degradation with time. On the other hand, some drivers may
>> require more complex locking schemas, like, for example, devices that
>> support several simultaneous independent video streams may have some
>> common parts used by all streams that need to be serialized, and other
>> parts that can (and should) not be serialized. So, a core-assisted locking
>> for some cases may cause unneeded long waits.

I am in a position between the first and the second group.

Reviewing locks is simpler with the new schema, and, if well implemented, it
will help to solve a big problem, but I don't believe that this schema is enough
to solve all cases, nor that drivers with lots of independent streams should
use it.

Cheers,
Mauro

  parent reply	other threads:[~2010-10-19 14:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-10 22:23 [PATCH] viafb camera controller driver Jonathan Corbet
2010-10-11 12:09 ` Mauro Carvalho Chehab
2010-10-11 12:18 ` Laurent Pinchart
2010-10-11 15:30   ` Jonathan Corbet
2010-10-11 23:20     ` Laurent Pinchart
2010-10-16 13:44 ` Mauro Carvalho Chehab
2010-10-18 13:25   ` Jonathan Corbet
2010-10-19  3:20   ` Jonathan Corbet
2010-10-19  6:54     ` Hans Verkuil
2010-10-19  7:52       ` Laurent Pinchart
2010-10-19 10:46         ` Mauro Carvalho Chehab
2010-10-19 13:05           ` Laurent Pinchart
2010-10-19 14:04             ` Hans Verkuil
2010-10-19 14:21               ` Hans Verkuil
2010-10-19 14:49             ` Mauro Carvalho Chehab [this message]
2010-10-19 14:52               ` Laurent Pinchart
2010-10-19 15:42                 ` Mauro Carvalho Chehab
2010-10-20 19:23       ` ext_lock (was viafb camera controller driver) Jonathan Corbet
2010-10-21  2:57         ` Mauro Carvalho Chehab
2010-10-21  6:51         ` 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=4CBDAFF5.1090509@infradead.org \
    --to=mchehab@infradead.org \
    --cc=FlorianSchandinat@gmx.de \
    --cc=corbet@lwn.net \
    --cc=dsd@laptop.org \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.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