All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Michael Rodin <mrodin@de.adit-jv.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org, michael@rodin.online,
	erosca@de.adit-jv.com
Subject: Re: [PATCH 3/3] rcar-vin: handle transfer errors from subdevices and stop streaming if required
Date: Wed, 8 Jun 2022 23:04:31 +0200	[thread overview]
Message-ID: <YqEO3/KekkZhVjW+@oden.dyn.berto.se> (raw)
In-Reply-To: <20220520195041.GA18056@vmlxhi-121.adit-jv.com>

Hi Michael,

On 2022-05-20 21:50:41 +0200, Michael Rodin wrote:

[snip]

> > 
> > Do we need to set xfer_error to false here? The delayed work is canceled 
> > and we reset the xfer_error when we start in rvin_start_streaming().
> > 
> 
> You are right, this seems to be redundant. But I think that there might be
> a different case where we have to reset xfer_error:
> 
>  1. A non-critical transfer error has occurred during streaming from a
>     HDMI source.
>  2. Frames are still captured for an hour without any further problems,
>     since it was just a short glitch
>  3. Now the source (e.g. HDMI signal generator) has been powered off by the
>     user so it does not send new frames.
>  4. Timeout occurs due to 3 but since xfer_error has been set 1 hour ago,
>     userspace is notified about a transfer error and assumes that streaming
>     has been stopped because of this.
> 
> To avoid this scenario I think maybe we have to restrict validity of
> xfer_error. Maybe it would be better to make xfer_error a counter which is
> set after a transfer error to e.g. 10 frames and then decremented after
> each captured frame so after 10 successfully captured frames we know that a
> timeout has occurred definitely not due to a transfer error?
> 
> Another possible improvement might be to make FRAME_TIMEOUT_MS configurable,
> maybe via a v4l2 control from userspace? Or we could also define the timeout
> as a multiple of the frame interval of the source. This would allow us to
> reduce the timeout further based on the particular source so the userspace
> does not have to wait for a second until it knows that it has to restart
> streaming.
> 
> What do you think?

I discussed this problem last week at a conference and the consensus was 
that this problem of timeouts and the like should in the first hand be 
handled in user-space. The reason being that there might be use-cases 
that are better dealt with there.

If the monitor thread is is strictly needed for some reason in kernel 
thread it should likely be moved to the V4L2 core as all drivers would 
then be able to use it instead of deeding on slightly different 
implementations in each driver.

So I fear we are back to only try to signal xfer errors in the driver 
and then leave it to either user-space or some new V4L2 code to help 
monitoring.

Sorry for only understanding this so late in the review, it took some 
time for me to understand it but once explained to me it made sens.

-- 
Kind Regards,
Niklas Söderlund

  reply	other threads:[~2022-06-08 21:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19 18:00 Improve error handling in the rcar-vin driver Michael Rodin
2022-05-19 18:00 ` [PATCH 1/3] media: videobuf2: Add a transfer error event Michael Rodin
2022-05-19 18:00 ` [PATCH 2/3] rcar-csi2: Do not try to recover after transfer error Michael Rodin
2022-05-19 18:00 ` [PATCH 3/3] rcar-vin: handle transfer errors from subdevices and stop streaming if required Michael Rodin
2022-05-19 21:00   ` Niklas Söderlund
2022-05-20 19:50     ` Michael Rodin
2022-06-08 21:04       ` Niklas Söderlund [this message]
2022-06-28 18:00         ` [PATCH v2 0/3] Improve error handling in the rcar-vin driver Michael Rodin
2022-06-28 18:00           ` [PATCH 1/3] media: videobuf2: Add a transfer error event Michael Rodin
2022-07-04 15:59             ` Nicolas Dufresne
2022-07-15 16:15               ` Michael Rodin
2022-08-02  9:32                 ` Hans Verkuil
2022-08-08 17:03                   ` Michael Rodin
2022-08-09  7:12                     ` Hans Verkuil
2022-06-28 18:00           ` [PATCH 2/3] rcar-csi2: Do not try to recover after transfer error Michael Rodin
2022-06-28 18:00           ` [PATCH 3/3] media: rcar-vin: Allow userspace to subscribe to V4L2_EVENT_XFER_ERROR Michael Rodin
2022-07-05  9:46           ` [PATCH v2 0/3] Improve error handling in the rcar-vin driver Niklas Söderlund
2022-07-15 13:42             ` Michael Rodin

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=YqEO3/KekkZhVjW+@oden.dyn.berto.se \
    --to=niklas.soderlund@ragnatech.se \
    --cc=erosca@de.adit-jv.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=michael@rodin.online \
    --cc=mrodin@de.adit-jv.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.