From: viro@parcelfarce.linux.theplanet.co.uk
To: Heiko.Rabe@InVision.de
Cc: linux-kernel@vger.kernel.org
Subject: Re: inconsistent usage of
Date: Tue, 22 Apr 2003 10:21:38 +0100 [thread overview]
Message-ID: <20030422092138.GS10374@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <OF07767E6D.29E660DD-ONC1256D10.002B8A2D@invision.de>
On Tue, Apr 22, 2003 at 10:11:11AM +0200, Heiko.Rabe@InVision.de wrote:
> I found inconsistent behavoir between SMP oand none SMP kernels using spin
> locks inside driver programming
> As first an simple example:
>
> static spinlock_t qtlock = SPIN_LOCK_UNLOCKED;
>
> void foo()
> {
> unsigned long local_flags;
> spin_lock_irqsave (&qtlock, local_flags);
> spin_lock_irqsave (&qtlock, local_flags);
> }
>
> Calling the function foo() works proper in none SMP kernels. I assume, the
... only because spinlocks are no-op on UP.
> spinlocks internaly will be initialized as
> recursive semaphore as default. So it is possible to aquire it more than
> once by the same thread.
Spinlocks are *not* recursive. The code above is a bug - it's just that
on non-SMP it doesn't get caught.
Spinlock is a mutex, not a recursive sempahore.
next prev parent reply other threads:[~2003-04-22 9:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-22 8:11 Heiko.Rabe
2003-04-22 8:40 ` Duncan Sands
2003-04-22 9:21 ` viro [this message]
2003-04-22 9:25 ` Jens Axboe
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=20030422092138.GS10374@parcelfarce.linux.theplanet.co.uk \
--to=viro@parcelfarce.linux.theplanet.co.uk \
--cc=Heiko.Rabe@InVision.de \
--cc=linux-kernel@vger.kernel.org \
/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®