Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp363157pxb; Thu, 2 Sep 2021 06:04:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbo7zdivn3CjkdgbSC9Tff9jvwc+yzZSzNDln2P3HfuBT1TRybzXmc3wXqHOFPbhhoURIX X-Received: by 2002:a17:907:1c01:: with SMTP id nc1mr3652657ejc.504.1630587879372; Thu, 02 Sep 2021 06:04:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630587879; cv=none; d=google.com; s=arc-20160816; b=RocO0HVBkbwOGu1SosnMW47dvRa0Lr66pO3nBZ1PtcdG81es6ZsfOZr33OR03JsNSO V5zmFzDAjE1gC23HpNXnghcZ1hGcgrFAXo+fwOVh99EUWb8Nom9cBvyKa0ggvx0tatLO brhXN8bxen5vKNL1bKdzv40TU7aBMjfHHYJASjOs30aZiZ0dyRiMGbjQ06WCjX/2hAiL 9gGIjBMtHJkayUBWC4yDcVqKBBqT6pGSPbSAHhKAWE846khlfYYMQSBGzrFWkB2u7XVX yq3DZmtkj3Dm/nzMoQ1kXb56tcmzww185YWgiFdVJOud7NC6Uog67tWI6BnmeIvm5rRl qBpQ== 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=vaGzIm5LsmBsaKouZzrmYUthPEgqDvMKDaRZQ7yEMO4=; b=AXXweHxmrnL8EDffVcUU9r3DsFQK/t19SLCsg8DjXHS2ji+H5XcIKcHMK6Cwvx/YfL Gd97NGH7rtFpPLSPQBWMx45Jb2bs84Pj8Yx78Kzx4Jwe9cjWlS4mMEHb08QnZDwlt5fg mud1Cqd4Va10g+CXFEh3E0hob0lC7dSmc4PPCBalW1qzA39nRWyxsBszWUfQrcvoqvTW 0tduRcwlvb7nAN2rIdIB9mPyJ9cnGUUkt+sfIA4uL6GEsf3mDvDoIVukJsqLA6lQefhL fY/AuuVLr68fx2X5M+WnIfrgQMTKPZxf4DHtiibt1jqxihbHUC414aDbxxu1HSZ4ONNY yQAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=i9GHpXvL; 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 hk6si1661147ejb.587.2021.09.02.06.03.34; Thu, 02 Sep 2021 06:04:39 -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=i9GHpXvL; 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 S1344734AbhIBNA2 (ORCPT + 99 others); Thu, 2 Sep 2021 09:00:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234247AbhIBNAZ (ORCPT ); Thu, 2 Sep 2021 09:00:25 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE6C2C061575; Thu, 2 Sep 2021 05:59:26 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id a25so4149735ejv.6; Thu, 02 Sep 2021 05:59:26 -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=vaGzIm5LsmBsaKouZzrmYUthPEgqDvMKDaRZQ7yEMO4=; b=i9GHpXvLiZcopIrVEMMb6V3w5gInseFZpl/2spgZ2hqPhy7dLzowfGqBKXvzK1VsZ2 mloUwMvKQm7pnyWev0jOH7NgreEliw9+8cagJptnFASWj1jJUCVL1/qzO1rDwMKpyU61 EDkt8BasV8WFI8VDRuwEX4XT+uwmI0L2xSoV+kO0uRLXHnvCzOOXzvHq99pSTwULKZ01 6CZk0sYYiMcFrmnd0mDPnMb5KK5G+uY5+/3xcW2bLQLeS4meEEBvNKUzOi3/joTOgiwk 2ZXUVgcztcc7HmjMHsyAtlGwiXembwPAMuxXEZuWLutOC5hqInnP0bcDJqDouYdhBnaH GINg== 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=vaGzIm5LsmBsaKouZzrmYUthPEgqDvMKDaRZQ7yEMO4=; b=YRtM/9mmjcCii/MtKTZcvwbO30chpAFUF3ePZNT+u6OBQ5yOVF4CWfc1ZNAYetsulo +YXfcFr7cksMHITUnA5Q18abZuTykojgAcsKE1ENc+Ke0UOdmySj/zHz7a5CnRBW3rbn Il1OOE4dWymyRJOKEkYgRy8WfgZBpw6K5rqeW7ZA2yjB074Dyqrm5PkItc6xMWPOmzVC Orz4dc/rUYq3FqmhCzH9I+ecNXlzamdSZRXS4BvXKMAfWAUHs7n0wzXpDiX5dZFG5GZQ /oxxCEgEldih+Cl06PwiQVGLTe3ykLx8mIJozNe/e2npBX+ZcE/rl90iQ8tNZ92ZtreI Wg/Q== X-Gm-Message-State: AOAM532/WW4lo40n5XFQoIVuf2RVSjwkVtIz5gejH/ZRFzZ2EYwW/Dil gjm4RaLdyCQNzemltcvrJAs= X-Received: by 2002:a17:906:1d19:: with SMTP id n25mr3673483ejh.11.1630587565279; Thu, 02 Sep 2021 05:59:25 -0700 (PDT) Received: from skbuf ([82.78.148.104]) by smtp.gmail.com with ESMTPSA id c25sm1079599ejm.9.2021.09.02.05.59.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 05:59:24 -0700 (PDT) Date: Thu, 2 Sep 2021 15:59:23 +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: <20210902125923.v7fq26iiqydtgq7g@skbuf> References: <20210901225053.1205571-1-vladimir.oltean@nxp.com> <20210902121927.GE22278@shell.armlinux.org.uk> <20210902123532.ruvuecxoig67yv5v@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210902123532.ruvuecxoig67yv5v@skbuf> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 02, 2021 at 03:35:32PM +0300, Vladimir Oltean wrote: > 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 ...and the same struct device, not "OF node" repeated twice, silly me. > 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.