Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp345398pxb; Thu, 2 Sep 2021 05:40:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnaS1u2HESvA6dn7uOPGNaJCHNuyRb6//QnYH+86W5ZdFvTfmtJ7bWW2/7LZJva/EFL0Ij X-Received: by 2002:a05:6402:3188:: with SMTP id di8mr3389512edb.300.1630586458016; Thu, 02 Sep 2021 05:40:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630586458; cv=none; d=google.com; s=arc-20160816; b=Bd+iLcEnKhTHawIsjxvX0sg1+3MzJni+AofDPTKbs++wTm0Ue/8B75B9R/5PajqaHB oNYmpFqdNQbCZ5vo4jS8uTEf2K+LwwvWm1ocaWqMdDKL3l3XGcFGp6mwyB605RkqVNaw gblxSsikHQSL5Nu5WQrtb/f0ulmCXRPU+oWE1AY7nL4j/xwCuUfedjZTk9n5gJTNIwmN 6aJ5QaXF0jWIjs21zTg+Iu6ra3CTDRubY5IBTZUQLnlIGk30fZczi+7VTdnCkuql6WVj h15TrUrQzcQY/VuMQJ3/CCpkc8sidL8ROA/4xjRkeufR6DwDvqKi6hf5nK7AkK3Krm4s 8ACw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JDtXEunmFOOZmW+0aOsXK0Lm5ZI2ij8ux95FUu34ZJM=; b=grvSmJmzbRkBSeddPj1O9g2Ph17s6EW/HGYZ1rVkNCUHU8BrVtZ1gaKvWhIb0GvEQR uTWT+JKBIbOOibty1KACh0txeUhZIpKRRiH7kPk42vo6QyPzhvQ6mfhK2NPpedm21NmA fpKfiQBBuGi3XV8MHLuQxxz7ReJY5BsIgCUYEF7XZDWRv6VqPHh+kT7FTrDLRAIqFeBt 8BsOZMoaKma7LZA8T1ewx1CXpmbkvV3BsMcwqbfD8ijzza3tCVfRnQX+mvq71i0byRHA oIbbC/5fpCBi/Y2xaQEX+tZ6je0tAmlbNXZruG58jCUrzRJKukbMLlgnp2yCz3wrYuKY Bvsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PqW1GirC; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si2711779edc.33.2021.09.02.05.40.04; Thu, 02 Sep 2021 05:40:58 -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=@gmail.com header.s=20210112 header.b=PqW1GirC; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344447AbhIBMge (ORCPT + 99 others); Thu, 2 Sep 2021 08:36:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234098AbhIBMgd (ORCPT ); Thu, 2 Sep 2021 08:36:33 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42AB0C061575; Thu, 2 Sep 2021 05:35:35 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id t19so3968100ejr.8; Thu, 02 Sep 2021 05:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JDtXEunmFOOZmW+0aOsXK0Lm5ZI2ij8ux95FUu34ZJM=; b=PqW1GirCBDvwbp/Ga2Ddg6i2pz1R5Yc9bMNfbDavKrmCfQny7D35f6ATVhel0WDeZg pdPAAj9emto4iW43J3Ubj4AgOofDMzzbB3ELwMgrkPLddqEWEk313MlGf7jU8ZYCx+H/ B2y/W9fH6P4sBYx999uv6Xzrhn/MdWEGU8uk7v6I3sh+qBjXZzQFhPrPpr4D0LH8TsDQ bHBjKDfCyy7Hg8mmWicLishULAZqrqAo35qGy94l+FdaQFnA0lG6/wezJ+J7lRlg+QeF hxk5MMvbdR3PhWhf2fXJVE8UAY4l+BYEBisEjRt2v1qjCqkB+aEXuwWLpGZemTRknIS/ DOoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JDtXEunmFOOZmW+0aOsXK0Lm5ZI2ij8ux95FUu34ZJM=; b=Pp8bZagVLXMzD92Ohir6cyD7cZwaOFizMIyXSetm48RYWYfaJPYjt7ZQAXf7VPyGKW 8ctbCBYmvbqermr7eVkEWseZChI2lwDjMhv0f6qua3b32JnwnhtrbSpiWAZGOxN4mQR8 HkE5+jZ/JadfdwmKEzIDuN748iVyybiIsbGGCSp8IIQhxq1med5JDqsFNPmXd0aZ+gSQ Ke9iXOiBCETL1Vp49FRgUdbI1aPRMyp2ERZ6ME0uyVWnE7snX058QGAriEtIGlQ/1+6N f6EwuQLpUytVhR+bYAR5es0qt+qdUwBI5WAQe6iVGQtRHnE5qj+GxScvBO0UuvpmWVLU 2mfQ== X-Gm-Message-State: AOAM532Zv6lUMA8y4dCNrcxZ/WHI2zl+h2nmnWAs8gW5nBD1bEhT38NB 8M4yNhy0MM5UWL/p8oZlokE= X-Received: by 2002:a17:907:7601:: with SMTP id jx1mr3548149ejc.69.1630586133751; Thu, 02 Sep 2021 05:35:33 -0700 (PDT) Received: from skbuf ([82.78.148.104]) by smtp.gmail.com with ESMTPSA id n23sm1150940eds.41.2021.09.02.05.35.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 05:35:33 -0700 (PDT) Date: Thu, 2 Sep 2021 15:35:32 +0300 From: Vladimir Oltean To: "Russell King (Oracle)" Cc: Vladimir Oltean , netdev@vger.kernel.org, Greg Kroah-Hartman , "Rafael J. Wysocki" , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Jakub Kicinski , Vivien Didelot , Florian Fainelli , linux-kernel@vger.kernel.org, Linus Walleij , Alvin =?utf-8?Q?=C5=A0ipraga?= , ACPI Devel Maling List , kernel-team , Len Brown Subject: Re: [RFC PATCH net-next 0/3] Make the PHY library stop being so greedy when binding the generic PHY driver Message-ID: <20210902123532.ruvuecxoig67yv5v@skbuf> References: <20210901225053.1205571-1-vladimir.oltean@nxp.com> <20210902121927.GE22278@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210902121927.GE22278@shell.armlinux.org.uk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 02, 2021 at 01:19:27PM +0100, Russell King (Oracle) wrote: > On Thu, Sep 02, 2021 at 01:50:50AM +0300, Vladimir Oltean wrote: > > The central point of that discussion is that DSA seems "broken" for > > expecting the PHY driver to probe immediately on PHYs belonging to the > > internal MDIO buses of switches. A few suggestions were made about what > > to do, but some were not satisfactory and some did not solve the problem. > > I think you need to describe the mechanism here. Why wouldn't a PHY > belonging to an internal MDIO bus of a switch not probe immediately? > What resources may not be available? As you point out below, the interrupt-controller is what is not available. There is a mechanism called fw_devlink which infers links from one OF node to another based on phandles. When you have an interrupt-parent, that OF node becomes a supplier to you. Those OF node links are then transferred to device links once the devices having those OF nodes are created. > If we have a DSA driver that tries to probe the PHYs before e.g. the > interrupt controller inside the DSA switch has been configured, aren't > we just making completely unnecessary problems for ourselves? This is not what happens, if that were the case, of course I would fix _that_ and not in this way. > Wouldn't it be saner to ensure that the interrupt controller has been > setup and become available prior to attempting to setup anything that > relies upon that interrupt controller? The interrupt controller _has_ been set up. The trouble is that the interrupt controller has the same OF node as the switch itself, and the same OF node. Therefore, fw_devlink waits for the _entire_ switch to finish probing, it doesn't have insight into the fact that the dependency is just on the interrupt controller. > From what I see of Marvell switches, the internal PHYs only ever rely > on internal resources of the switch they are embedded in. > > External PHYs to the switch are a different matter - these can rely on > external clocks, and in that scenario, it would make sense for a > deferred probe to cause the entire switch to defer, since we don't > have all the resources for the switch to be functional (and, because we > want the PHYs to be present at switch probe time, not when we try to > bring up the interface, I don't see there's much other choice.) > > Trying to move that to interface-up time /will/ break userspace - for > example, Debian's interfaces(8) bridge support will become unreliable, > and probably a whole host of other userspace. It will cause regressions > and instability to userspace. So that's a big no. Why a big no? I expect there to be 2 call paths of phy_attach_direct: - At probe time. Both the MAC driver and the PHY driver are probing. This is what has this patch addresses. There is no issue to return -EPROBE_DEFER at that time, since drivers connect to the PHY before they register their netdev. So if connecting defers, there is no netdev to unregister, and user space knows nothing of this. - At .ndo_open time. This is where it maybe gets interesting, but not to user space. If you open a netdev and it connects to the PHY then, I wouldn't expect the PHY to be undergoing a probing process, all of that should have been settled by then, should it not? Where it might get interesting is with NFS root, and I admit I haven't tested that.