Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "S.J. Wang" <shengjiu.wang@nxp.com>
Cc: Chancel Liu <chancel.liu@nxp.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Shengjiu Wang <shengjiu.wang@gmail.com>
Subject: Re: Issue in pcm_dsnoop.c in alsa-lib
Date: Fri, 04 Mar 2022 09:44:16 +0100	[thread overview]
Message-ID: <s5hy21qrtsv.wl-tiwai@suse.de> (raw)
In-Reply-To: <PAXPR04MB9089532964E25CA9DB4B19BCE3059@PAXPR04MB9089.eurprd04.prod.outlook.com>

On Fri, 04 Mar 2022 09:35:28 +0100,
S.J. Wang wrote:
> 
> 
> 
> > >
> > > Hi Takashi Iwai, Jaroslav Kysela
> > >
> > >     We encountered an issue in the pcm_dsnoop use case, could you
> > > please help to have a look?
> > >
> > >     *Issue description:*
> > >     With two instances for dsnoop type device running in parallel,
> > > after suspend/resume,  one of the instances will be hung in memcpy
> > > because the very large copy size is obtained.
> > >
> > > #3 0x0000ffffa78d5098 in snd_pcm_dsnoop_sync_ptr
> > (pcm=0xaaab06563da0)
> > > at pcm_dsnoop.c:158 dsnoop = 0xaaab06563c20 slave_hw_ptr = 64
> > > old_slave_hw_ptr = 533120 avail = *187651522444320*
> > >
> > >   * Reason analysis: *
> > >    The root cause that I analysis is that after suspend/resume,  one
> > > instance will get the SND_PCM_STATE_SUSPENDED state from slave pcm
> > device,
> > >   then it will do snd_pcm_prepare() and snd_pcm_start(),  which will
> > > reset the dsnoop->slave_hw_ptr and the hw_ptr of slave pcm device,
> > > then the state of this instance is correct.  But another instance may
> > > not get the SND_PCM_STATE_SUSPENDED state from slave pcm device
> > > because slave device may have been recovered by first instance,  so
> > > the dsnoop->slave_hw_ptr is not reset.  but because hw_ptr of slave
> > > pcm device has been reset,  so there will be a very large "avail" size.
> > >
> > >    *Solution:*
> > >    I didn't come up with a fix for this issue,  seems there is no easy
> > > way to let another instance know this case and reset the
> > > dsnoop->slave_hw_ptr,  could you please help?
> > 
> > Could you try topic/pcm-direct-resume branch on
> > 
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub
> > .com%2Ftiwai%2Falsa-
> > lib&amp;data=04%7C01%7Cshengjiu.wang%40nxp.com%7C95f97de3f2c840d
> > 9853508d9fd2e79ea%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C
> > 637819198319430045%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwM
> > DAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdat
> > a=WWX1ZlcQhJF3pHJdHPIH%2B0xG9o%2FjQnHG5fHDbKXwQwE%3D&amp;r
> > eserved=0
> > 
> 
> Thanks,  I push my test result in https://github.com/alsa-project/alsa-lib/issues/213
> Could you please review?

Please keep the discussion on ML.


Takashi

  reply	other threads:[~2022-03-04  8:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04  8:35 Issue in pcm_dsnoop.c in alsa-lib S.J. Wang
2022-03-04  8:44 ` Takashi Iwai [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-03-10  2:25 S.J. Wang
2022-03-10  8:27 ` Takashi Iwai
     [not found] <1646246543868125916-webhooks-bot@alsa-project.org>
2022-03-02 18:42 ` GitHub issues - edited
     [not found] <1646108881728133917-webhooks-bot@alsa-project.org>
2022-03-01  4:28 ` GitHub issues - opened
2022-03-01  4:16 Shengjiu Wang
2022-03-03 15:57 ` Takashi Iwai

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=s5hy21qrtsv.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=chancel.liu@nxp.com \
    --cc=shengjiu.wang@gmail.com \
    --cc=shengjiu.wang@nxp.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