Return-path: Received: from na3sys009aog124.obsmtp.com ([74.125.149.151]:58043 "HELO na3sys009aog124.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1759083Ab3GZRI0 (ORCPT ); Fri, 26 Jul 2013 13:08:26 -0400 Received: by mail-qc0-f169.google.com with SMTP id c10so1717925qcz.28 for ; Fri, 26 Jul 2013 10:08:25 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20130726090010.GA1756@redhat.com> References: <20130712074911.01b5945a@corrin.poochiereds.net> <20130724095911.GA1637@redhat.com> <20130725105116.043a6b9c@corrin.poochiereds.net> <20130726090010.GA1756@redhat.com> Date: Fri, 26 Jul 2013 10:08:25 -0700 Message-ID: (sfid-20130726_190902_050403_AEA0E567) Subject: Re: [PATCH 3.11] genetlink: release cb_lock before requesting additional module From: Pravin Shelar To: Stanislaw Gruszka Cc: "David S. Miller" , linux-wireless@vger.kernel.org, linville@tuxdriver.com, netdev@vger.kernel.org, Thomas Graf , Stephen Hemminger , rjones@redhat.com, Marcel Holtmann , Jeff Layton Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-wireless-owner@vger.kernel.org List-ID: On Fri, Jul 26, 2013 at 2:00 AM, Stanislaw Gruszka wrote: > Requesting external module with cb_lock taken can result in > the deadlock like showed below: > > [ 2458.111347] Showing all locks held in the system: > [ 2458.111347] 1 lock held by NetworkManager/582: > [ 2458.111347] #0: (cb_lock){++++++}, at: [] genl_rcv+0x19/0x40 > [ 2458.111347] 1 lock held by modprobe/603: > [ 2458.111347] #0: (cb_lock){++++++}, at: [] genl_lock_all+0x15/0x30 > > [ 2461.579457] SysRq : Show Blocked State > [ 2461.580103] task PC stack pid father > [ 2461.580103] NetworkManager D ffff880034b84500 4040 582 1 0x00000080 > [ 2461.580103] ffff8800197ff720 0000000000000046 00000000001d5340 ffff8800197fffd8 > [ 2461.580103] ffff8800197fffd8 00000000001d5340 ffff880019631700 7fffffffffffffff > [ 2461.580103] ffff8800197ff880 ffff8800197ff878 ffff880019631700 ffff880019631700 > [ 2461.580103] Call Trace: > [ 2461.580103] [] schedule+0x29/0x70 > [ 2461.580103] [] schedule_timeout+0x1c1/0x360 > [ 2461.580103] [] ? mark_held_locks+0xbb/0x140 > [ 2461.580103] [] ? _raw_spin_unlock_irq+0x2c/0x50 > [ 2461.580103] [] ? trace_hardirqs_on_caller+0xfd/0x1c0 > [ 2461.580103] [] wait_for_completion_killable+0xe8/0x170 > [ 2461.580103] [] ? wake_up_state+0x20/0x20 > [ 2461.580103] [] call_usermodehelper_exec+0x1a5/0x210 > [ 2461.580103] [] ? wait_for_completion_killable+0x3d/0x170 > [ 2461.580103] [] __request_module+0x1b3/0x370 > [ 2461.580103] [] ? trace_hardirqs_on_caller+0xfd/0x1c0 > [ 2461.580103] [] ctrl_getfamily+0x159/0x190 > [ 2461.580103] [] genl_family_rcv_msg+0x1f4/0x2e0 > [ 2461.580103] [] ? genl_family_rcv_msg+0x2e0/0x2e0 > [ 2461.580103] [] genl_rcv_msg+0x8e/0xd0 > [ 2461.580103] [] netlink_rcv_skb+0xa9/0xc0 > [ 2461.580103] [] genl_rcv+0x28/0x40 > [ 2461.580103] [] netlink_unicast+0xdd/0x190 > [ 2461.580103] [] netlink_sendmsg+0x329/0x750 > [ 2461.580103] [] sock_sendmsg+0x99/0xd0 > [ 2461.580103] [] ? local_clock+0x5f/0x70 > [ 2461.580103] [] ? lock_release_non_nested+0x308/0x350 > [ 2461.580103] [] ___sys_sendmsg+0x39e/0x3b0 > [ 2461.580103] [] ? kvm_clock_read+0x2f/0x50 > [ 2461.580103] [] ? sched_clock+0x9/0x10 > [ 2461.580103] [] ? sched_clock_local+0x1d/0x80 > [ 2461.580103] [] ? sched_clock_cpu+0xa8/0x100 > [ 2461.580103] [] ? trace_hardirqs_off+0xd/0x10 > [ 2461.580103] [] ? local_clock+0x5f/0x70 > [ 2461.580103] [] ? lock_release_holdtime.part.28+0xf/0x1a0 > [ 2461.580103] [] ? fget_light+0xf9/0x510 > [ 2461.580103] [] ? fget_light+0x3c/0x510 > [ 2461.580103] [] __sys_sendmsg+0x42/0x80 > [ 2461.580103] [] SyS_sendmsg+0x12/0x20 > [ 2461.580103] [] system_call_fastpath+0x16/0x1b > [ 2461.580103] modprobe D ffff88000f2c8000 4632 603 602 0x00000080 > [ 2461.580103] ffff88000f04fba8 0000000000000046 00000000001d5340 ffff88000f04ffd8 > [ 2461.580103] ffff88000f04ffd8 00000000001d5340 ffff8800377d4500 ffff8800377d4500 > [ 2461.580103] ffffffff81d0b260 ffffffff81d0b268 ffffffff00000000 ffffffff81d0b2b0 > [ 2461.580103] Call Trace: > [ 2461.580103] [] schedule+0x29/0x70 > [ 2461.580103] [] rwsem_down_write_failed+0xed/0x1a0 > [ 2461.580103] [] ? update_cpu_load_active+0x10/0xb0 > [ 2461.580103] [] call_rwsem_down_write_failed+0x13/0x20 > [ 2461.580103] [] ? down_write+0x9d/0xb2 > [ 2461.580103] [] ? genl_lock_all+0x15/0x30 > [ 2461.580103] [] genl_lock_all+0x15/0x30 > [ 2461.580103] [] genl_register_family+0x53/0x1f0 > [ 2461.580103] [] ? 0xffffffffa01dbfff > [ 2461.580103] [] genl_register_family_with_ops+0x20/0x80 > [ 2461.580103] [] ? 0xffffffffa01dbfff > [ 2461.580103] [] nl80211_init+0x24/0xf0 [cfg80211] > [ 2461.580103] [] ? 0xffffffffa01dbfff > [ 2461.580103] [] cfg80211_init+0x43/0xdb [cfg80211] > [ 2461.580103] [] do_one_initcall+0xfa/0x1b0 > [ 2461.580103] [] ? set_memory_nx+0x43/0x50 > [ 2461.580103] [] load_module+0x1c6f/0x27f0 > [ 2461.580103] [] ? store_uevent+0x40/0x40 > [ 2461.580103] [] SyS_finit_module+0x86/0xb0 > [ 2461.580103] [] system_call_fastpath+0x16/0x1b > [ 2461.580103] Sched Debug Version: v0.10, 3.11.0-0.rc1.git4.1.fc20.x86_64 #1 > > Problem start to happen after adding net-pf-16-proto-16-family-nl80211 > alias name to cfg80211 module by below commit (though that commit > itself is perfectly fine): > > commit fb4e156886ce6e8309e912d8b370d192330d19d3 > Author: Marcel Holtmann > Date: Sun Apr 28 16:22:06 2013 -0700 > > nl80211: Add generic netlink module alias for cfg80211/nl80211 > > Reported-and-tested-by: Jeff Layton > Reported-by: Richard W.M. Jones > Signed-off-by: Stanislaw Gruszka > --- > net/netlink/genetlink.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c > index 2fd6dbe..1076fe1 100644 > --- a/net/netlink/genetlink.c > +++ b/net/netlink/genetlink.c > @@ -877,8 +877,10 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info) > #ifdef CONFIG_MODULES > if (res == NULL) { > genl_unlock(); > + up_read(&cb_lock); > request_module("net-pf-%d-proto-%d-family-%s", > PF_NETLINK, NETLINK_GENERIC, name); > + down_read(&cb_lock); > genl_lock(); > res = genl_family_find_byname(name); > } This is genl issue and it was introduced by commit def3117493eafd (genl: Allow concurrent genl callbacks.). Reviewed-by: Pravin B Shelar > -- > 1.7.11.7 > > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html