From: Jake Moilanen <moilanen@austin.ibm.com>
To: Jan-Benedict Glaw <jbglaw@lug-owl.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH][RFC] Spinlock-timeout
Date: Thu, 10 Jun 2004 13:44:52 -0500 [thread overview]
Message-ID: <1086893091.3476.37.camel@dyn95394175.austin.ibm.com> (raw)
In-Reply-To: <20040605205117.GD20632@lug-owl.de>
On Sat, 2004-06-05 at 15:51, Jan-Benedict Glaw wrote:
> On Sat, 2004-06-05 15:31:26 -0500, Jake Moilanen <moilanen@austin.ibm.com>
> wrote in message <1086467486.20906.59.camel@dhcp-client215.upt.austin.ibm.com>:
> > Here's a patch that will BUG() when a spinlock is held for longer then X
> > seconds. It is useful for catching deadlocks since not all archs have a
> > NMI watchdog.
>
> I like the idea. However, I don't like touching all arch's Kconfig
> files. I think it's better to either put this into ./lib/Kconfig (well,
> doesn't really fit there), ot (even better:) put it into the Debug
> Kconfig file.
>
I think you're right that lib/Kconfig would not be the right place, but
I don't think there is a debug Kconfig. I tried keeping the Kconfig
additions w/ CONFIG_DEBUG_SPINLOCK. The other option is to make a debug
Kconfig, but every arch seems pretty different in what they have for
their debug section.
> I'd say just include <linux/jiffies.h> and drop the whole #ifdef/#endif
> block.
You're right, I'll take this out.
> > @@ -218,11 +228,27 @@
> > } while (0)
> >
> > #else
> > +#if defined(CONFIG_SPINLOCK_TIMEOUT)
> > +
> > +static inline void spin_lock(spinlock_t * lock) {
> > + unsigned long jiffy_timeout = jiffies + (SPINLOCK_TIMEOUT * HZ);
> > +
> > + preempt_disable();
> > + do {
> > + if (jiffies >= jiffy_timeout)
> > + BUG();
> > + } while (!_raw_spin_trylock(lock));
> > +}
> > +
> > +#else /* CONFIG_SPINLOCK_TIMEOUT */
> > +
> > #define spin_lock(lock) \
> > do { \
> > preempt_disable(); \
> > _raw_spin_lock(lock); \
> > } while(0)
> > +
> > +#endif /* CONFIG_SPINLOCK_TIMEOUT */
> >
> > #define write_lock(lock) \
> > do { \
>
> Also, printing out ->module, ->owner and ->oline might help additionally
> to just BUG()ing. So you see the (former) owner of the lock.
I think this would give us some extra info, but ->module, ->owner, and
->oline is only used for !SMP. I could add that in for all the arch's
spinlock_t in their asm/spinlock.h. I'm not sure how well that would be
received to increase the size of everyones spinlock_t even though it
would only be when CONFIG_DEBUG_SPINLOCK is on.
Thanks,
Jake
next prev parent reply other threads:[~2004-06-10 18:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-05 20:31 Jake Moilanen
2004-06-05 20:51 ` Jan-Benedict Glaw
2004-06-10 18:44 ` Jake Moilanen [this message]
2004-06-10 19:24 ` Jan-Benedict Glaw
2004-06-10 21:00 ` Randy.Dunlap
2004-06-06 10:13 ` Paul Mackerras
2004-06-06 22:23 ` Benjamin Herrenschmidt
2004-06-11 14:05 ` Jake Moilanen
2004-06-11 15:49 ` Benjamin Herrenschmidt
2004-06-11 21:19 ` moilanen
2004-06-11 22:08 ` Benjamin Herrenschmidt
2004-06-14 13:12 ` Jake Moilanen
2004-06-11 21:22 ` moilanen
2004-06-11 22:09 ` Benjamin Herrenschmidt
2004-06-14 13:13 ` Jake Moilanen
2004-06-11 14:08 ` Jake Moilanen
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=1086893091.3476.37.camel@dyn95394175.austin.ibm.com \
--to=moilanen@austin.ibm.com \
--cc=jbglaw@lug-owl.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®