From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Paul E. McKenney" Subject: Re: [BUG net-next-2.6] fib: Some rcu warning Date: Wed, 14 Apr 2010 13:33:42 -0700 Message-ID: <20100414203342.GB24414@linux.vnet.ibm.com> References: <1271274844.16881.1743.camel@edumazet-laptop> Reply-To: paulmck@linux.vnet.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev To: Eric Dumazet Return-path: Received: from e1.ny.us.ibm.com ([32.97.182.141]:59864 "EHLO e1.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755910Ab0DNUdo (ORCPT ); Wed, 14 Apr 2010 16:33:44 -0400 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e1.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id o3EKSobG005432 for ; Wed, 14 Apr 2010 16:28:50 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o3EKXh3F2003170 for ; Wed, 14 Apr 2010 16:33:43 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o3EKXhES023514 for ; Wed, 14 Apr 2010 16:33:43 -0400 Content-Disposition: inline In-Reply-To: <1271274844.16881.1743.camel@edumazet-laptop> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, Apr 14, 2010 at 09:54:04PM +0200, Eric Dumazet wrote: > [ 27.756998] IPv4 FIB: Using LC-trie version 0.409 > [ 27.757121] > [ 27.757121] =================================================== > [ 27.757228] [ INFO: suspicious rcu_dereference_check() usage. ] > [ 27.757285] --------------------------------------------------- > [ 27.757342] net/ipv4/fib_trie.c:212 invoked rcu_dereference_check() > without protection! Looks like this needs to allow for RTNL. Please see below for a patch. Other places in this file might also need this. Thanx, Paul > [ 27.757417] > [ 27.757417] other info that might help us debug this: > [ 27.757418] > [ 27.757569] > [ 27.757570] rcu_scheduler_active = 1, debug_locks = 0 > [ 27.757674] 2 locks held by ip/5686: > [ 27.757727] #0: (rtnl_mutex){+.+.+.}, at: [] > rtnl_lock+0x17/0x20 > [ 27.757936] #1: ((inetaddr_chain).rwsem){.+.+.+}, at: > [] __blocking_notifier_call_chain+0x47/0x90 > [ 27.758148] > [ 27.758149] stack backtrace: > [ 27.758249] Pid: 5686, comm: ip Not tainted > 2.6.34-rc3-03164-gb4bf665-dirty #10 > [ 27.758323] Call Trace: > [ 27.758377] [] lockdep_rcu_dereference+0xaf/0xc0 > [ 27.758437] [] fib_find_node+0x19c/0x220 > [ 27.758495] [] fib_table_insert+0xac/0x760 > [ 27.758552] [] ? fib_get_table+0x91/0xd0 > [ 27.758609] [] ? fib_get_table+0x28/0xd0 > [ 27.758667] [] fib_magic+0x111/0x120 > [ 27.758723] [] fib_add_ifaddr+0x130/0x170 > [ 27.758780] [] fib_inetaddr_event+0x5c/0x290 > [ 27.758838] [] notifier_call_chain+0x58/0x80 > [ 27.758896] [] __blocking_notifier_call_chain > +0x5d/0x90 > [ 27.758956] [] blocking_notifier_call_chain > +0x16/0x20 > [ 27.759016] [] __inet_insert_ifa+0xd4/0x170 > [ 27.759089] [] inet_insert_ifa+0x12/0x20 > [ 27.759146] [] inetdev_event+0x400/0x430 > [ 27.759204] [] ? netlink_broadcast+0x262/0x3f0 > [ 27.759263] [] ? fib_rules_event+0x21/0x180 > [ 27.759320] [] notifier_call_chain+0x58/0x80 > [ 27.759378] [] __raw_notifier_call_chain+0xe/0x10 > [ 27.759436] [] raw_notifier_call_chain+0x16/0x20 > [ 27.761102] [] call_netdevice_notifiers+0x1b/0x20 > [ 27.761161] [] __dev_notify_flags+0x7d/0x90 > [ 27.761219] [] dev_change_flags+0x45/0x70 > [ 27.761278] [] devinet_ioctl+0x5e9/0x770 > [ 27.761336] [] inet_ioctl+0x61/0x80 > [ 27.761392] [] sock_do_ioctl+0x32/0x60 > [ 27.761449] [] compat_sock_ioctl+0x89c/0xb60 > [ 27.761507] [] ? __lock_acquire+0x486/0xaf0 > [ 27.761567] [] ? __do_fault+0x12b/0x480 > [ 27.761624] [] ? filemap_fault+0xd3/0x3d0 > [ 27.761683] [] ? fget_light+0x174/0x360 > [ 27.761740] [] ? __do_fault+0x339/0x480 > [ 27.761798] [] compat_sys_ioctl+0xd3/0x1900 > [ 27.761856] [] ? handle_mm_fault+0x19a/0x780 > [ 27.761915] [] ? do_page_fault+0xe2/0x3b0 > [ 27.761972] [] ? up_read+0x23/0x40 > [ 27.762028] [] ? do_page_fault+0x1a5/0x3b0 > [ 27.762087] [] ? _raw_spin_unlock+0x2b/0x40 > [ 27.762145] [] ? fd_install+0xa8/0xe0 > [ 27.762202] [] ? sock_map_fd+0x2d/0x40 > [ 27.762259] [] ? retint_swapgs+0xe/0x13 > [ 27.762331] [] ? trace_hardirqs_on_caller > +0x10d/0x190 > [ 27.762391] [] ? trace_hardirqs_off_thunk > +0x3a/0x3c > [ 27.762450] [] sysenter_dispatch+0x7/0x30 > [ 27.762507] [] ? trace_hardirqs_on_thunk+0x3a/0x3f commit 3f69d3dbdd2468f13591b676ca36b3d61d1a1294 Author: Paul E. McKenney Date: Wed Apr 14 13:30:13 2010 -0700 net: fix RCU lockdep splat in tnode_get_child_rcu() Located-by: Eric Dumazet Signed-off-by: Paul E. McKenney diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index af5d897..45bda1f 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c @@ -208,7 +208,8 @@ static inline struct node *tnode_get_child_rcu(struct tnode *tn, unsigned int i) { struct node *ret = tnode_get_child(tn, i); - return rcu_dereference(ret); + return rcu_dereference_check(ret, + rcu_read_lock_held() || rtnl_is_locked()); } static inline int tnode_child_length(const struct tnode *tn)