All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: "Rajwa, Marcin" <marcin.rajwa@linux.intel.com>,
	Keyon Jie <yang.jie@linux.intel.com>,
	alsa-devel@alsa-project.org
Cc: marcin.rajwa@intel.com, ranjani.sridharan@linux.intel.com,
	kai.vehmanen@linux.intel.com
Subject: Re: [PATCH v3 1/2] ASoC: SOF: add flag for position update ipc
Date: Fri, 19 Jul 2019 09:25:23 -0500	[thread overview]
Message-ID: <f2c36393-937f-16d8-133d-5b1f472d2977@linux.intel.com> (raw)
In-Reply-To: <54b08af5-77bd-2de4-c3ce-158a9374c15a@linux.intel.com>


>> We knew from Day1 that draining faster than real-time could 
>> potentially lead to the driver detecting overflows or timeouts. It's 
>> been documented left and right, with an assumption that the ring 
>> buffer is actually big enough to contain all the data stored in the DSP.
> 
> @Pierre, indeed the buffer that kernel allocates is big enough to store 
> all the data. However *arecord* introduces its own buffer which is just 
> a multiple of *period_sizes *- and it is the buffer which overflows.

When I tested this feature with the closed-source firmware on KBL, 
arecord worked fine. Care to provide more details so that we are on the 
same page?

> 
>>
>> Before I provide more feedback, can you clarify if the 
>> 'host_period_bytes' is the same value as the ALSA period size (in 
>> bytes)? And what would be the value when the no_irq mode is used?
> 
> Yes, this is the same value. It is obtained by *params_period_bytes**()* 
> in kernel.

ok good. I was afraid this would be a different concept.

So what you are saying is that the draining happens by bursts whose size 
is tied to the period defined by the host, yes?

> 
> *no_irq mode *- it does not affect the value of *host_period_bytes 
> *after my patch has been applied. Before my patch however, driver and FW 
> used this value to send stream position information from FW to kernel. 
> In short, when *(hda && hda->no_ipc_position)*
> 
> then *ipc_params->host_period_bytes = 0; *was set in kernel.**Firmware 
> then, read this *host_period_bytes = 0 *and treated it as "OK does not 
> send any IPC regarding stream position". So once *no_ipc_position *was 
> set we lost information about *host_period_bytes *in the FW.
> 
> So all my patches in FW and Kernel do is to *relax****host_period_bytes 
> *and introduce new parameter dedicated for this stream position IPC. At 
> that time we called it *no_period_irq *to resemble old name but now I 
> think it would be better if we rename it to something like
> 
> *no_stream_position *as it is more informative. What do you think?

The text is quite difficult to read with all the *... Please use plain text.

It just occurred to me that the traditional use of the timer-based 
scheduling (with no_irq mode) is not very smart with this sort of 
application. The host has absolutely no way of predicting for how long 
it needs to sleep before the firmware completes the initial flush. This 
time is linked to hardware, bandwidth to memory, etc, and might vary 
quite a bit between platforms. In this case, it's much better to rely on 
events set by hardware upon data availability.

in terms of naming, no_stream_position_ipc would be my choice, but it's 
a bit long.

>>>
>>> Hope it helped to understand the need of *host_period_bytes *in the 
>>> firmware.

Yes, thanks for taking the time to explain the issue.

  reply	other threads:[~2019-07-19 14:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18  3:11 [PATCH v3 1/2] ASoC: SOF: add flag for position update ipc Keyon Jie
2019-07-18  3:11 ` [PATCH v3 2/2] ASoC: SOF: Intel: fix reset of host_period_bytes Keyon Jie
2019-07-18  3:35 ` [PATCH v3 1/2] ASoC: SOF: add flag for position update ipc Pierre-Louis Bossart
2019-07-18  5:06   ` Keyon Jie
2019-07-18  8:42     ` Rajwa, Marcin
2019-07-18 15:24       ` Pierre-Louis Bossart
2019-07-19 10:32         ` Rajwa, Marcin
2019-07-19 14:25           ` Pierre-Louis Bossart [this message]
2019-07-19 14:59             ` Rajwa, Marcin

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=f2c36393-937f-16d8-133d-5b1f472d2977@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=marcin.rajwa@intel.com \
    --cc=marcin.rajwa@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=yang.jie@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 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.