lkml.org 
[lkml]   [2000]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: down_trylock doesn't preserve irqstate
"David S. Miller" wrote:
>
> 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).

Right, if it were a sleep point, I agree.
But my understanding is that down_trylock()
is not one of those: isn't it used for conditionally
acquiring the semaphore? That is, if semaphore available,
get the semaphore, otherwise don't bother?
And a quick check reveals __down_trylock is used
only in down_trylock path, not by down() variants
which can sleep.

regards,

ananth.

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

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.115 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site