mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@kernel.org>
To: Hans Verkuil <hverkuil+cisco@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Michael Riesch <michael.riesch@collabora.com>,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 0/5] media: Fault-Tolerant V4L2
Date: Thu, 26 Nov 2026 16:51:22 +0100	[thread overview]
Message-ID: <xhkdbzeuvy4jp.fsf@mkorpers-koolstof.csb> (raw)
In-Reply-To: <3066a335-12b9-4031-84bf-af851c8e03c0@kernel.org>

Hi Hans,

On Thu, Nov 12, 2026 at 13:43, Hans Verkuil <hverkuil+cisco@kernel.org> wrote:

> On 12/11/2026 12:07, Sakari Ailus wrote:
>> Hi Hans, others,
>> 
>> On Tue, Nov 10, 2026 at 03:43:59PM +0100, Hans Verkuil wrote:
>>> On 10/11/2026 15:17, Maxime Ripard wrote:
>>>> On Tue, Nov 10, 2026 at 02:30:51PM +0100, Hans Verkuil wrote:
>>>>> On 10/11/2026 13:33, Maxime Ripard wrote:
>>>>>> Hi Hans,
>>>>>>
>>>>>> On Tue, Nov 10, 2026 at 01:08:05PM +0100, Hans Verkuil wrote:
>>>>>>> On 23/10/2026 14:26, Mattijs Korpershoek wrote:
>>>>>>>> Hi everyone,
>>>>>>>>
>>>>>>>> On Thu, Oct 01, 2026 at 14:55, Mattijs Korpershoek <mkorpershoek@kernel.org> wrote:
>>>>>>>>
>>>>>>>>> On media-centric camera pipelines, every entity is known at boot time
>>>>>>>>> and described statically (for example via device-tree).
>>>>>>>>>
>>>>>>>>> The V4L2 framework assumes that every entity of the camera
>>>>>>>>> pipeline is always present. This is a reasonable assumption for
>>>>>>>>> integrated cameras in laptops or phones. However, in automotive systems,
>>>>>>>>> cameras (e.g. rear-view or surround-view) can be damaged or disconnected.
>>>>>>>>> When the framework assumes all sensors are present, a single missing
>>>>>>>>> camera can prevent the entire pipeline from operating.
>>>>>>>>
>>>>>>>> This series has been discussed at the Camera & ISP "unconference" in
>>>>>>>> Pragues (during Linux Plumbers)
>>>>>>>>
>>>>>>>> The notes can be found here:
>>>>>>>> https://lore.kernel.org/linux-media/20261021224119.GA383235@killaraus.ideasonboard.com/T/#u
>>>>>>>
>>>>>>> What is missing in this discussion is how userspace can indicate that it
>>>>>>> actually can handle partially instantiated pipelines.
>>>>>>>
>>>>>>> Today if one or more parts do not come up, the devices nodes are also not
>>>>>>> created. This is typically exactly what you want.
>>>>>>
>>>>>> That's very arguable? We have plenty of other examples where we allow to
>>>>>> show a software representation of something that isn't available in
>>>>>> hardware, starting with virtually any memory buffer allocation, but also
>>>>>> disabled CPUs, swapped pages, etc.
>>>>>>
>>>>>> For things a bit more related to drivers, things like USB root hubs are
>>>>>> also pretty analogous. The "root" device will always be created, even if
>>>>>> devices connected to it are non-functional, missing or whatever. It's
>>>>>> the primary interface that these devices might or might not attach to.
>>>>>>
>>>>>> So it's a bit hard to understand why the device nodes not showing up is
>>>>>> exactly what we always want.
>>>>>
>>>>> It's simply how V4L2 works today: video devices do not appear until
>>>>> all components are instantiated.
>> 
>> I think I've mentioned this before, but I do it once more: there's no
>> concept of creating device nodes at the same time. It may happen roughly
>> around the same time, but not atomically. There's always a chance that
>> accessing device nodes of a device exposing multiple nodes fails for a
>> reason or another. It may also be udev rules used different permissions for
>> different set of nodes so the application can only access some of them.
>
> That's why the media device should ideally be the last device that is
> registered. I think that is usually the case.
>
> But even then, when e.g. em28xx creates the video device for video capture,
> it can be used right away. Everything it depends on is there.
>
>> 
>>>>
>>>> Sure but that's exactly what we're trying to change.
>>>>
>>>>> Most video devices consist of multiple devices (bridges, i2c devices,
>>>>> etc.) and unless all are found and initialized, you can't capture. So
>>>>> bridge drivers postpone creating the video/media devices until
>>>>> everything is there.
>> 
>> That's not the case obviously. If you have, say, three different cameras
>> and one of them happens to be missing a driver in Kconfig, there's nothing
>> that would technically prevent streaming video from the two others: it's a
>> policy.
>
> But in that case you wouldn't create the third video device for the missing
> driver. It's up to the bridge driver to decide whether to bail out if that
> driver can't be found, or continue with the others and just skip that video
> device.
>
>> 
>> And supposedly, there could be an application that *needs* all these three
>> cameras to function, but does it then matter how that application is going
>> to fail, is it because it lacks access to all of the hardware or just one
>> piece of it?
>
> That's up to the application. That's not relevant for this discussion.
> What is relevant is that today, if a video device is registered, then it is
> functional. The application can assume that everything it depends on is there.
>
> And applications really do this: the video device appears and they start
> streaming at once.
>
>> 
>> I'm in favour for making this reasonably easy for the user space to figure
>> out, but we currently have no APIs that cover this (and so could be used by
>> existing applications) so it's new behaviour that we're introducing. If we
>> can't do better, then I'd introduce a Kconfig option, but I'd select that
>> by default. I've seen tonnes of issues because of the current behaviour but
>> no evidence creating device nodes proactively could be actually harmful.
>> 
>> So what I'd concentrate on is to provide information to the userspace on
>> the device readiness status, so the userspace can figure out all devices in
>> a Media device complex have been registered.
>> 
>> Functional safety adds the requirement of detecting failures and how that
>> is being done is probably fairly implementation specific. New APIs will
>> very probably be needed for that as well (and they indeed should be behind
>> a specific Kconfig option).
>
> Remember that there are more devices than just ISPs that use the MC: codecs,
> various video capture drivers. Typically the MC is there primarily to help
> understand the hardware, and the topology is usually (but not always) fixed.
>
> Applications usually ignore the MC and just open a video device to start
> streaming.
>
>> 
>>>>>
>>>>> That also means that applications can safely assume that if a video device appears,
>>>>> it is functioning.
>>>>
>>>> Ish. The only safe assumption you can make about this is that it was
>>>> functional at probe time. Anything after that is very much up in the
>>>> air. If the device broken after probe for example, or if we have no way
>>>> to tell if it's functional to begin with, that assumption is no longer
>>>> true. So sure, that's what applications have been doing so far because
>>>> there was no better way to do it, but I wouldn't qualify it as a "safe"
>>>> assumption.
>>>>
>>>>> If we add fault tolerance, and you allow video devices to appear even if they are
>>>>> not functioning (or partially functioning), then that contract breaks.
>>>>>
>>>>>>
>>>>>>> But here you allow partial instantiation, and how does userspace
>>>>>>> signal that? It must be an 'opt-in' mechanism, but how is that done?
>>>>>>> There are no devices yet, so that can't be used, so what alternatives
>>>>>>> are there?
>>>>>>>
>>>>>>> We've been discussion Fault Tolerant V4L2 for many years now, and every time
>>>>>>> I raise this issue, but I never received any proposals.
>>>>>>>
>>>>>>> This must be solved.

Thank you for explaining this.
Sorry you had to repeat yourself

I've added an 'opt-in' mechanism for v2 RFC using a module parameter
here:

https://lore.kernel.org/all/20261118-v4l2-sensor-detect-v2-0-1bb1a445b556@kernel.org/

And thanks everyone for the discussion, I hope we can continue on the v2

Regards
Mattijs


  reply	other threads:[~2026-11-26 15:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 12:55 Mattijs Korpershoek
2026-10-01 12:55 ` [PATCH RFC 1/5] media: imx219: Move LP-11 state switch to power_on() Mattijs Korpershoek
2026-10-01 17:03   ` Dave Stevenson
2026-10-01 12:55 ` [PATCH RFC 2/5] media: v4l2-subdev: Add new ioctl for connection status Mattijs Korpershoek
2026-10-02  7:13   ` Sakari Ailus
2026-10-02  8:53     ` Mattijs Korpershoek
2026-10-01 12:55 ` [PATCH RFC 3/5] media: imx219: Allow driver probe with missing sensor Mattijs Korpershoek
2026-10-01 16:50   ` Dave Stevenson
2026-10-01 17:35     ` Dave Stevenson
2026-10-02 12:21       ` Mattijs Korpershoek
2026-10-01 12:55 ` [PATCH RFC 4/5] media: imx219: Implement .detect() sensor operation Mattijs Korpershoek
2026-10-01 12:55 ` [PATCH RFC 5/5] media: imx219: Add status polling using .detect() Mattijs Korpershoek
2026-10-01 15:58   ` Dave Stevenson
2026-10-01 17:26     ` Dave Stevenson
2026-10-02  8:39       ` Mattijs Korpershoek
2026-10-02  7:21     ` Sakari Ailus
2026-10-02  8:45       ` Mattijs Korpershoek
2026-10-02  8:32     ` Mattijs Korpershoek
2026-10-23 12:26 ` [PATCH RFC 0/5] media: Fault-Tolerant V4L2 Mattijs Korpershoek
2026-11-10 12:08   ` Hans Verkuil
2026-11-10 12:33     ` Maxime Ripard
2026-11-10 13:30       ` Hans Verkuil
2026-11-10 14:17         ` Maxime Ripard
2026-11-10 14:43           ` Hans Verkuil
2026-11-12 11:07             ` Sakari Ailus
2026-11-12 12:43               ` Hans Verkuil
2026-11-26 15:51                 ` Mattijs Korpershoek [this message]
2026-11-12 16:44             ` Maxime Ripard

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=xhkdbzeuvy4jp.fsf@mkorpers-koolstof.csb \
    --to=mkorpershoek@kernel.org \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=michael.riesch@collabora.com \
    --cc=mripard@kernel.org \
    --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 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®