stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
To: Daniel Scheller <d.scheller.oss@gmail.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Sergey Kozlov <serjk@netup.ru>, Abylay Ospan <aospan@netup.ru>,
	stable@vger.kernel.org
Subject: Re: [PATCH v3] media: cxd2841er: avoid too many status inquires
Date: Sun, 6 Oct 2019 09:47:43 -0300	[thread overview]
Message-ID: <20191006094743.494555bc@coco.lan> (raw)
In-Reply-To: <20191005100205.01459123@lt530>

Em Sat, 5 Oct 2019 10:02:05 +0200
Daniel Scheller <d.scheller.oss@gmail.com> escreveu:

> Am Fri,  4 Oct 2019 11:02:28 -0300
> schrieb Mauro Carvalho Chehab <mchehab+samsung@kernel.org>:
> 
> > As reported at:
> > 	https://tvheadend.org/issues/5625
> > 
> > Retrieving certain status can cause discontinuity issues.
> > 
> > Prevent that by adding a timeout to each status logic.
> > 
> > Currently, the timeout is estimated based at the channel
> > bandwidth. There are other parameters that may also affect
> > the timeout, but that would require a per-delivery system
> > calculus and probably more information about how cxd2481er
> > works, with we don't have.
> > 
> > So, do a poor man's best guess.  
> 
> Such hardware quirk hack should clearly be enabled by a (new) config
> flag (see the bits at the top of cxd2841er.h) which consumer drivers
> can set if there are known issues with them. The reported issue is
> nothing every piece of hardware with a cxd28xx demod soldered on has -
> I believe the JokerTV devices which Abylay originally made this driver
> for suffers from this and at least the Digital Devices C/C2/T/T2/I
> boards (cxd2837/43/54) definitely don't have any issues (and I use them
> regularily in my TVheadend server which is frequently used).
> 
> So please hide this behind a flag named ie. "CXD2841ER_STAT_TIMEOUT"
> and enable that in the USB drivers which the affected USB sticks use.

I see your point.

There are a few things to consider here, though:

1) I2C bus calls are expensive, as the bus speed is typically 100kbps.
   Doing such ops too fast is known to have caused issues in the past
   with other frontends.

   So, a good practice, followed by almost all frontends, is to have 
   some logic that would prevent calling stats too fast;

2) Obtaining stats like BER, UCB, block error count and even S/N ratio takes
   time, as the frontend need to wait for enough data to arrive, in order to
   update the internal registers. At best, calling stats too fast will
   just make the frontend return a previously cached value, just spending
   I2C bus bandwidth for nothing.

3) If you look at the cxd2880 driver, wrote by Sony developers, you'll
   see that it has a complex logic to estimate the time where the
   next stats value is available. I bet that the timings calculated there
   would be similar to the minimal time to obtain a reliable measure also
   on cxd2841er.

4) The cxd2841er can't do any real estimation right now, as it tunes
   into a channel using auto mode and it misses the code that would
   retrieve the tuning parameters and would allow to properly estimate
   the bit rate of the received stream.

5) With regards to the tvheadend issue, I've been talking with the
   reporter at the IRC channel, sending him some patches to test.
   After some tests, I'm pretty sure that the issue is not Kernel
   related, but, instead, there's something broken at tvheadend
   (at least at the version he is using) that it is causing troubles
   when using the DVBv5 stats API.

With all the above considerations, I agree with you that this patch
should not be applied. Yet, we should at least apply a patch that would
prevent retrieving the stats registers too fast.

I'm sending a new version in a few.

Thanks,
Mauro

      reply	other threads:[~2019-10-06 12:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <deda32250ad32078b98eb41eb09d6d20050a6f9c.1570113429.git.mchehab+samsung@kernel.org>
2019-10-04 14:02 ` [PATCH v3] media: cxd2841er: avoid too many status inquires Mauro Carvalho Chehab
2019-10-05  8:02   ` Daniel Scheller
2019-10-06 12:47     ` Mauro Carvalho Chehab [this message]

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=20191006094743.494555bc@coco.lan \
    --to=mchehab+samsung@kernel.org \
    --cc=aospan@netup.ru \
    --cc=d.scheller.oss@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=serjk@netup.ru \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).