Re: [alsa-devel] ALSA: pcm_direct.c SND_PCM_DIRECT_MAGIC
On Wed, 23 Sep 2015 18:07:46 +0200, Mike Bjorge wrote:
I see, interesting.
I am running into an issue where pcm_dmix.c is occasionally failing with an "unable to create IPC shm instance" (pcm_dmix.c@1004) because in pcm_direct.c@134, (dmix->shmptr->magic != SND_PCM_DIRECT_MAGIC) when buf.shm_nattch == 2.
Do you know if there are any likely causes that would result in dmix->shmptr->magic not being set correctly?
What value is read there? If the value is completely different, it means that some other programs use the same shmem for other purpose. It'd be just a conflict of shmem key.
Takashi
Thanks for your help, Mike
On Wed, Sep 23, 2015 at 6:11 AM, Takashi Iwai tiwai@suse.de wrote:
On Sat, 19 Sep 2015 01:13:42 +0200, Mike Bjorge wrote:
Hi Takashi,
I know this is a bit out of the blue, but I was wondering if you could explain the point of SND_PCM_DIRECT_MAGIC and dmix->shmptr->magic?
Specifically, what it's doing in pcm_direct.c from this commit?
http://git.alsa-project.org/?p=alsa-lib.git;a=blobdiff;f=src/pcm/pcm_direct....
It's to check the consistency of shared data via shmem. If we change the data structure in an incompatible way, we'd change the magic key so that each instance can detect it.
Takashi
[2 <text/html; UTF-8 (quoted-printable)>]
The dmix->shmptr->magic is set to 0 at the time that the check is failing.
It also only seems to fail when I actually try to have 2 different processes trying to create/connect to the shared memory.
I'm thinking there's probably a race condition somewhere, something isn't being cleaned up / initialized correctly, or perhaps the underlying driver is not behaving correctly.
I'll keep looking into.
On Thu, Sep 24, 2015 at 2:42 AM, Takashi Iwai tiwai@suse.de wrote:
On Wed, 23 Sep 2015 18:07:46 +0200, Mike Bjorge wrote:
I see, interesting.
I am running into an issue where pcm_dmix.c is occasionally failing with
an
"unable to create IPC shm instance" (pcm_dmix.c@1004) because in pcm_direct.c@134, (dmix->shmptr->magic != SND_PCM_DIRECT_MAGIC) when buf.shm_nattch == 2.
Do you know if there are any likely causes that would result in dmix->shmptr->magic not being set correctly?
What value is read there? If the value is completely different, it means that some other programs use the same shmem for other purpose. It'd be just a conflict of shmem key.
Takashi
Thanks for your help, Mike
On Wed, Sep 23, 2015 at 6:11 AM, Takashi Iwai tiwai@suse.de wrote:
On Sat, 19 Sep 2015 01:13:42 +0200, Mike Bjorge wrote:
Hi Takashi,
I know this is a bit out of the blue, but I was wondering if you
could
explain the point of SND_PCM_DIRECT_MAGIC and dmix->shmptr->magic?
Specifically, what it's doing in pcm_direct.c from this commit?
http://git.alsa-project.org/?p=alsa-lib.git;a=blobdiff;f=src/pcm/pcm_direct....
It's to check the consistency of shared data via shmem. If we change the data structure in an incompatible way, we'd change the magic key so that each instance can detect it.
Takashi
[2 <text/html; UTF-8 (quoted-printable)>]
participants (2)
-
Mike Bjorge
-
Takashi Iwai