From owner-freebsd-net@freebsd.org Mon Jan 30 15:41:43 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A82C6CC8152 for ; Mon, 30 Jan 2017 15:41:43 +0000 (UTC) (envelope-from arybchik@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 919A71946 for ; Mon, 30 Jan 2017 15:41:43 +0000 (UTC) (envelope-from arybchik@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 8D9A4CC8151; Mon, 30 Jan 2017 15:41:43 +0000 (UTC) Delivered-To: net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D3F9CC8150 for ; Mon, 30 Jan 2017 15:41:43 +0000 (UTC) (envelope-from arybchik@freebsd.org) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [84.52.89.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D6AB1943; Mon, 30 Jan 2017 15:41:43 +0000 (UTC) (envelope-from arybchik@freebsd.org) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id DCF7E7F5FF; Mon, 30 Jan 2017 18:41:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.9.2 shelob.oktetlabs.ru DCF7E7F5FF Authentication-Results: shelob.oktetlabs.ru/DCF7E7F5FF; dkim=none reason="no signature"; dkim-adsp=none (unprotected policy); dkim-atps=neutral Subject: Re: ifmedia status callback is non-sleepable To: Gleb Smirnoff , Navdeep Parhar References: <790a6da4-2492-d887-8cbc-d9737d3f07d1@freebsd.org> <20170127193723.GT2611@FreeBSD.org> Cc: net@FreeBSD.org From: Andrew Rybchenko Message-ID: <291ccad7-0ed6-0bff-031d-0d19c2b89d31@freebsd.org> Date: Mon, 30 Jan 2017 18:41:33 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170127193723.GT2611@FreeBSD.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2017 15:41:43 -0000 Navdeep, Gleb, On 01/27/2017 10:37 PM, Gleb Smirnoff wrote: > Andrew, > > On Thu, Jan 26, 2017 at 08:24:43PM +0300, Andrew Rybchenko wrote: > A> I'd like to double-check that it is intended/known limitation on ifmedia > A> status callback to be non-sleepable. > A> The limitation is imposed by usage of the ifmedia ioctl to get status > A> from lacp/lagg code on port creation (it holds non-sleepable rm_wlock). > A> > A> Backtrace of the corresponding panic: > A> > A> Sleeping thread (tid 100578, pid 10653) owns a non-sleepable lock > A> KDB: stack backtrace of thread 100578: > A> #0 0xffffffff80ae46e2 at mi_switch+0xd2 > A> #1 0xffffffff80b31e6a at sleepq_wait+0x3a > A> #2 0xffffffff80ae34e2 at _sx_xlock_hard+0x592 > A> #3 0xffffffff8222fd7e at sfxge_media_status+0x2e > A> #4 0xffffffff80be7b90 at ifmedia_ioctl+0x170 > A> #5 0xffffffff8222c3d0 at sfxge_if_ioctl+0x1f0 > A> #6 0xffffffff82277fbe at lagg_port_ioctl+0xde > A> #7 0xffffffff82278f9b at lacp_linkstate+0x4b > A> #8 0xffffffff822794c2 at lacp_port_create+0x1e2 > A> #9 0xffffffff82276a73 at lagg_ioctl+0x1243 > A> #10 0xffffffff80bdcbec at ifioctl+0xfbc > A> #11 0xffffffff80b41ab4 at kern_ioctl+0x2d4 > A> #12 0xffffffff80b41771 at sys_ioctl+0x171 > A> #13 0xffffffff80fa16ae at amd64_syscall+0x4ce > A> #14 0xffffffff80f8442b at Xfast_syscall+0xfb > A> panic: sleeping thread > A> cpuid = 23 > > I would say that this is bug in lagg(4). We shouldn't put constraint > of non-sleepability for ioctl(2). thanks a lot for replies. If so, what is the next step here? Should I submit a PR? I can try to find time to fix it, but it highly depends on design and I'd be thankful if someone who knows it well suggests the design/idea. Also I'm afraid i have very limited resources for testing any fixes in this area. Andrew.