linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: alsa-devel@alsa-project.org,
	"Ivaylo Dimitrov" <ivo.g.dimitrov.75@gmail.com>,
	"Aaro Koskinen" <aaro.koskinen@iki.fi>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Kristo, Tero" <t-kristo@ti.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Jarkko Nikula" <jarkko.nikula@linux.intel.com>,
	"Pavel Machel" <pavel@ucw.cz>,
	"Pali Rohár" <pali.rohar@gmail.com>,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH] ASoC: omap-mcbsp: Add PM QoS support for McBSP to prevent glitches
Date: Tue, 6 Sep 2016 13:16:50 -0700	[thread overview]
Message-ID: <20160906201649.fx4vhuqmnziwshoe@atomide.com> (raw)
In-Reply-To: <7d1c9a2f-60ae-2d83-f7dc-55fe476dbccb@ti.com>

* Peter Ujfalusi <peter.ujfalusi@ti.com> [160905 00:53]:
> On 09/02/16 23:40, Tony Lindgren wrote:
> > Hmm well actually with the fifo threshold your calculations above
> > start making some sense. The missing piece is that we will never hit
> > off mode until DMA is done. So the true worst case would be:
> > 
> > - 2.9 - 13.06 ms for the fifo threshold minus dma setup time
> > - plus the time it takes to complete the fifo fill with dma
> >   as dma will keep the SoC active
> > - plus the time it takes to idle the dma after the last fifo fill
> >   as the dma will keep SoC active
> 
> Yeah, I have done this calculations for the DADC33 mode7LP mode :D
> 
> While the calculation is correct for the wake latency requirements, there is a
> flip side:
> FIFO threshold 128:
> - wake threshold is ~13.06ms to ensure that we don't drain the FIFO
> - DMA requests are coming at 1.45ms rate.
> 
> While we could take a C state which would take ~13.06ms to leave, in reality
> the system will be busy to respond to the DMA request coming in every 1.45ms.
> 
> FIFO threshold is 1024:
> - wake threshold is ~2.9ms to ensure that we don't drain the FIFO
> - DMA requests are coming at 11.6ms rate.
> 
> In this case we only going to allow C state from which we can leave under
> 2.9ms, but between DMA burst we have 11.6ms. We could be in deeper state, but
> we are going to be woken up by the DMA request and after the DMA request we
> have ~2.9ms before the FIFO is empty...
> 
> So either we allow deeper C state (threshold 128) which we might not able to
> take to the 'fast' DMA requests, or we only allow shallow C state (threshold
> 1024), and have more time between the DMA requests.
> 
> Is this makes sense?

Makes sense. Do you have a formula or updated patch I can test here?
Then we can add comments about the possible unaccounted latencies that
can be worked out as needed.

> > The dma setup, complete, and idle latencies here can be probably
> > be measured with hrtimer :) That still does not explain we don't
> > miss anything in retention idle currently.
> > 
> >> I don't know the PM code that well, but is there a way to set attribute to a
> >> device to tell how deep C state it can tolerate on the given board or SoC?
> > 
> > I believe we can only set the pm_qos latency requirements and there
> > is no direct limiting of C states. Then I think the idea of
> > dev_pm_qos and set_latency_tolerance callback is that it allows the
> > SoC specific code to select the allowed C states. So if we
> > implemented set_latency_tolerance in the cpuidle driver, we could
> > tinker directly with the C states for latencies.
> 
> What we can agree on is that OFF need to be blocked when audio is in use. But
> I'm not sure what is the correct way.

AFAIK pm_qos is the only Linux generic way to block certain C states.

Regards,

Tony

  reply	other threads:[~2016-09-06 20:16 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29 18:27 [PATCH] ASoC: omap-mcbsp: Add PM QoS support for McBSP to prevent glitches Tony Lindgren
     [not found] ` <201608300739.JrTVlIyd%fengguang.wu@intel.com>
2016-08-30 18:38   ` Tony Lindgren
2016-08-31 17:24     ` Mark Brown
2016-08-31 17:42       ` Tony Lindgren
2016-08-31 11:37 ` Peter Ujfalusi
2016-08-31 14:13   ` Tony Lindgren
2016-08-31 16:59     ` Tony Lindgren
2016-08-31 18:33       ` Peter Ujfalusi
2016-08-31 19:41         ` Tony Lindgren
2016-09-01  6:57           ` Peter Ujfalusi
2016-09-01 14:50             ` Tony Lindgren
2016-09-02  7:30               ` Peter Ujfalusi
2016-09-02 14:56                 ` Tony Lindgren
2016-09-02 19:38                   ` Peter Ujfalusi
2016-09-02 20:40                     ` Tony Lindgren
2016-09-05  7:53                       ` Peter Ujfalusi
2016-09-06 20:16                         ` Tony Lindgren [this message]
2016-09-07 14:31                           ` Peter Ujfalusi
2016-09-08  3:53                             ` Tony Lindgren
2016-09-08 10:41                               ` Peter Ujfalusi
2016-09-08 10:49                                 ` Peter Ujfalusi
2016-09-08 14:48                                   ` Tony Lindgren
2016-09-09  6:51                                     ` Peter Ujfalusi
2016-09-09 23:45                                       ` Tony Lindgren
2016-09-13 11:45                                         ` Peter Ujfalusi
2016-09-13 13:45                                           ` Tony Lindgren
2016-09-02 15:54                 ` Pavel Machek
2016-09-02 19:45                   ` Peter Ujfalusi
2016-09-02 20:09                     ` Tony Lindgren
2016-09-03 16:08                       ` Sebastian Reichel
2016-09-06 20:08                         ` Tony Lindgren

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=20160906201649.fx4vhuqmnziwshoe@atomide.com \
    --to=tony@atomide.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=peter.ujfalusi@ti.com \
    --cc=sre@kernel.org \
    --cc=t-kristo@ti.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;
as well as URLs for NNTP newsgroup(s).