lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <s5hk14ufqx9.wl-tiwai@suse.de>
Date:   Mon, 10 Feb 2020 15:38:42 +0100
From:   Takashi Iwai <tiwai@...e.de>
To:     Peter Ujfalusi <peter.ujfalusi@...com>
Cc:     <broonie@...nel.org>, <lgirdwood@...il.com>, <tiwai@...e.com>,
        <perex@...ex.cz>, <lars@...afoo.de>, <alsa-devel@...a-project.org>,
        <vkoul@...nel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ASoC: dmaengine_pcm: Consider DMA cache caused delay in pointer callback

On Mon, 10 Feb 2020 15:28:44 +0100,
Peter Ujfalusi wrote:
> 
> Hi Takashi,
> 
> >> --- a/sound/soc/soc-pcm.c
> >> +++ b/sound/soc/soc-pcm.c
> >> @@ -1151,7 +1151,7 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
> >>  	}
> >>  	delay += codec_delay;
> >>  
> >> -	runtime->delay = delay;
> >> +	runtime->delay += delay;
> > 
> > Is it correct?
> > delay already takes runtime->delay as its basis, so it'll result in a
> > double.
> 
> The delay here is coming from the DAI and the codec.
> The runtime->delay hold the PCM (DMA) caused delay.

Well, let's take a look at soc_pcm_pointer():

	/* clearing the previous total delay */
	runtime->delay = 0;

	offset = snd_soc_pcm_component_pointer(substream);

	/* base delay if assigned in pointer callback */
	delay = runtime->delay;

	delay += snd_soc_dai_delay(cpu_dai, substream);

	for_each_rtd_codec_dai(rtd, i, codec_dai) {
		codec_delay = max(codec_delay,
				  snd_soc_dai_delay(codec_dai, substream));
	}
	delay += codec_delay;

	runtime->delay = delay;

So, the code reads the current runtime->delay and saves it as delay
variable.  Then it adds the max delay from codec DAIs, and stores back
to runtime->delay.

If we change the last line to
	runtime->delay += delay;
it'll add to the already existing value again, so it'll be doubly if
runtime->delay was non-zero beforehand.

That said, judging from the code, I believe the current soc-pcm.c code
needs no change.


thanks,

Takashi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ