title: Usage of spinlock and cli together
body: <p>I recently downloaded linux source from <a href="http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.34.1.tar.bz2" rel="nofollow noreferrer">http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.34.1.tar.bz2</a> . I came across the below paragraph in the file called spinlocks.txt in linux-2.6.34.1\Documentation folder.</p>
  
  <p>" it <em>does</em> mean that if you have some code that does</p>
  
  <pre><code>cli();
  .. critical section ..
  sti();
  </code></pre>
  
  <p>and another sequence that does</p>
  
  <pre><code>spin_lock_irqsave(flags);
  .. critical section ..
  spin_unlock_irqrestore(flags);
  </code></pre>
  
  <p>then they are NOT mutually exclusive, and the critical regions can happen
  at the same time on two different CPU's. That's fine per se, but the
  critical regions had better be critical for different things (ie they
  can't stomp on each other). "</p>
  
  <p>How can they impact if some code is using cli()/sti() and other part of the same code uses spin_lock_irqsave(flags)/spin_unlock_irqrestore(flags) ?</p>