lkml.org 
[lkml]   [2009]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sound_core.c: Remove BKL from soundcore_open
> > It won't. Instead you get situations like one ioctl blocking another
> > to an unrelated device that just causes weird failures and performance
> > problems, or in some cases deadlocks.
>
> yes the bkl using code will be slower because it'll now hit contention.

No - the mutex using ioctls that sleep now block each other out - this
mistake was made in some video drivers.

> > Open routines block so it takes about 5 seconds of thought to realise
> > that using a mutex here is brain dead and doesn't work.
>
> it also takes 5 seconds to realize "uh oh. they block. BKL is rather
> limited in what it provides".

Which is what the code was written for.

This is why you can't just slap in a mutex but have to push it down.

Chances are that for a lot of small drivers you go

lock_kernel
foo->op()
unlock_kernel


to

foo->op()

op()
lock_kernel
blah
unlock_kernel

correctly on to

op()
{
mutex_lock(instance->lock);
blah
mutex_unlock(instance->lock);
but you can't jump those steps and hope to get it right.

Alan


\
 
 \ /
  Last update: 2009-10-11 22:57    [from the cache]
©2003-2011 Jasper Spaans