Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp759912pxk; Wed, 23 Sep 2020 15:43:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyp28AaBaYzCBr+dpQ/Cfod4814Xsz2+w2aUmkKGC0gesfnzogkSKiI5VfM/itjLNC3VcyY X-Received: by 2002:a17:906:454a:: with SMTP id s10mr1832022ejq.138.1600901032652; Wed, 23 Sep 2020 15:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600901032; cv=none; d=google.com; s=arc-20160816; b=X5x8ZJHoxYock01a7GZDg8WG5iOIpHK1uXCqR4kpq/r9TTlNsI0QaaANEHqS6z+rdo 31pa+q6TTDpn5acgTPVz8rg9mPorgiwwzOV+NKeYk46aRwRyzeRe2HS+3KoGQ8alFAnN NYM/U/kEcgWRYseE9+e7K9itBVQa1JG7QkGLUtyTZV6q40NXYJxbU6qu54A9DOHYI8cP 2D1g688GLqrcBF9iUfNXnc6L5zr5TG9A5cNTXWDnTnhaPT0WB8H3JH1Ok/04EkEBUqeA HnQ8ZfhYF4n6/CwlAy2occ5CF1lj9Axjli/ToMwzxlo3q8vejU47nuTfOYs+AXn9/5V6 ptuw== 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=/Qmcmqqg++TrBQStWlGcQpe4p6r7fbfw9S/e/3PyukQ=; b=BcrGCvXSQDCJPD0+miSF8G6CiNwLH9PHqz+l/jjo2TDuHZPTCg3gn0jHWZVvLrY+wk xISLNCelQfwLv75dOG8hC6BLFgAUZ51v3gkZwcqKYm9Rxb6+iIbPjUvfZC9UJp/1+hzF LMRWF64QWWiYSQpP+Hexluo4ZuyR4iT5rcPUZuKIV9hTAjikAF89BXnTHejZx3lKaDQl avc6azC5FLfJLTIe6EvcdQgcFS//1oicsbPncNS2Aq/LYqEFNMJ9yhApcYSIwIGmOiQ1 05TzG9MIGeEgkL4J5LLAQTO1OZ1Z0T1p6Ub+viwdBS0l39jE9OSFo5OkqczhCVfKPoVK EssQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WfR52Oea; 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 h24si772401eja.559.2020.09.23.15.43.29; Wed, 23 Sep 2020 15:43:52 -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=WfR52Oea; 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 S1726599AbgIWWmT (ORCPT + 99 others); Wed, 23 Sep 2020 18:42:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:42426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726265AbgIWWmT (ORCPT ); Wed, 23 Sep 2020 18:42:19 -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 25661214F1; Wed, 23 Sep 2020 22:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600900938; bh=q/SyCKS4vWZifgLcAj3lUplkmU2OZSgulPabk0vf+Yo=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=WfR52Oeau2WY+H8mcf9hZKzBFLSuufUmtlhCDzFYG2VM+u2CI8NMxTI4WXeG8nmn/ cLIgZOj317nuScl3RobdZ8ro9cOTBoinmx76s1isxjiOiJ36TUpCZAGcO7FO55Z+Ti M/PkWUFQZa7eIOGkCi4OuKicG/3r1MK1Jy4sEd4g= Message-ID: Subject: Re: [PATCH] Revert "net: linkwatch: add check for netdevice being present to linkwatch_do_dev" From: Saeed Mahameed To: Heiner Kallweit , David Miller Cc: geert+renesas@glider.be, f.fainelli@gmail.com, andrew@lunn.ch, kuba@kernel.org, gaku.inami.xh@renesas.com, yoshihiro.shimoda.uh@renesas.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 23 Sep 2020 15:42:17 -0700 In-Reply-To: References: <3d9176a6-c93e-481c-5877-786f5e6aaef8@gmail.com> <28da797abe486e783547c60a25db44be0c030d86.camel@kernel.org> <14f41724-ce45-c2c0-a49c-1e379dba0cb5@gmail.com> <20200923.131529.637266321442993059.davem@davemloft.net> 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 Wed, 2020-09-23 at 22:44 +0200, Heiner Kallweit wrote: > On 23.09.2020 22:15, David Miller wrote: > > From: Heiner Kallweit > > Date: Wed, 23 Sep 2020 21:58:59 +0200 > > > > > On 23.09.2020 20:35, Saeed Mahameed wrote: > > > > Why would a driver detach the device on ndo_stop() ? > > > > seems like this is the bug you need to be chasing .. > > > > which driver is doing this ? > > > > > > > Some drivers set the device to PCI D3hot at the end of ndo_stop() > > > to save power (using e.g. Runtime PM). Marking the device as > > > detached > > > makes clear to to the net core that the device isn't accessible > > > any > > > longer. > > > > That being the case, the problem is that IFF_UP+!present is not a > > valid netdev state. > > > If this combination is invalid, then netif_device_detach() should > clear IFF_UP? At a first glance this should be sufficient to avoid > the issue I was dealing with. > Feels like a work around and would conflict with the assumption that netif_device_detach() should only be called when !IFF_UP Maybe we need to clear IFF_UP before calling ops->ndo_stop(dev), instead of after on __dev_close_many(). Assuming no driver is checking IFF_UP state on its own ndo_stop(), other than this, the order shouldn't really matter, since clearing the flag and calling ndo_stop() should be considered as one atomic operation. > > Is it simply the issue that, upon resume, IFF_UP is marked true > > before > > the device is brought out from D3hot state and thus marked as > > present > > again? > > > I can't really comment on that. The issue I was dealing with at the > time I submitted this change was about an async linkwatch event > (caused by powering down the PHY in ndo_stop) trying to access the > device when it was powered down already.