Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1057344iob; Fri, 13 May 2022 21:25:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxq4XjkU/JvF5N0mo4fmv6c1RSnxvAPTnFC+l/Vgmy4YyVADg0eEARUozxh4MSLL+gxROu+ X-Received: by 2002:a5d:648b:0:b0:20c:5aec:1c06 with SMTP id o11-20020a5d648b000000b0020c5aec1c06mr6099812wri.525.1652502358959; Fri, 13 May 2022 21:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652502358; cv=none; d=google.com; s=arc-20160816; b=l1REAolZfN5WyCyrZdWMxpibaRgkeUJN8BcEH8gXc4TArfZVX+BzOQPdFa+JM4M5p6 ekl8rvJxs1yGy+FWrC8O30nUZiRPybu53XGDEn6lJ7WpRVLIGrv4vwoTLRRreuG9xgRW 87EVlUibFKn78E+aclhcnxFHpdLY72IECkU00OVvcLCvcmeuSgg2El4K4841iIhzTP/s IbV+cfJBqmcSxMmd6JdS3FZ+979eZfAE7nPx7Jchxb9o1xhF8uFse8Sj01/acZo3mgE7 ss3LTVxNi4NFneewg7MUFhxvjLocl07toU65SwuIeJEdlq3f9EDZ7qyqF0oz1jatd7aL SB4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Gh7lyMR/wwSZPN8VM7Gm13nBDOjOCSeBHsdtAIxkzG8=; b=QRvMa2PblBu0yiSgpwgVQu9Wn/ph6gfTj3IsrAa/p7EI4RHrRd0bgjtcIhK5JTsvvy z/x4KNic4ZK7DL5vzcef/b4YQUN9BnGLk/iAuou3mZ6hx5BjpN2GbRQiVccnzjlv1EYo SxNOS9uB3ffadjQ+BvOQVKG4A2B5SvBuJkdXYr/a+nK4iuw6B6zC0afmkq93d6j4P1Yy bWRzjH4BKjrKZt5CduDbmCNyoeCdM3bJducRxix9jzeOBocN6CigYVe9sgRU6Q5TTskt kjaxhJp4xz57lPDt2L6csRLyoKuYKAQBSASF9tcktdT8HKzrAoQMyudTXQ1KnoJOYYHH B72w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="V/0/Z8mB"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s13-20020a5d4ecd000000b00207b6665f05si3351923wrv.45.2022.05.13.21.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 21:25:58 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="V/0/Z8mB"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7E72C3573C0; Fri, 13 May 2022 19:52:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229863AbiENCwY (ORCPT + 99 others); Fri, 13 May 2022 22:52:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbiENCwV (ORCPT ); Fri, 13 May 2022 22:52:21 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C07164A0DF5 for ; Fri, 13 May 2022 17:53:26 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id e12so17926039ybc.11 for ; Fri, 13 May 2022 17:53:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Gh7lyMR/wwSZPN8VM7Gm13nBDOjOCSeBHsdtAIxkzG8=; b=V/0/Z8mBX//e4K3r0ItRdb+QOez5W2XQln5EnRm9IolusnHAblUXo5tTq1gXrjgaOQ h2uOoGmdQlAWavWoSg7h1u45GIg701NSi5498nSXOq4rOpruJ/GAKqNcnk1nUGSwdlUH KF/Jd1j27FhvkKRcNt+VDQDHFUXXZrlRDIyEPE51WCxWNi4RlSDQBmEsIkT8VjxxBV0b bDPbYNoTE5Wm/8XlRiWLjhfWSbYoG/1p+MWkOJdk68z8KRjORJleBHix1Qr33jg0oxdF eFtoXAqEfV7XKe02t4strhNLtYX/5/rc/0uVvjb2X05Tuys7X0VuVPMAtMSbS1+/HUec eX7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Gh7lyMR/wwSZPN8VM7Gm13nBDOjOCSeBHsdtAIxkzG8=; b=fF/Pg3ZXBAWCdeQ4e0EaJruRkrBuL3VJ+6HaZ+MVqV8HsOVSO4HYuLG/JaTfwIaDcR vUgwojNsAwrO0AW0owVymjRFDFUjJQHeJ4uOxE+MstF1OlZUYjqE/7Z4zQV/sOMRJdAS BHEARAyLtluN2s40nNg6oqfoWxH2uSpru1hSaniLcpHal7JlCrJK/bb6Z/arG7RBlx0i N8rduC4LvQ5hpLb3BgqPzrN7zQGnW5RlakGvj/VfTXUSPFWaiCYBkXKkCsokK341ghMy umK8xBbDylzazITwIySW1pdGHOVKA4o7iQG322j/rJX8gFMu2tOMlJHt1bGQ6MxbKxqX Q/Vg== X-Gm-Message-State: AOAM531Ecz+/dBVHwgy1drRLrTXWMo1wHEV/UCxKdYMpx09pIGqKTOuk BRCMBxDIAKmJ/AbJEHhXxgN4OInJriDjfAgalmUWLHLKv8o= X-Received: by 2002:a25:504c:0:b0:64b:979c:1bae with SMTP id e73-20020a25504c000000b0064b979c1baemr5408913ybb.563.1652488799877; Fri, 13 May 2022 17:39:59 -0700 (PDT) MIME-Version: 1.0 References: <20220513233640.2518337-1-vladimir.oltean@nxp.com> In-Reply-To: <20220513233640.2518337-1-vladimir.oltean@nxp.com> From: Saravana Kannan Date: Fri, 13 May 2022 17:39:24 -0700 Message-ID: Subject: Re: [RFC PATCH net 0/2] Make phylink and DSA wait for PHY driver that defers probe To: Vladimir Oltean Cc: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Paolo Abeni , Eric Dumazet , Florian Fainelli , Vivien Didelot , Andrew Lunn , Vladimir Oltean , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Rafael J. Wysocki" , Robin Murphy , Geert Uytterhoeven , Rob Herring , Frank Rowand , John Stultz , =?UTF-8?Q?Alvin_=C5=A0ipraga?= , Russell King , Heiner Kallweit Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 Fri, May 13, 2022 at 4:37 PM Vladimir Oltean wrote: > > This patch set completes the picture described by > '[RFC,devicetree] of: property: mark "interrupts" as optional for fw_devlink' > https://patchwork.kernel.org/project/netdevbpf/patch/20220513201243.2381133-1-vladimir.oltean@nxp.com/ I replied to that patch. I don't think we can pull that in. > I've CCed non-networking maintainers just in case they want to gain a > better understanding. If not, apologies and please ignore the rest. > > > > My use case is to migrate a PHY driver from poll mode to interrupt mode > without breaking compatibility between new device trees and old kernels > which did not have a driver for that IRQ parent, and therefore (for > things to work) did not even have that interrupt listed in the "vintage > correct" DT blobs. Note that current kernels as of today are also > "old kernels" in this description. > > Creating some degree of compatibility has multiple components. > > 1. A PHY driver must eventually give up waiting for an IRQ provider, > since the dependency is optional and it can fall back to poll mode. > This is currently supported thanks to commit 74befa447e68 ("net: > mdio: don't defer probe forever if PHY IRQ provider is missing"). > > 2. Before it finally gives up, the PHY driver has a transient phase of > returning -EPROBE_DEFER. That transient phase causes some breakage > which is handled by this patch set, details below. > > 3. PHY device probing and Ethernet controller finding it and connecting > to it are async events. When both happen during probing, the problem > is that finding the PHY fails if the PHY defers probe, which results > in a missing PHY rather than waiting for it. Unfortunately there is > no universal way to address this problem, because the majority of > Ethernet drivers do not connect to the PHY during probe. So the > problem is fixed only for the driver that is of interest to me in > this context, DSA, and with special API exported by phylink > specifically for this purpose, to limit the impact on other drivers. I'll take a closer look at this later this week, but once we add phy-handle support to fw_devlink (the device_bind_driver() is making it hard to add support), I think we can address most/all of these problems automatically. So hopefully we can work towards that? Actually this patch might already fix this for you: https://lore.kernel.org/lkml/20220429220933.1350374-1-saravanak@google.com/ Before fw_devlink, we'd give up on waiting on all suppliers, whether they had a driver (but hadn't yet probed for a multitude of reasons) or not. fw_devlink is smart about allowing consumers to probe without their suppliers only if the supplier has no driver or the driver fails (I'll send a patch for this). The deferred_probe_timeout is what's used to decide when to give up waiting for drivers. -Saravana > > Note that drivers that connect to the PHY at ndo_open are superficially > "fixed" by the patch at step 1 alone, and therefore don't need the > mechanism introduced in phylink here. This is because of the larger span > of time between PHY probe and opening the network interface (typically > initiated by user space). But this is the catch, nfsroot and other > in-kernel networking users can also open the net device, and this will > still expose the EPROBE_DEFER as a hard error for this second kind of > drivers. I don't know how to fix that. From this POV, it's better to do > what DSA does (connect to the PHY on probe). > > Vladimir Oltean (2): > net: phylink: allow PHY driver to defer probe when connecting via OF > node > net: dsa: wait for PHY to defer probe > > drivers/net/phy/phylink.c | 73 ++++++++++++++++++++++++++++++--------- > include/linux/phylink.h | 2 ++ > net/dsa/dsa2.c | 2 ++ > net/dsa/port.c | 6 ++-- > net/dsa/slave.c | 10 +++--- > 5 files changed, 70 insertions(+), 23 deletions(-) > > -- > 2.25.1 >