[lkml]   [2007]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] use spinlock instead of binary mutex in idt77252 driver

    On 4/23/07, Eddie C. Dost <> wrote:
    > as long as mutexes are not converted to nop when CONFIG_SMP is not
    > defined (I don't know what current kernels do), this is of course
    > correct. You need to verify the headerfiles for the above.

    Yes, even on UP different threads accessing the same data could race.
    Mutexes (== binary semaphores) are *required* to synchronize access to
    shared data.

    You might be confusing mutexes with spinlocks. Spinlocks _are_
    compiled away on UP (actually !CONFIG_SMP && !CONFIG_PREEMPT) kernels,
    but that is still safe because spinlocks are busy-waiting loops
    (unlike mutexes and semaphores that block) and hence no thread is
    allowed to sleep when holding a spinlock.

    > On Mon, Apr 23, 2007 at 09:40:26AM +0200, Matthias Kaehlcke wrote:
    > > El Mon, Apr 23, 2007 at 09:16:08AM +0200 Eddie C. Dost ha dit:
    > > > Please note that the semaphore is used to lock the idt77252 config
    > > > tables among multiple users including atmsigd even on single processor
    > > > machines. Does this work with mutexes?
    > >
    > > afaik mutexes have the same behaviour as binary semaphores that are
    > > used as mutexes (always locked and unlocked by the same
    > > process/thread):

    Mutexes / binary semaphores / spinlocks are used to synchronize access
    to shared data by *multiple* threads ... there is no meaning in
    locking access to something if we know only one thread will ever touch

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2007-04-23 10:05    [W:0.020 / U:13.068 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site