Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1057148iob; Fri, 13 May 2022 21:25:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzO41Vll/947gCBZC8pp9ryp5SSry9tvAJVSyoVb00/ZzEVnivGKLer401S6TLsl2bU/QNh X-Received: by 2002:a5d:5302:0:b0:20c:ff53:e24a with SMTP id e2-20020a5d5302000000b0020cff53e24amr280785wrv.396.1652502330097; Fri, 13 May 2022 21:25:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652502330; cv=none; d=google.com; s=arc-20160816; b=Huc80OO0Gb0G71IbilYn/pSIwiUSDd6P2BneSv+UbgXDU2R88WwDqVqSz+fkG4mDgF TOXjDOAeHhvuKZv9YxSD+2CGVtT1uWa1QMhxQqr0RKpBsKXCrRsXexqDootfP9JeFajA d1RUIeNHYKh670iSeSZYQum75/iBKtsIhTfvYXEiehN25c/WPpPggokH3Tas2FafSidu wSYB+bH3yDmWYwY0hAOMl9OtnqpFMn5cFLkRyHD8F5rZniOuRNPyqXT6O8ax47i9cl7B osoCx9aC8JVVImXbLBg4h6APbOaOFQWVNA0xXB0cz8xEqMgw5x85l13oYq250Oz6tQrP nJXw== 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=qyZsoJknrWOVDvtpNszTIIAof3pgi3xfB+EMxclimb4=; b=bNzI6XiX72upaxBX1uwnjm393Futwl43T8pD/GqIeyVpGvQu550YX9NbeGWtHsJlY7 7M1/bgKOW45VsORfUwACoW0EN+dtCN1u2yj3uLU4we4ByDBthpoT4Cwa6f3I/0ma+rJk WoWHrbvkHChqGSJiUVFHdiIHmy+Lny9xdyuMIM3rWRbM49Bllh9MiFui4YQwwlWNzguP vkwf5nBwCIeX+6TKcw4w+3WiEt7VUAsbO8pnqsbogXU55kNXUp7FDhKQsyOM0kEngjUJ C/gjuBmYESfzFMgJuNGdOMtOy6VBwPpBS6L8odQ0B0CCsiLLCtVBSGQ4RrZeXT90LmEK XAyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=YUKlqPWG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n1-20020adffe01000000b0020c62d43943si3755426wrr.378.2022.05.13.21.25.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 21:25:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=YUKlqPWG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5D8AB35DCA1; Fri, 13 May 2022 19:53:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229979AbiENCx3 (ORCPT + 99 others); Fri, 13 May 2022 22:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229882AbiENCx2 (ORCPT ); Fri, 13 May 2022 22:53:28 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FCE835B1F7; Fri, 13 May 2022 17:59:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=qyZsoJknrWOVDvtpNszTIIAof3pgi3xfB+EMxclimb4=; b=YUKlqPWGIDZvhXATbELAlppcVk 92/7Q/rIwsA0xahE9uRHrV3gPbUEYEv1caC2w8u4thxI4DZV33oa7K1SUXBsSPdiaPrKdyPix/5QH oYl1lWBxbSzo2oFcsrRYadLQzEMPbCWhroO2ghC15gjxxUxR5c16PCzSrzvjpeagk87c=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1npfZX-002hd6-UG; Sat, 14 May 2022 02:23:51 +0200 Date: Sat, 14 May 2022 02:23:51 +0200 From: Andrew Lunn To: Vladimir Oltean Cc: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" , Paolo Abeni , Eric Dumazet , Florian Fainelli , Vivien Didelot , Vladimir Oltean , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Saravana Kannan , Greg Kroah-Hartman , "Rafael J. Wysocki" , Robin Murphy , Geert Uytterhoeven , Rob Herring , Frank Rowand , John Stultz , Alvin =?utf-8?Q?=C5=A0ipraga?= , Russell King , Heiner Kallweit Subject: Re: [RFC PATCH net 0/2] Make phylink and DSA wait for PHY driver that defers probe Message-ID: References: <20220513233640.2518337-1-vladimir.oltean@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220513233640.2518337-1-vladimir.oltean@nxp.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Sat, May 14, 2022 at 02:36:38AM +0300, 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'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. There is a very different approach, which might be simpler. We know polling will always work. And it should be possible to transition between polling and interrupt at any point, so long as the phylock is held. So if you get -EPROBE_DEFFER during probe, mark some state in phydev that there should be an irq, but it is not around yet. When the phy is started, and phylib starts polling, look for the state and try getting the IRQ again. If successful, swap to interrupts, if not, keep polling. Maybe after 60 seconds of polling and trying, give up trying to find the irq and stick with polling. Andrew