Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2746781yba; Sun, 28 Apr 2019 08:08:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZSvFIOLsn7ya+k0ZJTw8G8mPD2bGeJOKEouqj+hLxEgsMeGOSBBvQk7284URtM1IzawxG X-Received: by 2002:aa7:8b8b:: with SMTP id r11mr27635210pfd.130.1556464084667; Sun, 28 Apr 2019 08:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556464084; cv=none; d=google.com; s=arc-20160816; b=iQrhS+JTBzVvECLbkfT19JLA9q+BcRu6lK0pNVuLaWRtrPzvO+CtgHotFGYIEhRn+0 tS48xRiHbHD6Ks4FJiAObWKdcO4n5azTNATauerw+fvAT/q/yHXI9BxaxCiIcFrvp4rc nrYeKrfCpSoCiJ2H/mGVIS8friqy6X5PEupz7Uv7K1WINU4PV39KChFDOUGQq2jBOFkL KaxWDsuOGArTvqODlFhNw8djo3t/Nv+Vqw+sG7FGveCa8Cl0mjhjQjAjzZgm2q7c3WPK A6ke9yZMloNMcX9FOgQ5Sg8o+I4vqMJCdukoKc46K8AGSTyRJyhGqxPRbEDkX1XaPZkq a3Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=effzDhT9KotxM2aIfIg+6LAFXv5mBZkrBnrUxjq/X8s=; b=k2u8c4vVOLZHIIOiUDOOephljbod3rcQUeRnyQPSm9rtySbfdwLGJyxhBL6+lUiZd7 XQoxf1pcXdgFnqdkynZ7BM81/ybJz7iwOM2ev0GFb8IR9KAP4VSuvkuexSRlXin0rDos xDt1p2kZagl+CzZv7zAuLemArxqMpWQ9oHDOfwl2RpdZ9kmtfbAwvvq/cyrmebaY68Ss DNA36vyGPAVCzPFDmM5eEFuFghyuIArZGYeX4Kx9jpXDayV2kTJ5ZQlhK+PpEg2byPDk pDD1YNOrBs3KwpsghzCL7DgGu31qgy4v0axFRnr0iS9hfg8RqfRFyGlsl6v5iRl63UWM wgKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="onuZy9b/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j7si17226496pgp.524.2019.04.28.08.07.38; Sun, 28 Apr 2019 08:08:04 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="onuZy9b/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726809AbfD1PEV (ORCPT + 99 others); Sun, 28 Apr 2019 11:04:21 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46036 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726374AbfD1PEV (ORCPT ); Sun, 28 Apr 2019 11:04:21 -0400 Received: by mail-pg1-f194.google.com with SMTP id i21so487971pgi.12; Sun, 28 Apr 2019 08:04:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=effzDhT9KotxM2aIfIg+6LAFXv5mBZkrBnrUxjq/X8s=; b=onuZy9b/LE/6p2T99yzSAs0uRHqeejcfL8YEzTq2RTGYNkKWFjN6EiCmfEo+8T6Z+Y 18DUKLdJzTQw/DcoNPoWApCw3FzNiZqmteoVPq6cQVPpWtoJMxzO/WEmXdUatlLlruXS GOReOFYY7BYieH4BMkFE6M9RHl4rEYz09UQ6yERnlnEMYsoxprAqUYBinOAHat6LNjJt 458LBLicij9sipvvsedZI+Vukwrk8Q4t+3jty2yIuYCXFJQ1EZAXVEldUPofb/KLCwut 2Mvstjq+d7QA5m57LDovQhtpr+oNE0LbXLiiL0oe7q/SBSKHzJ//g5fX4qkYkq0oc6tv XIOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=effzDhT9KotxM2aIfIg+6LAFXv5mBZkrBnrUxjq/X8s=; b=CMpfntSDvR9gQY+kBCnLBtxhrU80L2uwoPDizqjeVh2/nEJ28TJWo/6fdkdfucnSUI He5DBT+jUtB0LOBToeO8IiOcQzwbKLtpync0L+jGE3sBeKN/mekrtAeEKPkkmDHvQIZJ BnY3tH0PFduzhiumSDEC4ymi9yHYMwKLAGAYP0/Xzjnyio9HlLRb8/OQ0HSn/OIKiJPN qlz78Gluk56H+bpL8AMAUiUKNxsIe8zg7ZCv1DVLjRZu9AwVVmdpU6RBMK2e1ZZjIZ9K 5NDT1UjUbSAlE5Oskt8eVILdMrUu6Q4itXYUISE3r0jIPOMu7DDz7B4M3WqfqCDYv+W3 Ys7Q== X-Gm-Message-State: APjAAAVYDirPqMQ/ogRtm8K/UPH7T6wxmV9G6DO5Y3x3X3LhbtXJnw1u be3Vdpz7J8NIXOufSCm+AsQ= X-Received: by 2002:aa7:86ce:: with SMTP id h14mr11140193pfo.84.1556463860780; Sun, 28 Apr 2019 08:04:20 -0700 (PDT) Received: from [192.168.86.235] (c-73-241-150-70.hsd1.ca.comcast.net. [73.241.150.70]) by smtp.gmail.com with ESMTPSA id n22sm42246930pfa.51.2019.04.28.08.04.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Apr 2019 08:04:19 -0700 (PDT) Subject: Re: unregister_netdevice: waiting for DEV to become free (2) To: Tetsuo Handa , David Ahern , "David S. Miller" Cc: Julian Anastasov , Cong Wang , syzbot , ddstreet@ieee.org, dvyukov@google.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com References: <0000000000007d22100573d66078@google.com> <4684eef5-ea50-2965-86a0-492b8b1e4f52@I-love.SAKURA.ne.jp> <9d430543-33c3-0d9b-dc77-3a179a8e3919@I-love.SAKURA.ne.jp> <920ebaf1-ee87-0dbb-6805-660c1cbce3d0@I-love.SAKURA.ne.jp> <15b353e9-49a2-f08b-dc45-2e9bad3abfe2@i-love.sakura.ne.jp> <057735f0-4475-7a7b-815f-034b1095fa6c@gmail.com> <6e57bc11-1603-0898-dfd4-0f091901b422@i-love.sakura.ne.jp> From: Eric Dumazet Message-ID: Date: Sun, 28 Apr 2019 08:04:18 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <6e57bc11-1603-0898-dfd4-0f091901b422@i-love.sakura.ne.jp> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/27/19 9:22 PM, Tetsuo Handa wrote: > On 2019/04/28 8:52, Eric Dumazet wrote: >> On 4/27/19 3:33 PM, Tetsuo Handa wrote: >>> >>> I'm waiting for davem why it is safe to move the dst entry from >>> "a device to unregister" to "a loopback device in that namespace". >>> I'm waiting for an explanation how the dst entry which was moved to >>> "a loopback device in that namespace" is released (i.e. what the >>> expected shutdown sequence is). >> >> The most probable explanation is that we make sure the loopback device >> is the last one to be dismantled at netns deletion, >> and this would obviously happen after all dst have been released. >> > > rt_flush_dev() becomes a no-op if "dev" == "a loopback device in that > namespace". And according to debug printk(), rt_flush_dev() is called > on "a loopback device in that namespace" itself. > This is the design yes. We can not let a dst having a pointer to some garbage memory. (since we are going to free it very soon) dst can be long lived objects. netdev (but loopback) are not. > If "a loopback device in that namespace" is the last "one" (== "a network > device in that namespace" ?), which shutdown sequence should have called > dev_put("a loopback device in that namespace") before unregistration of > "a loopback device in that namespace" starts? You'll have to study all the netdev notifiers to answer this question. They are many of them, and they have a priority to let them run in a given order. > > Since I'm not a netdev person, I appreciate if you can explain > that shutdown sequence using a flow chart. I am a netdev person, but I have no time to explain this at this moment.