Q: preemptible kernel and interrupts consistency.

From: Oleg Nesterov (oleg@tv-sign.ru)
Date: Thu Jul 11 2002 - 15:33:21 EST


Hello.

Documentation/preempt-locking.txt states, that
disabled interrupts prevents preemption.

Well, unless process does not touch TIF_NEED_RESCHED.
Consider:

        // preempt_count == 0
        local_irq_disable();
        set_tsk_need_resched(current);
        preempt_disable();
        preempt_enable();

We fall into the schedule() - possible preemtion,
interruppts ENABLED in any case.

Note that this may be implicit, for example:

        __cli();
        wake_up(q);
                // spin_lock_irqsave(&q->lock, flags)
                // __wake_up_common() - sets need_resched
                // spin_unlock_irqrestore(q->lock, flags)
                // spin_unlock()
                // preempt_enable()
                // irq_handler: I WAS HERE!!!
                // possible preemtion
                // local_irq_restore() - too late

Or I am just stupid?

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



This archive was generated by hypermail 2b29 : Mon Jul 15 2002 - 22:00:20 EST