From: george anzinger <george@mvista.com>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] improve spinlock debugging
Date: Tue, 04 Dec 2001 16:54:05 -0800 [thread overview]
Message-ID: <3C0D702D.8160CC85@mvista.com> (raw)
In-Reply-To: <3C0BDC33.6E18C815@colorfullife.com> <3C0D3283.4DA4DD2B@mvista.com> <3C0D37E0.5382B42E@colorfullife.com>
Manfred Spraul wrote:
>
> george anzinger wrote:
> >
> > Manfred Spraul wrote:
> > >
> > > CONFIG_DEBUG_SPINLOCK only adds spinlock tests for SMP builds. The
> > > attached patch adds runtime checks for uniprocessor builds.
> > >
> > > Tested on i386/UP, but it should work on all platforms. It contains
> > > runtime checks for:
> > >
> > > - missing initialization
> > > - recursive lock
> > > - double unlock
> > > - incorrect use of spin_is_locked() or spin_trylock() [both function
> > > do not work as expected on uniprocessor builds]
> > > The next step are checks for spinlock ordering mismatches.
> >
> > What do you consider an order mismatch? I would like to see this:
> >
> spin_lock(a);
> spin_lock(b);
>
> and somewhere else
> spin_lock(b);
> spin_lock(a);
>
> >
> > Run time checks for xxx_irq when irq is already off seem reasonable.
> > The implication is that the xxx_unlockirq will then turn it on, which
> > most likely is an error. Also, see above about rolling assumptions in
> > to the macro name.
> >
> Unfortuantely there are still a few special cases where spin_lock_irq()
> with already disabled interrupts is both intentional and correct^wnot
> buggy (search for sleep_on and cli() through the lkml archives).
>
> And there are optimizations such as
> spin_lock_bh(a);
> spin_unlock(b);
> spin_lock(b);
> spin_unlock_bh(b);
>
Dam the special case! Full speed ahead!
But really, there will always be exceptions, but they should be noted
(and commented upon). To hide them in obscurity, and worst yet, allow
them to dictate that we can not do better is a crime. There are tricks
that can be used to help us in these cases, if we just set our
collective minds to it.
--
George george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
Real time sched: http://sourceforge.net/projects/rtsched/
next prev parent reply other threads:[~2001-12-05 0:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-03 20:10 [PATCH] improve spinlock debugging Manfred Spraul
2001-12-04 4:21 ` David S. Miller
2001-12-04 4:30 ` Robert Love
2001-12-04 20:30 ` george anzinger
2001-12-04 20:51 ` Robert Love
2001-12-04 21:25 ` george anzinger
2001-12-04 21:39 ` Robert Love
2001-12-04 22:06 ` Nigel Gamble
2001-12-04 22:23 ` Robert Love
2001-12-05 1:13 ` Roman Zippel
2001-12-05 7:41 ` george anzinger
2001-12-04 20:53 ` Manfred Spraul
2001-12-05 0:54 ` george anzinger [this message]
2001-12-04 21:20 ` Nigel Gamble
2001-12-04 21:27 ` george anzinger
2001-12-05 8:47 ` Giuliano Pochini
2001-12-05 15:42 ` Manfred Spraul
[not found] ` <20011219025332.GA18344@krispykreme>
2001-12-20 17:08 ` Manfred Spraul
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=3C0D702D.8160CC85@mvista.com \
--to=george@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
/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