Received: by 10.192.165.156 with SMTP id m28csp651307imm; Fri, 13 Apr 2018 05:41:49 -0700 (PDT) X-Google-Smtp-Source: AIpwx48iPDOrA5u01rqUKXofALKdarU2+zui/sz6o6+ILKxI1BO0JJ0fEMAcXnDnZKO3fyG9A9Qm X-Received: by 10.101.102.3 with SMTP id w3mr3957265pgv.200.1523623309793; Fri, 13 Apr 2018 05:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523623309; cv=none; d=google.com; s=arc-20160816; b=Ufyt793ZyrKH24MMziNi7iV+1MgZ1YJn8z2KPg7M/R1dI6vrbHhoyb8TzbtZ6eLtfC Z6zudEYKUHW9jB9Nh35Lcyq4Uw+mdZtGZzsR/c+6znWqTxkQnWCrDAzfuFDRyv2YXVOb L5ZL5dADgayR4ldinx5NNorC7P9oGFRrucUBF1xP/ioOokaSmjWbB4bf7dGqwJY6X3yZ ZMZ0kUz0WWq6YINCCZz35GN0sTzsoML9L0vX79luh1s6GweR486oNqAcFU9mMjWONeUU 26MIzGjrN2+H4xQFtZnjefw90Gr0jvXaFhiuTjwf/Yxjem2/fM9qvb6/tGWWQ3Z11fDl 8g/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=1jZuRNfsKkboHlusyKB/SVQfXHy85cGaGlZJ/nBueaQ=; b=Ips0uVhqzAZE/yOZi4cITEIGaRNFPW6y3TiaprnZHdEvHhRRpIX+rEmLK8hxJ2sv8a e1rzf+O1KPQ90FtxWq1U4o5mLRyxoUuPyxTGPvVA+ZW7e2Qu89PtQOVIluIKLAn62Sk2 z+ycAfD48DSYr7jXeuAV9KRrDrFBCFLymEtuQRzWaLpsYgI4dad9Vzf+ARc4pWVr4jz+ Qn2KpkKq3TB2el6ZCzCxaSoA+X6VASGP6xfWnIbN649Y8/wGddV8BQ8v2r00CQ+zwn2F Dmah4PC5/CzNZUlHkHpwU6foYHb0qZwHd4qE5wWn/5Ay7a1CemU+Uyb5w5tJiBYhP3aV bfHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si4036116pge.252.2018.04.13.05.41.35; Fri, 13 Apr 2018 05:41:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754747AbeDMLiq (ORCPT + 99 others); Fri, 13 Apr 2018 07:38:46 -0400 Received: from charlotte.tuxdriver.com ([70.61.120.58]:57622 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754147AbeDMLio (ORCPT ); Fri, 13 Apr 2018 07:38:44 -0400 Received: from cpe-2606-a000-111b-40b7-640c-26a-4e16-9225.dyn6.twc.com ([2606:a000:111b:40b7:640c:26a:4e16:9225] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1f6x23-0000ux-RA; Fri, 13 Apr 2018 07:38:28 -0400 Date: Fri, 13 Apr 2018 07:37:47 -0400 From: Neil Horman To: Dmitry Vyukov Cc: Tommi Rantala , Xin Long , David Ahern , Daniel Borkmann , Cong Wang , David Miller , Eric Dumazet , Willem de Bruijn , Jakub Kicinski , Rasmus Villemoes , netdev , LKML , Alexey Kuznetsov , Hideaki YOSHIFUJI , syzkaller , Dan Streetman , "Eric W. Biederman" , Alexey Kodanev , Marcelo Ricardo Leitner , linux-sctp@vger.kernel.org Subject: Re: net: hang in unregister_netdevice: waiting for lo to become free Message-ID: <20180413113747.GA1699@hmswarspite.think-freely.org> References: <991243e2-e7c2-f2b2-72b9-d37b0d569b3b@gmail.com> <5973966e-fcd9-7ee5-a9c4-b79d22c1b9dd@nokia.com> <20180220162622.GA32068@hmswarspite.think-freely.org> <7d98027d-e810-a079-49c5-0bf8beef390e@nokia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-Spam-Score: -2.9 (--) X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 12, 2018 at 02:15:30PM +0200, Dmitry Vyukov wrote: > On Wed, Feb 21, 2018 at 3:53 PM, Tommi Rantala > wrote: > > On 20.02.2018 18:26, Neil Horman wrote: > >> > >> On Tue, Feb 20, 2018 at 09:14:41AM +0100, Dmitry Vyukov wrote: > >>> > >>> On Tue, Feb 20, 2018 at 8:56 AM, Tommi Rantala > >>> wrote: > >>>> > >>>> On 19.02.2018 20:59, Dmitry Vyukov wrote: > >>>>> > >>>>> Is this meant to be fixed already? I am still seeing this on the > >>>>> latest upstream tree. > >>>>> > >>>> > >>>> These two commits are in v4.16-rc1: > >>>> > >>>> commit 4a31a6b19f9ddf498c81f5c9b089742b7472a6f8 > >>>> Author: Tommi Rantala > >>>> Date: Mon Feb 5 21:48:14 2018 +0200 > >>>> > >>>> sctp: fix dst refcnt leak in sctp_v4_get_dst > >>>> ... > >>>> Fixes: 410f03831 ("sctp: add routing output fallback") > >>>> Fixes: 0ca50d12f ("sctp: fix src address selection if using > >>>> secondary > >>>> addresses") > >>>> > >>>> > >>>> commit 957d761cf91cdbb175ad7d8f5472336a4d54dbf2 > >>>> Author: Alexey Kodanev > >>>> Date: Mon Feb 5 15:10:35 2018 +0300 > >>>> > >>>> sctp: fix dst refcnt leak in sctp_v6_get_dst() > >>>> ... > >>>> Fixes: dbc2b5e9a09e ("sctp: fix src address selection if using > >>>> secondary > >>>> addresses for ipv6") > >>>> > >>>> > >>>> I guess we missed something if it's still reproducible. > >>>> > >>>> I can check it later this week, unless someone else beat me to it. > >>> > >>> > >>> Hi Tommi, > >>> > >>> Hmmm, I can't claim that it's exactly the same bug. Perhaps it's > >>> another one then. But I am still seeing these: > >>> > >>> [ 58.799130] unregister_netdevice: waiting for lo to become free. > >>> Usage count = 4 > >>> [ 60.847138] unregister_netdevice: waiting for lo to become free. > >>> Usage count = 4 > >>> [ 62.895093] unregister_netdevice: waiting for lo to become free. > >>> Usage count = 4 > >>> [ 64.943103] unregister_netdevice: waiting for lo to become free. > >>> Usage count = 4 > >>> > >>> on upstream tree pulled ~12 hours ago. > >>> > >> Can you write a systemtap script to probe dev_hold, and dev_put, printing > >> out a > >> backtrace if the device name matches "lo". That should tell us > >> definitively if > >> the problem is in the same location or not > > > > > > Hi Dmitry, I tested with the reproducer and the kernel .config file that you > > sent in the first email in this thread: > > > > With 4.16-rc2 unable to reproduce. > > > > With 4.15-rc9 bug reproducible, and I get "unregister_netdevice: waiting for > > lo to become free. Usage count = 3" > > > > With 4.15-rc9 and Alexey's "sctp: fix dst refcnt leak in sctp_v6_get_dst()" > > cherry-picked on top, unable to reproduce. > > > > > > Is syzkaller doing something else now to trigger the bug...? > > Can you still trigger the bug with the same reproducer? > > Hi Neil, Tommi, > > Reviving this old thread about "unregister_netdevice: waiting for lo > to become free. Usage count = 3" hangs. > I still did not have time to deep dive into what happens there (too > many bugs coming from syzbot). But this still actively happens and I > suspect accounts to a significant portion of various hang reports, > which are quite unpleasant. > > One idea that could make it all simpler: > > Is this wait loop in netdev_wait_allrefs() supposed to wait for any > prolonged periods of time under any non-buggy conditions? E.g. more > than 1-2 minutes? As the name implies, its supposed to wait for the reference count to be zero indefinately, but yes, under normal operation, its intended to not have to wait very long at all. The issuance of the NETDEV_UNREGISTER_FINAL notification is meant to be a subscribable signal to any code path holding a reference that it needs to be dropped so that the progress can be made. Note that the "waiting for %s to become free" message is triggered after 10 seconds of waiting, and is likely the trigger you want, Its just an emergency level log message rather a WARN. I don't think we want to change that permanently, but you could certainly alter it in the code to cause syzbot to catch it (i.e. WARN_ON(time_after(jiffies, warning_time + 10 * HZ)) ) > If it only supposed to wait briefly for things that already supposed > to be shutting down, and we add a WARNING there after some timeout, > then syzbot will report all info how/when it happens, hopefully > extracting reproducers, and all the nice things. > But this WARNING should not have any false positives under any > realistic conditions (e.g. waiting for arrival of remote packets with > large timeouts). > > Looking at some task hung reports, it seems that this code holds some > mutexes, takes workqueue thread and prevents any progress with > destruction of other devices (and net namespace creation/destruction), > so I guess it should not wait for any indefinite periods of time? Well, it drops everything and sleeps periodically, so its safe in and of itself. The problem is its waiting for the reference count of a device to drop to zero, and some other execution context isn't taking the appropriate action to do that. Neil >