From: Andrew Morton <akpm@linux-foundation.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [patch 2/4] net: use mutex_is_locked() for ASSERT_RTNL()
Date: Sat, 15 Dec 2007 02:48:10 -0800 [thread overview]
Message-ID: <20071215024810.20b8a5ae.akpm@linux-foundation.org> (raw)
In-Reply-To: <20071215061021.GA26247@gondor.apana.org.au>
On Sat, 15 Dec 2007 14:10:21 +0800 Herbert Xu <herbert@gondor.apana.org.au> wrote:
> On Fri, Dec 14, 2007 at 09:44:18PM -0800, Andrew Morton wrote:
> >
> > That sounds like a bug in mutex_trylock() to me.
>
> I was relying on
>
> http://kerneltrap.org/mailarchive/linux-netdev/2007/9/28/325129
>
> which seems to be a bogus claim now that I actually look at the
> source code. So in that case I'm OK with your patch as long as
> it warns about hard IRQ usage.
When Eric said
> Way way deep in mutex debugging on the slowpath there is a unreadable
> and incomprehensible WARN_ON in muxtex_trylock that will trigger if
> you have 10 tons of debugging turned on, and you are in,
> interrupt context, and you manage to hit the slow path. I think that
> is a pretty unlikely scenario.
I think he's still right. That's if the warning which he managed to find
even still exists.
I think the change which Eric proposed is a good one: it converts
ASSERT_RTNL() from an atomic rmw which dirties a cacheline which will
sometimes be owned by a different CPU into a plain old read. It's going to
make ASSERT_RTNL() heaps cheaper.
<looks at mutex_is_locked(), rofls at "static inline fastcall", fixes it>
Now as a separate issue we (ie: you) need to work out what _other_ things
you want ASSERT_RTNL to check apart from "rtnl must be held".
If you want to check that no locks are held (which I think is a bit weird,
but whatever) then add might_sleep().
If you want to check that we're not in interrupt context or whatever, then
add the checks and be happy. might_sleep() will of course check for
in_interrupt(), in_irq(), etc so if you go with a might_sleep() then
nothing else needs to be added.
While doing this I'd also suggest that the thing should be uninlined -
it'll probably generate less text and it'll give considerably more
flexibility for adding new debug fetures. Ones which might be controlled at
compile time or runtime. ie:
void __assert_rtnl(const char *file, int line);
#define ASSERT_RTNL() __assert_rtnl(__FILE__, __LINE__)
next prev parent reply other threads:[~2007-12-15 10:48 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-14 0:02 [patch 2/4] net: use mutex_is_locked() for ASSERT_RTNL() akpm
2007-12-14 8:10 ` Herbert Xu
2007-12-14 8:22 ` Andrew Morton
2007-12-14 8:30 ` Herbert Xu
2007-12-14 19:15 ` David Miller
2007-12-14 23:11 ` Andrew Morton
2007-12-15 4:18 ` Herbert Xu
2007-12-15 5:44 ` Andrew Morton
2007-12-15 6:10 ` Herbert Xu
2007-12-15 10:48 ` Andrew Morton [this message]
2007-12-15 13:10 ` Herbert Xu
2007-12-16 5:44 ` David Miller
2007-12-16 7:13 ` Herbert Xu
2007-12-16 18:06 ` Jarek Poplawski
2007-12-17 1:26 ` Herbert Xu
2007-12-17 7:26 ` Jarek Poplawski
2007-12-17 7:31 ` Herbert Xu
2007-12-17 7:57 ` Jarek Poplawski
2007-12-17 7:44 ` Jarek Poplawski
2007-12-16 5:37 ` David Miller
2007-12-14 12:37 ` Johannes Berg
2007-12-14 12:46 ` Herbert Xu
2007-12-14 12:54 ` Johannes Berg
2007-12-14 19:30 ` David Miller
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=20071215024810.20b8a5ae.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).