Skip to contentSkip to conversation

correct use of lock_kernel() - help! please

DISCUSSION Iain Sandoe 2 participants 2 messages Jan 29, 2001

lore
Share & tools
lore
#0 lore raw

Hi,

In the driver I am working on (dmasound) someone has placed lock/unlock _kernel() pairs around whole functions.

This means that (e.g.) if we release the sound device with a lot of un-played samples at a low-ish sample rate...

AFACIT we could hold the kernel locked for *several seconds*

What do I really need to protect with lock/unlock pairs?

or am I missing something (it wouldn't be the first time ..) ;-?

ciao,
Iain.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw

Hi,

Quoted 1 line · Iain Sandoe

AFACIT we could hold the kernel locked for *several seconds*

If you sleep inbetween, it's no problem. The kernel lock is released automatically during sleep and reget after sleeping.

Quoted 1 line

What do I really need to protect with lock/unlock pairs?

SMP protection. Only a single processor can hold the kernel lock at the same time. The preferred solution is of course to use semaphores / spinlocks.

bye, Roman

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/