All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: "Sakari Ailus" <sakari.ailus@iki.fi>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
	"Sakari Ailus" <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org, linux-leds@vger.kernel.org
Subject: Re: [RFC 00/19] Async sub-notifiers and how to use them
Date: Wed, 23 Aug 2017 15:29:54 +0300	[thread overview]
Message-ID: <2623469.qW6Q8oGARq@avalon> (raw)
In-Reply-To: <ea92d79c-bba0-ca22-c0a7-0535d635729c@xs4all.nl>

Hi Hans,

On Wednesday, 23 August 2017 12:09:15 EEST Hans Verkuil wrote:
> On 08/04/17 20:25, Sakari Ailus wrote:
> > Niklas Söderlund wrote:
> >> On 2017-07-20 19:14:01 +0300, Sakari Ailus wrote:
> >>> On Wed, Jul 19, 2017 at 01:42:55PM +0200, Hans Verkuil wrote:
> >>>> On 18/07/17 21:03, Sakari Ailus wrote:
> >>>>> Hi folks,
> >>>>> 
> >>>>> This RFC patchset achieves a number of things which I've put to the
> >>>>> same patchset for they need to be show together to demonstrate the use
> >>>>> cases.
> >>>>> 
> >>>>> I don't really intend this to compete with Niklas's patchset but much
> >>>>> of the problem area addressed by the two is the same.
> >>>>> 
> >>>>> Comments would be welcome.
> >>>>> 
> >>>>> - Add AS3645A LED flash class driver.
> >>>>> 
> >>>>> - Add async notifiers (by Niklas).
> >>>>> 
> >>>>> - V4L2 sub-device node registration is moved to take place at the same
> >>>>>   time with the registration of the sub-device itself. With this
> >>>>>   change, sub-device node registration behaviour is aligned with video
> >>>>>   node registration.
> >>>>> 
> >>>>> - The former is made possible by moving the bound() callback after
> >>>>>   sub-device registration.
> >>>>> 
> >>>>> - As all the device node registration and link creation is done as the
> >>>>>   respective devices are probed, there is no longer dependency to the
> >>>>>   notifier complete callback which as itself is seen problematic. The
> >>>>>   complete callback still exists but there's no need to use it,
> >>>>>   pending changes in individual drivers.
> >>>>>   
> >>>>>   See:
> >>>>>   <URL:http://www.spinics.net/lists/linux-media/msg118323.html>
> >>>>>   
> >>>>>   As a result, if a part of the media device fails to initialise
> >>>>>   because it is e.g. physically broken, it will be possible to use
> >>>>>   what works.
> >>>> 
> >>>> I've got major problems with this from a userspace point of view. In
> >>>> the vast majority of cases you just want to bail out if one or more
> >>>> subdevs fail.
> >>>
> >>> I admit it's easier for the user space if the device becomes available
> >>> only when all its component drivers have registered.
> >>> 
> >>> Also remember that video nodes are registered in the file system right
> >>> on device probe time. It's only sub-device and media device node
> >>> registration that has taken place in the notifier's complete handler.
> >> 
> >> Is this always the case? In the R-Car VIN driver I register the video
> >> devices using video_register_device() in the complete handler. Am I
> >> doing things wrong in that driver? I had a patch where I moved the
> >> video_register_device() call to probe time but it got shoot down in
> >> review and was dropped.
> > 
> > I don't think the current implementation is wrong, it's just different
> > from other drivers; there's really no requirement regarding this AFAIU.
> > It's one of the things where no attention has been paid I presume.
> 
> It actually is a requirement: when a device node appears applications can
> reasonably expect to have a fully functioning device. True for any device
> node.

Why not ? I'm not aware of any such kernel-wide requirement. 

> You don't want to have to wait until some unspecified time before the full
> functionality is there.

We certainly should specify that time and give userspace a way to find out 
what is usable and when.

> I try to pay attention to this when reviewing code, since not following this
> rule basically introduces a race condition which is hard to test.
> 
> > However doing anything that can fail earlier on would be nicer since
> > there's no reasonable way to signal an error from complete callback
> > either.
> 
> Right.
> 
> Adding support for cases where devices may not be present is very desirable,
> but this should go through an RFC process first to hammer out all the
> details.
> 
> Today we do not support this and we have to review code with that in mind.
> 
> So the first async subnotifiers implementation should NOT support this
> (although it can of course be designed with this in mind).

I very much disagree. The first async subnotifiers implementation (and I still 
believe we don't need subnotifiers, there's nothing "sub" in them) shall 
support this. If it means we first have to hammer out the details of out it 
will work, so be it.

> Once it is in we can start on an RFC on how to support partial pipelines. I
> have a lot of questions about that that need to be answered first.
> 
> One thing at a time. Trying to do everything at once never works.

Sure, so let's start with probe time device node registration, and then move 
on to subnotifiers.

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2017-08-23 12:29 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18 19:03 [RFC 00/19] Async sub-notifiers and how to use them Sakari Ailus
2017-07-18 19:03 ` [RFC 01/19] device property: Introduce fwnode_property_get_reference_args Sakari Ailus
2017-07-18 19:03 ` [RFC 02/19] v4l: async: add subnotifier registration for subdevices Sakari Ailus
2017-07-18 21:28   ` Niklas Söderlund
2017-07-18 19:03 ` [RFC 03/19] dt: bindings: Add a binding for flash devices associated to a sensor Sakari Ailus
2017-07-18 19:03 ` [RFC 04/19] dt: bindings: Add lens-focus binding for image sensors Sakari Ailus
2017-07-28  8:53   ` Hans Verkuil
2017-07-28 12:45     ` Pavel Machek
2017-08-15 11:24     ` Sakari Ailus
2017-07-18 19:03 ` [RFC 05/19] leds: as3645a: Add LED flash class driver Sakari Ailus
2017-07-19 20:17   ` Jacek Anaszewski
2017-07-19 21:21     ` Sakari Ailus
2017-07-18 19:03 ` [RFC 06/19] leds: as3645a: Separate flash and indicator LED sub-devices Sakari Ailus
2017-07-18 19:03 ` [RFC 07/19] v4l: fwnode: Support generic parsing of graph endpoints in V4L2 Sakari Ailus
2017-07-18 19:03 ` [RFC 08/19] arm: dts: omap3: N9/N950: Add AS3645A camera flash Sakari Ailus
2017-07-18 19:16   ` Sakari Ailus
2017-07-22  9:40   ` Pavel Machek
2017-07-18 19:03 ` [RFC 09/19] v4l2-fwnode: Add conveniences function for parsing generic references Sakari Ailus
2017-07-18 19:03 ` [RFC 10/19] v4l2-fwnode: Add convenience function for parsing common external refs Sakari Ailus
2017-07-18 19:03 ` [RFC 11/19] v4l2-async: Register sub-devices before calling bound callback Sakari Ailus
2017-07-19 11:24   ` Hans Verkuil
2017-07-20 16:09     ` Sakari Ailus
2017-07-20 16:23       ` Hans Verkuil
2017-07-20 19:23         ` Sakari Ailus
2017-07-21  7:14           ` Hans Verkuil
2017-07-20 23:53         ` Kieran Bingham
2017-07-20 23:53           ` Kieran Bingham
2017-07-18 19:03 ` [RFC 12/19] v4l2-subdev: Support registering V4L2 sub-device nodes one by one Sakari Ailus
2017-07-18 19:03 ` [RFC 13/19] v4l2-device: Register sub-device nodes at sub-device registration time Sakari Ailus
2017-07-18 19:03 ` [RFC 14/19] omap3isp: Move sub-device link creation to notifier bound callback Sakari Ailus
2017-07-18 19:03 ` [RFC 15/19] omap3isp: Initialise "crashed" media entity enum in probe Sakari Ailus
2017-07-18 19:03 ` [RFC 16/19] omap3isp: Move media device registration to probe Sakari Ailus
2017-07-18 19:03 ` [RFC 17/19] omap3isp: Drop the async notifier callback Sakari Ailus
2017-07-18 19:04 ` [RFC 18/19] v4l2-fwnode: Add abstracted sub-device notifiers Sakari Ailus
2017-07-18 21:19   ` Niklas Söderlund
2017-07-19 22:20     ` Sakari Ailus
2017-07-19 22:33     ` [RFC 1/1] v4l2-subdev: Add a function to set sub-device notifier callbacks Sakari Ailus
2017-07-26 17:48       ` Mauro Carvalho Chehab
2017-07-18 19:04 ` [RFC 19/19] smiapp: Add support for flash and lens devices Sakari Ailus
2017-07-19 11:42 ` [RFC 00/19] Async sub-notifiers and how to use them Hans Verkuil
2017-07-20 16:14   ` Sakari Ailus
2017-07-21  6:57     ` Niklas Söderlund
2017-08-04 18:25       ` Sakari Ailus
2017-08-23  9:09         ` Hans Verkuil
2017-08-23 11:34           ` Pavel Machek
2017-08-23 12:02             ` Hans Verkuil
2017-08-23 12:29           ` Laurent Pinchart [this message]
2017-08-23 15:40             ` Hans Verkuil
2017-08-23 12:59           ` Niklas Söderlund
2017-08-23 13:32             ` Laurent Pinchart
2017-08-23 15:23               ` 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=2623469.qW6Q8oGARq@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=sakari.ailus@iki.fi \
    --cc=sakari.ailus@linux.intel.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.