Re: Kernel semaphores

From: Pete Zaitcev
Date: Tue Sep 14 2004 - 11:28:54 EST


On Tue, 14 Sep 2004 15:25:24 +1000
James Roper <u3205097@xxxxxxxxxx> wrote:

> [] So my question is, if my semaphore is
> causing that error, what possible things could be triggering it? Could it be
> an interrupt while waiting to acquire the semaphore? I'm using the
> down_interruptible() to acquire and up() to release.

You have to use spinlocks to provide a mutual exclusion to interrupts.
However, a process on CPU cannot sleep while holding a spinlock. So,
sometimes it's needed to create a derivative locking scheme, based
on spinlocks. A common trick is to combine semaphores and spinlocks.
I cannot be more specific without knowing your code.

-- Pete
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/