netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ebiederm@xmission.com
Cc: herbert@gondor.apana.org.au, netdev@vger.kernel.org, kaber@trash.net
Subject: Re: [PATCH] rtnl: Simplify ASSERT_RTNL
Date: Thu, 11 Oct 2007 17:30:46 -0700 (PDT)	[thread overview]
Message-ID: <20071011.173046.66166737.davem@davemloft.net> (raw)
In-Reply-To: <m1tzoxehlo.fsf@ebiederm.dsl.xmission.com>

From: ebiederm@xmission.com (Eric W. Biederman)
Date: Thu, 11 Oct 2007 10:33:39 -0600

> Having ASSERT_RTNL warn if you were sleeping does not seem
> intuitive from the name.
> 
> This instance of convoluted locking seems like a complete
> one off to me, and if it will warn about other constructs
> currently in the kernel it seems wrong.

RTNL is a semaphore, therefore it sleeps.

Therefore anything that requires RTNL is held can also assume that it
can do things like GFP_KERNEL allocations and other sleeping actions.

This is why any code path that runs with spinlocks held or interrupts
disabled, and hits an RTNL assertion, is buggy.  It is the chain of
dependencies of what is allowed in such contexts.

	ASSERT_RTNL();
	page = alloc_page(GFP_KERNEL);

That sequence above is absolutely always legal.

The might_sleep() check is just letting us know the problem exists.

If spinlocks or interrupt disabling is needed to implement something
deeper in the call chain, that's fine, it just cannot call back into
the RTNL asserted domain with those spinlocks held or interrupts
disabled.

If the mac_vlan driver, or whichever one has the problem, does things
like this it must be fixed and putting or not putting a proper
might_sleep() check here doesn't change that.

  reply	other threads:[~2007-10-12  0:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-29  0:59 [PATCH] rtnl: Simplify ASSERT_RTNL Eric W. Biederman
2007-09-29  4:31 ` Herbert Xu
2007-09-29 15:32   ` Patrick McHardy
2007-09-30  0:24     ` Herbert Xu
2007-09-30 15:47       ` Patrick McHardy
2007-10-02  9:28         ` Herbert Xu
2007-10-02 15:29           ` Patrick McHardy
2007-10-03  6:06             ` Herbert Xu
2007-10-08  4:40               ` Patrick McHardy
2007-09-29 17:18   ` Eric W. Biederman
2007-09-29 17:51     ` Patrick McHardy
2007-09-30  0:28     ` Herbert Xu
2007-10-11  4:16 ` David Miller
2007-10-11  6:57   ` Eric W. Biederman
2007-10-11  7:12     ` Herbert Xu
2007-10-11  8:23       ` Eric W. Biederman
2007-10-11  8:28         ` Herbert Xu
2007-10-11 16:33           ` Eric W. Biederman
2007-10-12  0:30             ` David Miller [this message]
2007-10-12  3:15               ` Eric W. Biederman

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=20071011.173046.66166737.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kaber@trash.net \
    --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).