lkml.org 
[lkml]   [1999]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    Subjectproblem in md?
    Hi Ingo,
    IIRC I suspected a possible problem in md_thread() a few weeks ago, and
    I proved wrong. But now I'm sure that there could be a problem!

    md_thread calls

    cli()
    for(;;) {
    interruptible_sleep_on()
    cli();
    do_something().
    }

    are you aware that do_something() is called WITHOUT the global interrupt
    lock held?

    Let me explain it:
    * the initial cli() disables the local interrupts, and acquires the
    global lock.
    * interruptible_sleep_on() calls spin_lock_irqsave(), and this saves the
    _local_ interrupt flag on the stack.
    * schedule() releases the global interrupt lock.
    * schedule() eventually returns, and interruptible_sleep_on() restores
    the _local_ interrupt flag. (hidden in wq_write_unlock_irqrestore().)
    * __global_cli() notices that the local interrupts are disabled, and
    downgrades the global lock to a local lock.

    I think you should add an sti() just before the cli(). You cannot call
    the sti() before interruptible_sleep_on(), this could cause a race.

    Please correct me if I'm wrong,

    Manfred

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:54    [W:0.019 / U:1.916 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site