[alsa-devel] ALSA: pcm_direct.c SND_PCM_DIRECT_MAGIC

Mike Bjorge mbjorge at google.com
Thu Sep 24 22:33:15 CEST 2015


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 at 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 at 1004) because in
> > pcm_direct.c at 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 at 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.c;h=4e2f36cd275bfda1bc3453e569cf7fb44c317ef3;hp=46664a13d0a3368527b103ff13a08f3bcfe1ddbb;hb=eafb7ae5d8fa5ee52757ee0ee9137442d2c39326;hpb=194ff97ea68d66dac8e38671cbf73d52b42f3363
> > >
> > > 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)>]
> >
>


More information about the Alsa-devel mailing list