-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue in pcm_dsnoop.c in alsa-lib #213
Comments
Thanks for the fix. But it doesn't solve the issue totally,
By the way, the RECOVERIES_FLAG_SUSPENDED is in BIT(31), do we need to consider the overflow of recovery counter? if it overflow to BT(31), then the FLAG_SUSPEND should be wrongly set. Best regards |
On Fri, 04 Mar 2022 09:29:54 +0100, Shengjiu Wang wrote:
Thanks for the fix. But it doesn't solve the issue totally,
I do two modification base on your fix, after test, the issue can't be
reproduced. could you please review?
Could you rather submit a proper patch?
I hesitated to apply the semaphore around
snd_pcm_direct_client_chk_xrun() as it's a hot path. But it seems
that we have to do it in anyway, and if any, this could be another
patch (the function is already present and used for xrun checks).
And, we can implement a fast-path there as well; if direct->state is
XRUN or SUSPENDED at the beginning of the function, returns
immediately.
Or, we may move the update of recoveries count in
snd_pcm_direct_slave_recover() earlier, almost at the beginning of the
procedure. Then other in parallel can catch the change, practically
works even without semaphore.
By the way, the RECOVERIES_FLAG_SUSPENDED is in BIT(31), do we need to
consider the overflow of recovery counter? if it overflow to BT(31), then the
FLAG_SUSPEND should be wrongly set.
It's masked with RECOVERIES_MASK.
Takashi
|
Thanks
I saw you have update the origin/topic/pcm-direct-resume branch, I test your latest change, it is more stable than before, but still meet once of the issue after overnight test, it it very very low possibility. So I suggest if we need to do below change, shall we?
|
For reference, this issue was fixed in bb9f258 . |
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.
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?
The text was updated successfully, but these errors were encountered: