From: "Richard B. Johnson" <root@chaos.analogic.com>
To: James Roper <u3205097@anu.edu.au>
Cc: Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: Kernel semaphores
Date: Tue, 14 Sep 2004 13:03:17 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.53.0409141250350.4132@chaos> (raw)
In-Reply-To: <20040914090512.7236a6da@lembas.zaitcev.lan>
On Tue, 14 Sep 2004 15:25:24 +1000
James Roper <u3205097@anu.edu.au> 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 use downXXX() and upXXX() to serialize user-access to your
driver in the usual APIs like read() and write().
You need to use spin-locks to protect critical sections
from being changed by interrupts. You need to do this
even if you are using downXXX() and upXXX(). Basically
downXXX() will cause a semaphore-contender to sleep. You
can't do this in an interrupt.
Any code in an ISR or on the timer-queue must never
execute downXXX(). It is possible, under extremely
strange circumstances to execute upXXX() from an
interrupt because it doesn't sleep, only releases
the lock (if the resource is locked). You don't
design anything to do this, though. It can be used
as a work-around to release a resource that was acquired
by a task that hung or died.
Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.
next prev parent reply other threads:[~2004-09-14 17:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1095139743.24686.linux-kernel2news@redhat.com>
2004-09-14 16:05 ` Pete Zaitcev
2004-09-14 17:03 ` Richard B. Johnson [this message]
2004-09-14 5:25 James Roper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.53.0409141250350.4132@chaos \
--to=root@chaos.analogic.com \
--cc=linux-kernel@vger.kernel.org \
--cc=u3205097@anu.edu.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®