lkml.org 
[lkml]   [1998]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectInterrupts with SMP defined
In recent kernels I have noticed a problem which causes my system to hang.
It is related to the way that the routines which deal with turning
interrupts on and off are defined when the kernel is compiled with SMP=1.
I am using a uniprocessor machine so my first question is should a
kernel with SMP defined run correctly on a single processor machine?
What happens is that a save_flags, restore flags sequence inside of a
section of code protected by a spinlock turns interupts back on.

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

\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.137 / U:0.732 seconds]
©2003-2011 Jasper Spaans. Advertise on this site