Re: down_trylock doesn't preserve irqstate

From: David S. Miller (davem@redhat.com)
Date: Fri Feb 25 2000 - 17:58:12 EST


   Date: Fri, 25 Feb 2000 14:37:13 -0800
   From: Rajagopal Ananthanarayanan <ananth@sgi.com>

   One problem we encountered in using down_trylock is that
   __down_trylock() uses spin_lock_irq() and spin_unlock_irq(), which
   does not preserve the interrupt state of the caller.

You should not acquire a semaphore with interrupts disabled.

And if the semaphore sleeps, you'll end up with IRQs enabled when it
wakes up.

A few months ago we went scattering around fixing up places
which assumed IRQ state was preserved across sleep points,
let's not add new ones (and thus new bugs).

Later,
David S. Miller
davem@redhat.com

-
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/



This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:14 EST