Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5497036imw; Wed, 20 Jul 2022 06:56:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1swb0DKcV1dvXQ81gU56MOdbwzFSudkHuYxzPTTkcRghi3gMK08YaY3UgSGTt+sricKbX6p X-Received: by 2002:a17:906:1315:b0:72c:5348:a153 with SMTP id w21-20020a170906131500b0072c5348a153mr34027950ejb.446.1658325395195; Wed, 20 Jul 2022 06:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658325395; cv=none; d=google.com; s=arc-20160816; b=WmRKI5GV+3e5byAjDlWXALbz+r1F0x6GCgYxXBiePS/cOoZR8krecZYu6oUJL5qGpD M1haiFymVeQmPpDw7u2K8BSWoEVJKs7H8itrCtG+foEZ2gRU6kXVF7dBX4Flu5/eKvsj K/mxXz6F6PBk2dLlbJc99B7aRE8t8cmSwSs8SFOp+feSevqtBwa+0knHov4lxrSjziik ycriipVJdXQBrb/aw7Ihird0ZnAsTvaSREDEm2/biBj3ASuWZxcCQvYGPeZUgczCCWTQ 8XPP8h78dEzDlOmBnGsRwD9r3oOgfVG3PYbqBYkf7WNqL/gVvRI7d+Qh4gEUxtyQQ13+ f1cg== 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=v7Ua7Pjztqwug82UBS8PZqoIQdh5WrByyVymA7qNXfY=; b=0PGebBBY+MUHkOw3eXCH2iGcTrb7RlfzXNnL9Uu/R9sBwKYQ/Cuij0yxWAawOX+flG VgSKkc9qLDXAyxlgv8I+0fsy3xiBG9RBM1bXiGipOSLG2+GOYIDu/JIdsQCCItBYayci vfHca/l/FjCVlsFvE2I4rQaWKJnqyFo2NmFycfN7Wp/HdqcCQJWkQQXmRnVTbAkcyg7o 0OpbPu2CCclJE+SMw+UVd/szZLx6YIwMitzLeaXDtHNBwFHHD7LDJSk5i3t3UZ9xweJz iu7JOvjLCtuWKIdu6R0YIVnHPBbyspw750AQaMXXwjTyPj6IzD9HoErnQdq9bjRvG7b9 oAbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Nmbr0Ft+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di7-20020a170906730700b0072f1dd96738si3346522ejc.140.2022.07.20.06.56.09; Wed, 20 Jul 2022 06:56:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Nmbr0Ft+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232630AbiGTNxY (ORCPT + 99 others); Wed, 20 Jul 2022 09:53:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbiGTNxV (ORCPT ); Wed, 20 Jul 2022 09:53:21 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC2FC564CF; Wed, 20 Jul 2022 06:53:19 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id y4so23845226edc.4; Wed, 20 Jul 2022 06:53:19 -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=v7Ua7Pjztqwug82UBS8PZqoIQdh5WrByyVymA7qNXfY=; b=Nmbr0Ft+AJ1qLYlMHWEXMpaR4XELHNyQAwZbdBWe8fGQhHqGPd1gD6d1KCMogKEBpz Bm7n5gTDnNsGpTpIkaOZ/zXnhVIirBjmDIiHPfE54B8fs3L0ulH52s18KafGlgDihKqD PaL3yw6KG6rnj0ZvTD+0rKFVYgv6JFRs8QlaCeMNV8thMquMeGmS7cdhhzAbqDi04V1y bqXgezBmXgeiTzanu4P8w270e0fjtnEJ0Rdb5mMCD7nIRDUxtqJ86WODqq6wl3rOeexs MpaGTPLcOKjG1JGubt82XE2ZHtNLyqAR7dQDQ01s94CBo8rkf6vBBE6N47hf84cFcPIX X2rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=v7Ua7Pjztqwug82UBS8PZqoIQdh5WrByyVymA7qNXfY=; b=UEiZ1i4ln1A8kJ/SFQEA3pI04zCXCYWzD1TYPBPTe8TDFzjGW39zPjezhGnbtEQVD8 GnPE1MvGHKwM3IpkUUQY/Dtlez2kOspL5S2OmGn9ELp15siVIhzSnXe+7x5kcV5IxOTI KGBRrP4EJ3Z2QhUUUIk/sQ054JKMccz4v4npp5d+ZwI1I7loZisrc4YYGdNLpAEwBzaN JoA5K1lOBnREMSvv9mirHgZOkVAA9GpGpqYFeQuaa6mDilVMYjudGeu5V1jZTTL0YRRT k5HGZYXqMdMUoqCTmbaBNCMc346IJ2KwX2HPz/LlnnjBvjpa4DckH3pKHWquerVcvea/ Up2w== X-Gm-Message-State: AJIora/Cua7UmNh6VI80AxTlG2ZmARZYgglyBc7NNTMaOeMftV5021Qh zLwwqEPhRve2P6dk1BeUMmyugeEv+YTNwA== X-Received: by 2002:aa7:d788:0:b0:43b:bcbe:64d3 with SMTP id s8-20020aa7d788000000b0043bbcbe64d3mr1108303edq.15.1658325198189; Wed, 20 Jul 2022 06:53:18 -0700 (PDT) Received: from skbuf ([188.25.231.115]) by smtp.gmail.com with ESMTPSA id h10-20020a170906718a00b00718e4e64b7bsm7934599ejk.79.2022.07.20.06.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 06:53:17 -0700 (PDT) Date: Wed, 20 Jul 2022 16:53:14 +0300 From: Vladimir Oltean To: Sean Anderson Cc: Heiner Kallweit , Russell King , netdev@vger.kernel.org, Jakub Kicinski , Madalin Bucur , "David S . Miller" , Paolo Abeni , Ioana Ciornei , linux-kernel@vger.kernel.org, Eric Dumazet , Andrew Lunn , Alexandre Belloni , Benjamin Herrenschmidt , Claudiu Manoil , Florian Fainelli , Frank Rowand , Krzysztof Kozlowski , Li Yang , Michael Ellerman , Paul Mackerras , Rob Herring , Saravana Kannan , Shawn Guo , UNGLinuxDriver@microchip.com, Vivien Didelot , Vladimir Oltean , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [RFC PATCH net-next 0/9] net: pcs: Add support for devices probed in the "usual" manner Message-ID: <20220720135314.5cjxiifrq5ig4vjb@skbuf> References: <2d028102-dd6a-c9f6-9e18-5abf84eb37a1@seco.com> <20220719181113.q5jf7mpr7ygeioqw@skbuf> <20220711160519.741990-1-sean.anderson@seco.com> <20220719152539.i43kdp7nolbp2vnp@skbuf> <20220719153811.izue2q7qff7fjyru@skbuf> <2d028102-dd6a-c9f6-9e18-5abf84eb37a1@seco.com> <20220719181113.q5jf7mpr7ygeioqw@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 19, 2022 at 03:34:45PM -0400, Sean Anderson wrote: > We could do it, but it'd be a pretty big hack. Something like the > following. Phylink would need to be modified to grab the lock before > every op and check if the PCS is dead or not. This is of course still > not optimal, since there's no way to re-attach a PCS once it goes away. You assume it's just phylink who operates on a PCS structure, but if you include your search pool to also cover include/linux/pcs/pcs-xpcs.h, you'll see a bunch of exported functions which are called directly by the client drivers (stmmac, sja1105). At this stage it gets pretty hard to validate that drivers won't attempt from any code path to do something stupid with a dead PCS. All in all it creates an environment with insanely weak guarantees; that's pretty hard to get behind IMO. > IMO a better solution is to use devlink and submit a patch to add > notifications which the MAC driver can register for. That way it can > find out when the PCS goes away and potentially do something about it > (or just let itself get removed). Not sure I understand what connection there is between devlink (device links) and PCS {de}registration notifications. We could probably add those notifications without any intervention from the device core: we would just need to make this new PCS "core" to register an blocking_notifier_call_chain to which interested drivers could add their notifier blocks. How a certain phylink user is going to determine that "hey, this PCS is definitely mine and I can use it" is an open question. In any case, my expectation is that we have a notifier chain, we can at least continue operating (avoid unbinding the struct device), but essentially move our phylink_create/phylink_destroy calls to within those notifier blocks. Again, retrofitting this model to existing drivers, phylink API (and maybe even its internal structure) is something that's hard to hop on board of; I think it's a solution waiting for a problem, and I don't have an interest to develop or even review it.