spin_lock_irqsave(&some_lock, flags1);
/* interupts now off */
save_flags(flags2);
cli();
restore_flags(flags2);
/* interupts are back on, bad stuff happens */
spin_unlock_irqrestore(&some_lock, flags1);
This happens because the above code turns into a mix of calls to the
__save_flags(), __cli(), __restore_flags() and
__global_save_flags(), __global_restore_flags()
functions.
The call to save_flags above becomes __global_save_flags() which is just
the code:
unsigned long __global_save_flags(void)
{
if (!local_irq_count[smp_processor_id()])
return global_irq_holder == (unsigned char) smp_processor_id();
else {
unsigned long x;
__save_flags(x);
return x;
}
}
The kernel enters the if part with global_irq_holder set to NO_PROC_ID so
the function returns 0. The successive call to __global_restore_flags
with flags having a value of 0 turns interrupts on.
chris
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu