Re: [PATCH RFC v2 00/16] media: Fault-Tolerant V4L2

From: Hans Verkuil

Date: Fri Dec 04 2026 - 09:02:32 EST


On 04/12/2026 14:12, Michael Riesch wrote:
> Hi Mattijs and Hans,
>
> Thanks for this interesting work.
>
> If I may chime in here:
>
> On 12/3/26 11:36, Hans Verkuil wrote:
>> [...]
>>> This has been tested on a SK-AM69 board on top of the following series:
>>> * https://lore.kernel.org/all/20260824121451.3348583-1-sakari.ailus@xxxxxxxxxxxxxxx/
>>> * https://lore.kernel.org/all/20261104-j721e-csi2rx-crash-sd-enable-streams-v1-1-b77ee38c8dcf@xxxxxxxxxx/
>>
>> Sorry for the late reply, I was ill for a bit, then very busy.
>>
>> So what I really want to see is an RFC post explaining the outlines of how this
>> feature is designed.
>>
>> So not a patch series, that comes next. Just a high-level design document. And not
>> just explaining the design, but also the reasons for making the choices that went
>> into that design. I.e.: 'I decided to choose this method, because...'.
>>
>> The cover letter goes some way into that direction, but it is lacking the reasoning
>> behind the choices. It also seems geared towards failing sensors. But what if a CSI
>> bridge fails? A camera flash chip? A lens driver?
>>
>> A practical real-life example is also with FPGA devices where part of the video pipeline
>> is implemented inside the FPGA. What happens if the FPGA is unloaded, for example to
>> save power when the device goes into standby? Can this uAPI be used to signal that it is
>> gone, and when the FPGA is reloaded later, that it is back?
>>
>> In other words, think big. And it is fine if we decide not to support certain use-cases,
>> either 'at all' or 'not yet'. But what I want to see is that someone thought about it.
>>
>> I have loads of questions: what about critical devices that must be present for the
>> device to work? Who decides what is critical and what failures can be tolerated? If a
>> device does not come up, how long do you wait before deciding it is broken? Can that
>> be implemented in the media core or is that userspace that decides?
>
> With any recent camera/video capture hardware there are several
> different use cases with different hardware requirements. To make this
> future proof, we need to accept that only the user space knows which
> devices are relevant and what (if any) the plan B is when plan A does
> not have all the hardware it requires.
>
> If we accept the above, we don't have to try to be super smart about
> which device is relevant in the kernel. All the kernel can do (and
> should do) is offer the available hardware (where the availability
> status may be distinguished, e.g., "present in DT + module loaded",
> "hardware actually present", ...) and notify the user space about any
> changes. Anything hardware related is still the kernel's job.
>
> With this in mind, the answers to your questions are
> - The kernel does not distinguish between critical and uncritical
> devices.
> - User space.
> - This likely depends on the hardware and thus is up to the device
> driver.
> - User space.
>
>> What happens when a device breaks after bring up: who decides when it is broken? And
>> what can be tolerated and what failure is critical?
>
> - The device driver.
> - This likely depends on the use case and thus is up to the user space.
>
>> And of course how to enable this mechanism. You chose a module parameter for the
>> mc module, but that will enable it for all drivers that use the mc. I don't think
>> that's right. It should be specific to the top-level bridge driver. A module parameter
>> for that driver makes sense, and it can pass that on to the media device when it is
>> created.
>
> Looking at the current situation, I would agree that this should be
> something specific to the media device. Which AFAIK corresponds to the
> "top-level bridge driver".
>
> However, please let us stop thinking about such a top-level bridge. The
> assumption that there is always a thing like that in any recent hardware
> does not hold. What entity would be the top-level bridge driver in e.g.
> the RK3588 VICAP/ISP hardware? See the shared media controller
> discussion that we had in Nice earlier this year. Let's expect e.g. the
> rkcif driver and the rkisp2 driver to share a media device in the
> future. Which module param would win in this case?
>
> Let us hide this behind a module parameter for MC, or a kernel config
> option, or both. Default to non-tolerant behavior, naturally. And if
> someone enables the fault tolerant magic, trust them to handle it
> properly in user space.

So will you write the RFC? Or Mattijs? Or someone else? I want to see an RFC for
this feature, I've been asking for that for years. It's very frustrating that this
RFC is still not written.

Regards,

Hans

>
>>
>> I wonder if it has to be even more granular, i.e. select it for a specific instance
>> of a bridge driver device. That might be overkill.
>>
>> Regards,
>>
>> Hans
>>
>>>
>>> Thanks,
>>> Mattijs
>>> [...]
>
> Best regards,
> Michael
>
>