Received: by 2002:ab2:7104:0:b0:1f7:f6c3:9cb1 with SMTP id z4csp1670lql; Tue, 7 May 2024 08:15:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWgt3THTYIGIvK0KgYjea1e1M+R3YzaEN0AWy0g/5jFNTeI0K3DtMv0t4e5wUsgjdAdNi4jwfMlcE3wkVzIIutFis3+pdWKHsRBo1wXRw== X-Google-Smtp-Source: AGHT+IFqhJGgsrRuOwdnEpIEZS0CG4ICgju/tiwXeFAC9nHRO5U7NIczurTS7mvaDotrKykx/3OL X-Received: by 2002:a17:903:40c2:b0:1eb:3df4:c31d with SMTP id t2-20020a17090340c200b001eb3df4c31dmr15430458pld.42.1715094952306; Tue, 07 May 2024 08:15:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715094952; cv=pass; d=google.com; s=arc-20160816; b=kl7mNZjoVElyc3nllkINCn6AwyFYehwnAtH1/Sb4DffQXyrcuIvY7627BcwEmcKZUl Wcj51sjPFKjjw/nHx3S6tuw5o/hfDvbw54Jyc7BsxRI+zjkkP/JrNCpaKhIcBDOYgc2f on5gr27lI43sddYIRPbne+583DUUTfNUaHS6N3O/wTrDJqutqFUBKp+8xks5o3orZ3CW 1bnDgTe/dmC9FjewT38kBZYJ7KzIKtiuceMW5zs8EkxAq+sjmdVBJop+9NKPRddZuJ9g ZQcOqtE3c9UN8Q++3x1Tp5SrIjokTb+QwXXFi0HJKsyU3zMInmjX/+WqzJMnHrPH4PVs 4NVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mTLDRJ+Y2C9qtVA6GvAyqMW7FNLo8bVgJpqdecb1Xoc=; fh=iKNJVdWbFejD3UyTOm8GIXJyM8RR+p1eQeLae0PJCcI=; b=0wiJgwGDsbs/bZx6R4qBz+tiY44+B3AW8Ir+p+mnCXyzsKd2rMa4lOAP4OXBLzcon1 q1u3v/m3wQ6JeBFa1E5JIKVyKkt3eGcIJ8nBclSoXcKUcSAKT2Tkx1hz2NjTlWsT9/Ks xcyUfflUNRj/op95AQKORf9/Me2Bora3rtdwWn3bK0deCdnqLlEUaLq0/fmw58oph7/P S3R2KPTrfGSay6uTLAjve9pPAJmiL0ieNzhB5PfiUrRN+qPalk6bpwCkJ2hRmDmyT9Co J/WOKfAppyQ2OVbwuRP3n9qzAU3QdMxYoEwFMAL5YiWwogTCSJ/zRHFVsvTfDi1lkETF FtRQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fhy8m5Bx; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-171611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171611-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id l19-20020a170902f69300b001e905a66560si9120755plg.521.2024.05.07.08.15.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 08:15:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fhy8m5Bx; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-171611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171611-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C440EB224D2 for ; Tue, 7 May 2024 14:49:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7AC8161322; Tue, 7 May 2024 14:48:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fhy8m5Bx" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DD1016079C for ; Tue, 7 May 2024 14:48:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715093321; cv=none; b=HT18JiVjh5/qjjPDJElzlJ4IHB5vCzJ07MHtSYNJzgxlsJauYawgD2iAKb4K+jcF36AQzZvxs90HGIhCOh+p3t0MAjLnGbucklxEtBFcnZHl3W5hrZ+fGriaUw50uz5aKMaV4rv6X5f5H2z2XwOhiVMZBWef6fGMkAOaoKNoP6Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715093321; c=relaxed/simple; bh=I06cK2vAYPdgqkwrUehfSpbUrypwMSIUfL2EgGKqmKU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ksWqethFb2YDznrOrRlNN5trzuMmNfxnhstjRtg6STIdeW/OrYQJfJd1R8/0Nup+6n8Rs4gx7FOFrcXv+oYWpM9S6tBy+qRcE2hx3fQoiZmQKdso+yq4Jm7ef32sucEwkUyrDVfJ5gG+3BY341M7mi/+HnfPqI4gryB7JZcJa+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fhy8m5Bx; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715093319; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mTLDRJ+Y2C9qtVA6GvAyqMW7FNLo8bVgJpqdecb1Xoc=; b=fhy8m5BxQSzXx8PhyeVixJNHNA/vRNrZQ9jEmK1Ex5Qz6f1a9fzr3dwj5UKTQAv9yYhWRH gygMLGBe2NBbPeIcU8Rc/ojFbJLdIkYBg87sip2FnyshKmAl4iwc6w9qvdyMfY3G38RE/S NdgpDkeHUnqz/k+kXmlZ0I5Uguj3Ezo= Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-271-bKW3UGM1MMa6kRV08Xovhw-1; Tue, 07 May 2024 10:48:37 -0400 X-MC-Unique: bKW3UGM1MMa6kRV08Xovhw-1 Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-61b7d7c293cso2876274a12.0 for ; Tue, 07 May 2024 07:48:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715093316; x=1715698116; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mTLDRJ+Y2C9qtVA6GvAyqMW7FNLo8bVgJpqdecb1Xoc=; b=AMe5QISecVfsKTLzddLPpdSeByfS/Fia7qWjx493aUUUPQqN9tjthtvykW6SNtGj3M Iwfjmq2LuVCIP/mME6Lk0b+pXqzo2otrCS4Dh7nlCaqafhXYIeY9SSIsUBCUE6wUhagi ziX2pReO0jEvGi718qtLRAa+klpl9Uek+RYEjtgiLjbJhGzBjvKFo2nRlk/oQ3M4KEqO 2abrOUZ/SAPZfEh67ttmh1TXWQRbQPVri67bbYV/b8THRXHXVNhuOib/0IPzTCdNK1Zh XyXXthxNRDykbw+6Djj9nt5wPxwsVCD6c0Pxr+Te/EUJDYm9k0AyEKRC0hhJ0rt/x4XF y+iw== X-Forwarded-Encrypted: i=1; AJvYcCWp+R+bl7hMibfl4Cy+vQ1iGPbBtCeg0U+lG6t1Mhan/X/t5HDmMT3snmGmZQL8RnMrdI+KcaZmVAjxYNvZ7y3CuQNegCuSbq4KQ4+E X-Gm-Message-State: AOJu0YwutZwJEs4bGEoDHBan5AcKRvWOC36zKxRMVW8d1QTWYB0BLyXy /0w7WMjrO003ES7URf7lSi6QCcBxHJTiEsOWA9j2iauYGQ6lJ3XxuxIxjjRDFPOh6VDudphAYGz fP+pNTFIbZv5oIHlxWKJ0AnuM7c4QDop01v6t1wvu5xI134uWaGLugY1JSQ8WmQ== X-Received: by 2002:a05:6a20:2d0a:b0:1ad:31e2:56c with SMTP id g10-20020a056a202d0a00b001ad31e2056cmr16115653pzl.8.1715093315929; Tue, 07 May 2024 07:48:35 -0700 (PDT) X-Received: by 2002:a05:6a20:2d0a:b0:1ad:31e2:56c with SMTP id g10-20020a056a202d0a00b001ad31e2056cmr16115613pzl.8.1715093315306; Tue, 07 May 2024 07:48:35 -0700 (PDT) Received: from x1gen2nano ([2600:1700:1ff0:d0e0::33]) by smtp.gmail.com with ESMTPSA id w22-20020a056a0014d600b006f43c013f66sm4429038pfu.173.2024.05.07.07.48.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 07:48:34 -0700 (PDT) Date: Tue, 7 May 2024 09:48:30 -0500 From: Andrew Halaney To: Andrew Lunn Cc: Serge Semin , "Russell King (Oracle)" , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org, alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, hkallweit1@gmail.com Subject: Re: racing ndo_open()/phylink*connect() with phy_probe() Message-ID: References: <7723d4l2kqgrez3yfauvp2ueu6awbizkrq4otqpsqpytzp45q2@rju2nxmqu4ew> <25d1164e-0ac2-4311-ad27-aa536dca3882@lunn.ch> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25d1164e-0ac2-4311-ad27-aa536dca3882@lunn.ch> On Fri, May 03, 2024 at 03:25:19AM GMT, Andrew Lunn wrote: > > AFAICS the problem is in the race between the end0 and end1 device > > probes. Right? > > If so then can't the order be fixed by adding the links between the > > OF-devices? As it's already done for various phandle-based references > > like "clocks", "gpios", "phys", etc? Thanks for the pointer here Serge, I had no idea (still don't have much of an idea) on how this works. I think this makes sense to explore some more. Hopefully sometime this week I'll poke at this more. > > It gets tricky because an MDIO bus master device is often a sub device > of an Ethernet MAC driver. Typically how it works is that a MAC driver > probes. Part way through the probe it creates an MDIO bus driver, > which enumerates the MDIO bus and creates the PHYs. Later in the MAC > driver probe, or maybe when the MAC driver is opened, it follows the > phy-handle to a PHY on its own MDIO bus. > > If you were to say it cannot probe the MAC driver until the MDIO bus > driver is created and the PHYs created, you never get anywhere, > because it is the act of probing the MAC driver which creates the PHYs > which fulfils the phandle. > > You would need to differentiate between a phandle pointing deeper into > the same branch of a DT tree, or pointing to a different branch of a > DT tree. If it is deeper within the same branch, you need to probe in > order to make progress. If it points to a different branch you need to > defer until that sub-branch has successfully probed. And if you get > two branches which are mutually dependent on each other, probe and > hope EPROBE_DEFER solves it. I'll keep this relationship in mind. IIUC the fw_devlink stuff sort of handles cycles, but I need to look into how all that works further. At least in my example device, end0 is in this situation, whereas end1 is in the other situation, so I have a decent test setup for that.