All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: liam.r.girdwood@linux.intel.com, alsa-devel@alsa-project.org,
	broonie@kernel.org, vkoul@kernel.org
Subject: Re: [PATCH] ALSA: PCM: check if ops are defined before suspending PCM
Date: Tue, 12 Feb 2019 12:48:10 -0800	[thread overview]
Message-ID: <04d603b1b56e6de34cd366f249c6d8ac113309d6.camel@linux.intel.com> (raw)
In-Reply-To: <s5hwom971m9.wl-tiwai@suse.de>

On Sat, 2019-02-09 at 10:27 +0100, Takashi Iwai wrote:
> On Sat, 09 Feb 2019 00:29:53 +0100,
> Pierre-Louis Bossart wrote:
> > 
> > From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> > 
> > BE dai links only have internal PCM's and their substream ops may
> > not be set. Suspending these PCM's will result in their
> >  ops->trigger() being invoked and cause a kernel oops.
> > So skip suspending PCM's if their ops are NULL.
> > 
> > Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
> > >
> > Signed-off-by: Pierre-Louis Bossart <
> > pierre-louis.bossart@linux.intel.com>
> > ---
> >  sound/core/pcm_native.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
> > index 818dff1de545..b6e158ce6650 100644
> > --- a/sound/core/pcm_native.c
> > +++ b/sound/core/pcm_native.c
> > @@ -1506,6 +1506,14 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm)
> >  			/* FIXME: the open/close code should lock this
> > as well */
> >  			if (substream->runtime == NULL)
> >  				continue;
> > +
> > +			/*
> > +			 * Skip BE dai link PCM's that are internal and
> > may
> > +			 * not have their substream ops set.
> > +			 */
> > +			if (!substream->ops)
> > +				continue;
> > +
> >  			err = snd_pcm_suspend(substream);
> >  			if (err < 0 && err != -EBUSY)
> >  				return err;
> 
> Basically it's OK and safe to apply this check.  We may need to add
> such sanity checks in more places if this really hits.
> 
> But I still wonder how this can go through.  Is substream->runtime
> set
> even if substream->ops is NULL?  The substream->runtime is assigned
> dynamically at opening a substream via snd_pcm_attach_substream(), so
> without opening it, it must be NULL.
Hi Takashi,

My guess is that this happens during
dpcm_be_connect(fe, be, stream) in dpcm_add_paths().

The reason this wasnt exposed before was that the fe dai link pcm's
were suspended first. So when it was BE dai links' turn, the pcm was
already suspended. In the case of SOF, the order of dai links in the
rtd_list is BE dai links first and then the FE dai links.

Thanks,
Ranjani

> 
> 
> thanks,
> 
> Takashi
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

      parent reply	other threads:[~2019-02-12 20:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 23:29 [PATCH] ALSA: PCM: check if ops are defined before suspending PCM Pierre-Louis Bossart
2019-02-09  9:27 ` Takashi Iwai
2019-02-11 15:41   ` Pierre-Louis Bossart
2019-02-11 16:05     ` Takashi Iwai
2019-02-11 16:59       ` Pierre-Louis Bossart
2019-02-12 16:20         ` Mark Brown
2019-02-12 20:48   ` Ranjani Sridharan [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=04d603b1b56e6de34cd366f249c6d8ac113309d6.camel@linux.intel.com \
    --to=ranjani.sridharan@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=vkoul@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 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.