All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	<alsa-devel@alsa-project.org>, <broonie@kernel.org>
Cc: hdegoede@redhat.com, tiwai@suse.com, amadeuszx.slawinski@linux.intel.com
Subject: Re: [PATCH 2/2] ASoC: Intel: avs: Disconnect substream if suspend or resume fails
Date: Thu, 10 Nov 2022 17:44:23 +0100	[thread overview]
Message-ID: <db94ce72-da4c-72ef-edc3-9936a97d0378@intel.com> (raw)
In-Reply-To: <65f24445-11ed-cd36-4fd2-e326bf877f54@linux.intel.com>

On 2022-11-10 5:36 PM, Pierre-Louis Bossart wrote:
> On 11/10/22 10:29, Cezary Rojewski wrote:
>> On 2022-11-10 5:18 PM, Pierre-Louis Bossart wrote:
>>> On 11/10/22 10:06, Cezary Rojewski wrote:
>>
>>>> Unless something new has been added/updated, there is no runtime->state
>>>> field available. All the PCM code works with runtime->status->state.
>>>
>>> cd sound/
>>>
>>> git grep -c 'runtime->state'
>>> core/compress_offload.c:27
>>
>> ...
>>
>>> git grep -c 'status->state'
>>> core/pcm_compat.c:2
>>> core/pcm_native.c:4
>>
>> I see now, thanks. Commit from late September "ALSA: pcm: Avoid
>> reference to status->state" add a new field. Will update the code to use
>> __snd_pcm_set_state() instead.
>>
>> My base did not have it yet.
> 
> Right, it's relatively recent, and my point is that the helper does use
> stream locking when testing the same state you modify. Maybe that's a
> red herring but I thought I'd ask.
> 
> static void snd_pcm_set_state(struct snd_pcm_substream *substream,
> 			      snd_pcm_state_t state)
> {
> 	snd_pcm_stream_lock_irq(substream);
> 	if (substream->runtime->state != SNDRV_PCM_STATE_DISCONNECTED)
> 		__snd_pcm_set_state(substream->runtime, state);
> 	snd_pcm_stream_unlock_irq(substream);
> }
> 

Your question is a right one and this is the right time to talk about 
locking. Our current test results and my analysis show that locking is 
not needed (what isn't the case for the first patch in the series) but 
races such as this one are hard to reproduce. If I'm proven wrong, no 
problem updating the code on my side.

      reply	other threads:[~2022-11-10 16:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 14:13 [PATCH 0/2] ASoC: Intel: avs: DSP recovery and resume fixes Cezary Rojewski
2022-11-10 14:13 ` [PATCH 1/2] ASoC: Intel: avs: Lock substream before snd_pcm_stop() Cezary Rojewski
2022-11-10 14:13 ` [PATCH 2/2] ASoC: Intel: avs: Disconnect substream if suspend or resume fails Cezary Rojewski
2022-11-10 15:39   ` Pierre-Louis Bossart
2022-11-10 16:06     ` Cezary Rojewski
2022-11-10 16:18       ` Pierre-Louis Bossart
2022-11-10 16:29         ` Cezary Rojewski
2022-11-10 16:36           ` Pierre-Louis Bossart
2022-11-10 16:44             ` Cezary Rojewski [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=db94ce72-da4c-72ef-edc3-9936a97d0378@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.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.