Subject: Re: [PATCH net-next v2] net: remove delay at device dismantle

From: Gao feng <[email-masked]>
Date: Thu, 23 Aug 2012 10:25:00 +0800

于 2012年08月11日 13:54, Eric Dumazet 写道:
> On Fri, 2012-08-10 at 17:42 +0200, Eric Dumazet wrote:
>> From: Eric Dumazet <[email-masked]>
>>
>> I noticed extra one second delay in device dismantle, tracked down to
>> a call to dst_dev_event() while some call_rcu() are still in RCU queues.
>>
> ...
>> Signed-off-by: Eric Dumazet <[email-masked]>
>> Cc: Tom Herbert <[email-masked]>
>> Cc: Mahesh Bandewar <[email-masked]>
>> Cc: "Eric W. Biederman" <[email-masked]>
>> ---
>> v2: NETDEV_UNREGISTER_FINAL called outside of rtnl lock
>>     as its more risky, base this patch on net-next
> 
> Also I am leaving for a one week vacation with no access to the
> Internet, so better hold this patch until my return ;)
> 

Hi Eric

I got this warning message with your patch applied.

Aug 22 18:32:56 Donkey kernel: [  124.733048] ===============================
Aug 22 18:32:56 Donkey kernel: [  124.733051] [ INFO: suspicious RCU usage. ]
Aug 22 18:32:56 Donkey kernel: [  124.733054] 3.6.0-rc1+ #14 Not tainted
Aug 22 18:32:56 Donkey kernel: [  124.733057] -------------------------------
Aug 22 18:32:56 Donkey kernel: [  124.733060] include/linux/inetdevice.h:229 suspicious rcu_dereference_protected() usage!
Aug 22 18:32:56 Donkey kernel: [  124.733062]
Aug 22 18:32:56 Donkey kernel: [  124.733062] other info that might help us debug this:
Aug 22 18:32:56 Donkey kernel: [  124.733062]
Aug 22 18:32:56 Donkey kernel: [  124.733066]
Aug 22 18:32:56 Donkey kernel: [  124.733066] rcu_scheduler_active = 1, debug_locks = 1
Aug 22 18:32:56 Donkey kernel: [  124.733069] 3 locks held by kworker/u:1/39:
Aug 22 18:32:56 Donkey kernel: [  124.733072]  #0:  (netns){.+.+.+}, at: [<ffffffff8107e117>] process_one_work+0x137/0x5d0
Aug 22 18:32:56 Donkey kernel: [  124.733086]  #1:  (net_cleanup_work){+.+.+.}, at: [<ffffffff8107e117>] process_one_work+0x137/0x5d0
Aug 22 18:32:56 Donkey kernel: [  124.733095]  #2:  (net_mutex){+.+.+.}, at: [<ffffffff81542fd5>] cleanup_net+0x85/0x1a0
Aug 22 18:32:56 Donkey kernel: [  124.733106]
Aug 22 18:32:56 Donkey kernel: [  124.733106] stack backtrace:
Aug 22 18:32:56 Donkey kernel: [  124.733110] Pid: 39, comm: kworker/u:1 Not tainted 3.6.0-rc1+ #14
Aug 22 18:32:56 Donkey kernel: [  124.733112] Call Trace:
Aug 22 18:32:56 Donkey kernel: [  124.733120]  [<ffffffff810c2312>] lockdep_rcu_suspicious+0xe2/0x130
Aug 22 18:32:56 Donkey kernel: [  124.733127]  [<ffffffff815d35d4>] fib_netdev_event+0x114/0x180
Aug 22 18:32:56 Donkey kernel: [  124.733133]  [<ffffffff816914cc>] notifier_call_chain+0x5c/0x120
Aug 22 18:32:56 Donkey kernel: [  124.733139]  [<ffffffff8108d6b6>] raw_notifier_call_chain+0x16/0x20
Aug 22 18:32:56 Donkey kernel: [  124.733144]  [<ffffffff8154585c>] call_netdevice_notifiers+0x3c/0x70
Aug 22 18:32:56 Donkey kernel: [  124.733149]  [<ffffffff8154f88c>] netdev_run_todo+0x8c/0x280
Aug 22 18:32:56 Donkey kernel: [  124.733154]  [<ffffffff81544c9d>] ? synchronize_net+0x2d/0x40
Aug 22 18:32:56 Donkey kernel: [  124.733159]  [<ffffffff8155b90e>] rtnl_unlock+0xe/0x10
Aug 22 18:32:56 Donkey kernel: [  124.733164]  [<ffffffff81546c1a>] default_device_exit_batch+0xba/0xd0
Aug 22 18:32:56 Donkey kernel: [  124.733170]  [<ffffffff81542275>] ops_exit_list+0x55/0x60
Aug 22 18:32:56 Donkey kernel: [  124.733175]  [<ffffffff8154304b>] cleanup_net+0xfb/0x1a0
Aug 22 18:32:56 Donkey kernel: [  124.733180]  [<ffffffff8107e178>] process_one_work+0x198/0x5d0
Aug 22 18:32:56 Donkey kernel: [  124.733185]  [<ffffffff8107e117>] ? process_one_work+0x137/0x5d0
Aug 22 18:32:56 Donkey kernel: [  124.733191]  [<ffffffff8168b2b8>] ? __schedule+0x428/0x910
Aug 22 18:32:56 Donkey kernel: [  124.733196]  [<ffffffff81080951>] ? worker_thread+0x2a1/0x4b0
Aug 22 18:32:56 Donkey kernel: [  124.733201]  [<ffffffff81542f50>] ? net_drop_ns+0x50/0x50
Aug 22 18:32:56 Donkey kernel: [  124.733207]  [<ffffffff8108083a>] worker_thread+0x18a/0x4b0
Aug 22 18:32:56 Donkey kernel: [  124.733212]  [<ffffffff810806b0>] ? manage_workers+0x2a0/0x2a0
Aug 22 18:32:56 Donkey kernel: [  124.733217]  [<ffffffff810867de>] kthread+0xae/0xc0
Aug 22 18:32:56 Donkey kernel: [  124.733222]  [<ffffffff810c39cd>] ? trace_hardirqs_on+0xd/0x10
Aug 22 18:32:56 Donkey kernel: [  124.733227]  [<ffffffff81697044>] kernel_thread_helper+0x4/0x10
Aug 22 18:32:56 Donkey kernel: [  124.733233]  [<ffffffff8168d570>] ? retint_restore_args+0x13/0x13
Aug 22 18:32:56 Donkey kernel: [  124.733237]  [<ffffffff81086730>] ? flush_kthread_work+0x1a0/0x1a0
Aug 22 18:32:56 Donkey kernel: [  124.733242]  [<ffffffff81697040>] ? gs_change+0x13/0x13
Aug 22 18:32:56 Donkey kernel: [  124.733248]
Aug 22 18:32:56 Donkey kernel: [  124.733250] ===============================