Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp528472pxk; Thu, 24 Sep 2020 11:20:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykODIWwXTg10xrbNcsz+RCsjzBeAnCKCADHXqZLnv/31kfuPsDEtfmwUab9IM2Bai7FhI3 X-Received: by 2002:a17:906:441:: with SMTP id e1mr1225842eja.396.1600971649005; Thu, 24 Sep 2020 11:20:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600971648; cv=none; d=google.com; s=arc-20160816; b=COwLiabeE1/CUmen0hiP/9G3wzz6Ai3fpGc6IXy7QyGGIac4PeNXFhXXkbEWOdFFNL 94pCPw3bYfSWMJLaWerbSOjM4Uxv1CG8ssV60tBgJZQ1S0AVRhz0LCXgGI2/Q1zwcH9H eKL27y5uz1IQipWP7v743jNMMPsIQMe9Ids1MMUpFj2ZGqpiyzvYU0BrR55LyUmNbG1o 7HwyVdCvgENH4hVIWdG4PqzwReF8O6pUdZUFWUSX+5Rl9fvS2OKEwK8eaJEQI45Dc2kN fNxEDP9Jzzi2/tvJbvr7XQE2QjN1OS62eWFIK4dGezfeMdS3NuQb5e2udcCGXBu0xgkh vAEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=PfMhoF9BJU/YzUZyOlvVQlNdPXprco8uNd12JUZZjeI=; b=I3E44dcBJwMEiV0t7w/NwBug1/XvXlRetmOwVu8sooRHBl4SXFT5yOJSdYQ6MTsdxd NnVCsZ1LxPEzEIPjMyOd7VRLaMG+uecAwmLvB3HETwVIKvipD1wWmZdYO04IJnwmMjFJ vKIe8g08I69DOYjQn+vFhESGlEpb4wH9bvC7k86BBFvZodTTMGmq5I3fKLmGe9dQocSv VYUhxvkTS9xd6VKo1qpHX1NggR62hs0m8kJj5kJfh5EQbE7Tc2sZ6Mk70Er556asNSdq tpxF4fV9YgIk+mo/fb3QaXox75o749HyIeobGrt1TGrZOFFjfVXwf2RQWeihWnhayvyI rosQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=goUH5wUr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si130107edp.272.2020.09.24.11.20.25; Thu, 24 Sep 2020 11:20:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=goUH5wUr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728731AbgIXSQ7 (ORCPT + 99 others); Thu, 24 Sep 2020 14:16:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:39480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727753AbgIXSQ7 (ORCPT ); Thu, 24 Sep 2020 14:16:59 -0400 Received: from lt-jalone-7480.mtl.com (c-24-6-56-119.hsd1.ca.comcast.net [24.6.56.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2BD8F2220C; Thu, 24 Sep 2020 18:16:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600971418; bh=JPivfR2n/6nemaw09kY1pefU4DjbtFAdL/4DuMfFtrM=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=goUH5wUrdNs2WMt+MIFXzoV3g8PVZRp68KVUnuX9gO4apR8YOFv1L5arow4xX4knN nDxYZCZpa2SDsZ4XofsH8ChkuQg4+ijfy2ARP4ma+cboJqmE060WLF5QaKB4dvfalD GVgt6BSTNGYYKBkB0qJIrlHz+RS3IlJfmfLIHXw0= Message-ID: Subject: Re: [PATCH] Revert "net: linkwatch: add check for netdevice being present to linkwatch_do_dev" From: Saeed Mahameed To: Jakub Kicinski Cc: David Miller , hkallweit1@gmail.com, geert+renesas@glider.be, f.fainelli@gmail.com, andrew@lunn.ch, gaku.inami.xh@renesas.com, yoshihiro.shimoda.uh@renesas.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 24 Sep 2020 11:16:57 -0700 In-Reply-To: <20200924090311.745cac3b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> References: <20200923.172125.1341776337290371000.davem@davemloft.net> <20200923.172349.872678515629678579.davem@davemloft.net> <2cf4178e970d2737e7ba866ebc83a7ec30ca8ad1.camel@kernel.org> <20200924090311.745cac3b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-09-24 at 09:03 -0700, Jakub Kicinski wrote: > On Wed, 23 Sep 2020 22:49:37 -0700 Saeed Mahameed wrote: > > 2) Another problematic scenario which i see is repeated in many > > drivers: > > > > shutdown/suspend() > > rtnl_lock() > > netif_device_detach()//Mark !present; > > stop()->carrier_off()->linkwatch_event() > > // at this point device is still IFF_UP and !present > > // due to the early detach above.. > > rtnl_unlock(); > > Maybe we can solve this by providing drivers with a better helper for > the suspend use case? > > AFAIU netif_device_detach() is used by both IO errors and drivers > willingly detaching the device during normal operation (e.g. for > suspend). > > Since the suspend path can sleep if we have a separate helper perhaps > we could fire off the appropriate events synchronously, and > quiescence > the stack properly? I was thinking something similar, a more heavy weight netif_device_detach(), which will be used in all drivers suspend flows. 1) clear IFF_UP 2) ndo_stop() 3) fire events 4) mark !present ... 5) suspend device but went and sampled some drivers and found there are many variations for using netif_device_detach it is not going to be a simple task.