From owner-freebsd-net@freebsd.org Thu Jan 26 23:54:57 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 91A81CC2282 for ; Thu, 26 Jan 2017 23:54:57 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 734F818E9 for ; Thu, 26 Jan 2017 23:54:57 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 6FA88CC2280; Thu, 26 Jan 2017 23:54:57 +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 6DA53CC227F for ; Thu, 26 Jan 2017 23:54:57 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-yb0-x22f.google.com (mail-yb0-x22f.google.com [IPv6:2607:f8b0:4002:c09::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2963018E8; Thu, 26 Jan 2017 23:54:57 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: by mail-yb0-x22f.google.com with SMTP id 123so61003337ybe.3; Thu, 26 Jan 2017 15:54:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=FFgjSsBnm9qVBGtCZtn0kyVfZkhbvZwruUlN4nP6yzQ=; b=kOX1EWdlXFaITrBj6TzncOZ7U1K6IqDhbSwzOSm3Omp9XTHFo9+4Ovonz9irdLyE4T t0LIHe34Y46pNJ3wLxtohyavjRL3vlhdoAyGmM86yitwHasoai4sTpgRARnJIhbXd+9r KUyDVS5bkOdvO5Z2SGqDX29/rcKyAkBcLTM8guCLzq3QaoPlyc3B2MzjQrMRf0KQ+pE8 xsEMp3dCeSsd/QnZpff6qcRsiHekBF2NxMRDx46HkIrP7uhDN5F8hWF712J9NsH6kp/y JGCGjQ3cp0CDH+eMqdUQjdBPYhDjC70S1PPvRVIvRwBMg+iVYdoSlc/oTHGhm/31HCVW WiRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=FFgjSsBnm9qVBGtCZtn0kyVfZkhbvZwruUlN4nP6yzQ=; b=iLE3QF0hV3X4OjcJ1w5i7lFGQlL2LxE3FQARm1x/Rh4d4ZmfH76Qhh/Wqim8XcBMto OpMlQgYMhYixMq6Q0qKpmj5lCtWKPaKgk5nlYFna9zAA6u9IzGEKJcdtsQneRKcVhCoA 1Dg+U2LntFwirXFwV2STzuyzDg5UhE6jRQBQfU0EdMOzsF5CHtBdRR3cRKybIaK9hmAL QyPy3AMOkQKilvc7lY/8Gq0sYDrMbxzciguQFGAm6uzBYNnnWdsV+AWaSvHCy/55e4ma +0hxYqE2WVaKifSzFKEOvvzE0FVX3w05tdeL9DlyN9V/jJO/wa3wbGmOhAHuriFbN2oq 4msw== X-Gm-Message-State: AIkVDXKQWJFD3pPQf4VJdo+f5djASoAcf1LhRgxnfXkQX2RGx8H6O+uPbIQSI/RJiYceinQapME5RePRP3X0pg== X-Received: by 10.129.96.137 with SMTP id u131mr4282687ywb.302.1485474896234; Thu, 26 Jan 2017 15:54:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.20.23 with HTTP; Thu, 26 Jan 2017 15:54:55 -0800 (PST) In-Reply-To: <5278f854-4f6f-2ff3-b6d3-f95e23b26ded@freebsd.org> References: <5278f854-4f6f-2ff3-b6d3-f95e23b26ded@freebsd.org> From: Navdeep Parhar Date: Thu, 26 Jan 2017 15:54:55 -0800 Message-ID: Subject: Re: ifmedia status callback is non-sleepable To: Andrew Rybchenko Cc: "freebsd-net@freebsd.org" Content-Type: text/plain; charset=UTF-8 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: Thu, 26 Jan 2017 23:54:57 -0000 I think it's a bad idea in general for the kernel to be holding non-sleepable locks around driver ioctls. Regards, Navdeep On Thu, Jan 26, 2017 at 9:19 AM, Andrew Rybchenko wrote: > Hello, > > I'd like to double-check that it is intended/known limitation on ifmedia > status callback to be non-sleepable. > The limitation is imposed by usage of the ifmedia ioctl to get status from > lacp/lagg code on port creation (it holds non-sleepable rm_wlock). > > Backtrace of the corresponding panic: > > Sleeping thread (tid 100578, pid 10653) owns a non-sleepable lock > KDB: stack backtrace of thread 100578: > #0 0xffffffff80ae46e2 at mi_switch+0xd2 > #1 0xffffffff80b31e6a at sleepq_wait+0x3a > #2 0xffffffff80ae34e2 at _sx_xlock_hard+0x592 > #3 0xffffffff8222fd7e at sfxge_media_status+0x2e > #4 0xffffffff80be7b90 at ifmedia_ioctl+0x170 > #5 0xffffffff8222c3d0 at sfxge_if_ioctl+0x1f0 > #6 0xffffffff82277fbe at lagg_port_ioctl+0xde > #7 0xffffffff82278f9b at lacp_linkstate+0x4b > #8 0xffffffff822794c2 at lacp_port_create+0x1e2 > #9 0xffffffff82276a73 at lagg_ioctl+0x1243 > #10 0xffffffff80bdcbec at ifioctl+0xfbc > #11 0xffffffff80b41ab4 at kern_ioctl+0x2d4 > #12 0xffffffff80b41771 at sys_ioctl+0x171 > #13 0xffffffff80fa16ae at amd64_syscall+0x4ce > #14 0xffffffff80f8442b at Xfast_syscall+0xfb > panic: sleeping thread > cpuid = 23 > KDB: stack backtrace: > #0 0xffffffff80b24077 at kdb_backtrace+0x67 > #1 0xffffffff80ad93e2 at vpanic+0x182 > #2 0xffffffff80ad9253 at panic+0x43 > #3 0xffffffff80b39a99 at propagate_priority+0x299 > #4 0xffffffff80b3a59f at turnstile_wait+0x3ef > #5 0xffffffff80ab493d at __mtx_lock_sleep+0x13d > #6 0xffffffff80ad39f2 at _rm_wlock+0xb2 > #7 0xffffffff82275479 at lagg_port_setlladdr+0x29 > #8 0xffffffff80b363ca at taskqueue_run_locked+0x14a > #9 0xffffffff80b361bf at taskqueue_run+0xbf > #10 0xffffffff80a9340f at intr_event_execute_handlers+0x20f > #11 0xffffffff80a93676 at ithread_loop+0xc6 > #12 0xffffffff80a90055 at fork_exit+0x85 > #13 0xffffffff80f8467e at fork_trampoline+0xe > > I think vnic driver has the problem as well since it grabs sx_lock from > ifmedia status callback. > > Andrew. > _______________________________________________ > freebsd-net@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"