Skip to contentSkip to conversation

alsa and locking

DISCUSSION Johannes Berg 2 participants 5 messages May 19, 2006

lore
Share & tools
lore
#0 lore raw

I was looking into locking a bit but can't figure out what alsa already locks and where I need my own locks. Any document detailing what must be done and what is already locked?

johannes

#1 lore raw

At Fri, 19 May 2006 18:11:02 +0200,

Quoted 4 lines · Johannes Berg

I was looking into locking a bit but can't figure out what alsa already locks and where I need my own locks. Any document detailing what must be done and what is already locked?

Some descriptions are found in the atomicity section of my tutorial.

All control callbacks are not protected, except for rwsem against addition/removal of elements.

The PCM trigger, pointer and ack callbacks shall be atomic, where protected with spinlock and irq disabled. Other PCM callbacks are not protected but for open mutex.

Takashi

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#2 lore raw
Quoted 1 line · Takashi Iwai

Some descriptions are found in the atomicity section of my tutorial.

Yes, I've seen that. Rather vague though.

Quoted 2 lines

All control callbacks are not protected, except for rwsem against addition/removal of elements.

Alright, so it's possible that a user actually changes two controls at the same time. IOW I have to protect against that.

Quoted 3 lines

The PCM trigger, pointer and ack callbacks shall be atomic, where protected with spinlock and irq disabled. Other PCM callbacks are not protected but for open mutex.

Right. What about prepare and all the other pcm stuff? Can it race against the same when two apps open capture/playback etc?

johannes

#3 lore raw

At Fri, 19 May 2006 18:46:03 +0200,

Quoted 6 lines · Johannes Berg

[1 <text/plain (quoted-printable)>]

Quoted 1 line · Takashi Iwai

Some descriptions are found in the atomicity section of my tutorial.

Quoted 7 lines

Yes, I've seen that. Rather vague though.

Quoted 2 lines

All control callbacks are not protected, except for rwsem against addition/removal of elements.

Alright, so it's possible that a user actually changes two controls at the same time. IOW I have to protect against that.

Yes.

Quoted 6 lines
Quoted 3 lines

The PCM trigger, pointer and ack callbacks shall be atomic, where protected with spinlock and irq disabled. Other PCM callbacks are not protected but for open mutex.

Right. What about prepare and all the other pcm stuff? Can it race against the same when two apps open capture/playback etc?

Yes. open/close are protected via open_mutex in the PCM core level for avoiding open races, but otherwise it's responsibility of the driver.

Takashi

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#4 lore raw
Quoted 3 lines · Takashi Iwai

Yes. open/close are protected via open_mutex in the PCM core level for avoiding open races, but otherwise it's responsibility of the driver.

Ok, thanks. I'll look at it then (probably needs spin-locks since I need those in the atomic parts too)

johannes