From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Shi, Yang" Subject: Warning triggered by lockdep checks for sock_owned_by_user on linux-next-20160420 Date: Fri, 22 Apr 2016 21:02:10 -0700 Message-ID: <571AF3C2.3010509@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: LKML , Network Development To: "David S. Miller" , hannes@stressinduktion.org Return-path: Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org Hi David, When I ran some test on a nfs mounted rootfs, I got the below warning with LOCKDEP enabled on linux-next-20160420: WARNING: CPU: 9 PID: 0 at include/net/sock.h:1408 udp_queue_rcv_skb+0x3d0/0x660 Modules linked in: CPU: 9 PID: 0 Comm: swapper/9 Tainted: G D 4.6.0-rc4-next-20160420-WR7.0.0.0_standard+ #6 Hardware name: Intel Corporation S5520HC/S5520HC, BIOS S5500.86B.01.10.0025.030220091519 03/02/2009 0000000000000000 ffff88066fd03a70 ffffffff8155855f 0000000000000000 0000000000000000 ffff88066fd03ab0 ffffffff81062803 0000058061318ec8 ffff88065d1e39c0 ffff880661318e40 0000000000000000 ffff880661318ec8 Call Trace: [] dump_stack+0x67/0x98 Checking out fil [] __warn+0xd3/0xf0 [] warn_slowpath_null+0x1d/0x20 [] udp_queue_rcv_skb+0x3d0/0x660 [] __udp4_lib_rcv+0x4dc/0xc00 [] udp_rcv+0x1a/0x20 [] ip_local_deliver_finish+0xd1/0x2e0 es: 57% (30585/ [] ? ip_local_deliver_finish+0x3f/0x2e0 [] ip_local_deliver+0xc2/0xd0 [] ip_rcv_finish+0x1e2/0x5a0 [] ip_rcv+0x2dc/0x410 [] ? __pskb_pull_tail+0x82/0x400 [] __netif_receive_skb_core+0x3a8/0xa80 [] ? netif_receive_skb_internal+0x1b/0xf0 [] __netif_receive_skb+0x1d/0x60 [] netif_receive_skb_internal+0x55/0xf0 [] ? netif_receive_skb_internal+0x1b/0xf0 [] napi_gro_receive+0xc2/0x180 [] igb_poll+0x5ea/0xdf0 [] net_rx_action+0x15c/0x3d0 [] __do_softirq+0x161/0x413 [] irq_exit+0xd1/0x110 [] do_IRQ+0x62/0xf0 [] common_interrupt+0x8e/0x8e [] ? cpuidle_enter_state+0xc6/0x290 [] cpuidle_enter+0x17/0x20 [] call_cpuidle+0x33/0x50 [] cpu_startup_entry+0x229/0x3b0 [] start_secondary+0x144/0x150 ---[ end trace ba508c424f0d52bf ]--- The warning is triggered by commit fafc4e1ea1a4c1eb13a30c9426fb799f5efacbc3 ("sock: tigthen lockdep checks for sock_owned_by_user"), which checks if slock is held before locking "owned". It looks good to lock_sock which is just called lock_sock_nested. But, bh_lock_sock is different, which just calls spin_lock so it doesn't touch dep_map then the check will fail even though it is locked. So, I'm wondering what a right fix for it should be: 1. Replace bh_lock_sock to bh_lock_sock_nested in the protocols implementation, but there are a lot places calling it. 2. Just like lock_sock, just call bh_lock_sock_nested instead of spin_lock. Or the both approach is wrong or not ideal? Thanks, Yang