Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4344998rwd; Tue, 23 May 2023 06:37:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ459K0cWING+eUdqlLpr5Rvvh7YT3YPSPLTn8M7Md8SdBzAAslDNRZiE4Y9sPHXICZXNXmX X-Received: by 2002:a17:902:ec81:b0:1af:bdeb:a0a0 with SMTP id x1-20020a170902ec8100b001afbdeba0a0mr5070114plg.24.1684849049353; Tue, 23 May 2023 06:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684849049; cv=none; d=google.com; s=arc-20160816; b=ypNWr1+DdHLJBmsMGOjSG1b2a8b9IoU4ESeY7hhfOYh6T6lpdKQNdS8tZBMPc8GUVX OPPTEXumQ588rF+nRXcYF82rmkvH/LjO7z82sJrYG+SeShD11dykGsAWZpYHv9aCj1ZD 1uHFtAicxqsx244Qz8dZMkqHyIYTnLmEKboD+kQCdcneX6rvwh1C8u000b6T+B1iSaHp +fok5PpQE9D0tFXZCiU7JPmIj7m/DTKdKX7rxpaQGEaLNFuayIB/ZOQAjAAsRnp42Mf+ ZPG99VZxhycf1TsfRZh696p8c/NdQDD1fZv74wfbLgeYfLavh6X7bvAbJN9cOjHNESgY Nw+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=alO6JwQC1JNZ2m5XHtnYwz8UC6vVgl8pvlv5umboVKg=; b=NcxI6jdHnfG0oWKFlk0SbAjjiIMYz9AUS6YIROLcBWtmTCCRE/4415wyH/LSLLIx2c oqSvfNnGpJYl8v4Tuug8+nOFj8OKxn9HXLUwSE1vCKC5rYP362sGRd6nxu+za7KYGIiD eo0v4T1+CY6jJQNvmtyp7AklMfAlb9UUT88qzoPb2ciWFE5bB3Xk0bY6TxgTL9oaOJDC HAZ2jPSSlsCjgQ2zb2VR/PzqQfSWMHvZJ/7HZY8hPzcxk499gn/BNR6PuJ2cQ+p/JrvI niE3UhM/Em8NAgeJui0wNVFrcG6f0t661ZIG7kc2WyS7xhLJKW2mpNtAGyJz+aQ9cFwk a5/A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q3-20020a170902dac300b001afcd047456si1320769plx.636.2023.05.23.06.37.13; Tue, 23 May 2023 06:37:29 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236848AbjEWNct (ORCPT + 99 others); Tue, 23 May 2023 09:32:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236782AbjEWNcr (ORCPT ); Tue, 23 May 2023 09:32:47 -0400 Received: from smtp.missinglinkelectronics.com (smtp.missinglinkelectronics.com [162.55.135.183]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72BC5CA; Tue, 23 May 2023 06:32:46 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by smtp.missinglinkelectronics.com (Postfix) with ESMTP id DB07E2066D; Tue, 23 May 2023 15:32:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at missinglinkelectronics.com Received: from smtp.missinglinkelectronics.com ([127.0.0.1]) by localhost (mail.missinglinkelectronics.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xbQzKADQGLtw; Tue, 23 May 2023 15:32:44 +0200 (CEST) Received: from nucnuc.mle (p578c5bfe.dip0.t-ipconnect.de [87.140.91.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: david) by smtp.missinglinkelectronics.com (Postfix) with ESMTPSA id 60A8720484; Tue, 23 May 2023 15:32:44 +0200 (CEST) Date: Tue, 23 May 2023 15:32:36 +0200 From: David Epping To: Andrew Lunn Cc: Vladimir Oltean , Russell King , Heiner Kallweit , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, UNGLinuxDriver@microchip.com Subject: Re: [PATCH net v2 0/3] net: phy: mscc: support VSC8501 Message-ID: <20230523133236.GA7185@nucnuc.mle> References: <20230523090405.10655-1-david.epping@missinglinkelectronics.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE 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, May 23, 2023 at 03:16:51PM +0200, Andrew Lunn wrote: > > - I left the mutex_lock(&phydev->lock) in the > > vsc85xx_update_rgmii_cntl() function, as I'm not sure whether it > > is required to repeatedly access phydev->interface and > > phy_interface_is_rgmii(phydev) in a consistent way. > > Just adding to Russell comment. > > As a general rule of thumb, if your driver is doing something which no > other driver is doing, you have to consider if it is correct. A PHY > driver taking phydev->lock is very unusual. So at minimum you should > be able to explain why it is needed. And when it comes to locking, > locking is hard, so you really should understand it. > > Now the mscc is an odd device, because it has multiple PHYs in the > package, and a number of registers are shared between these PHYs. So > it does have different locking requirements to most PHYs. However, i > don't think that is involved here. Those oddities are hidden behind > phy_base_write() and phy_base_read(). > > Andrew Russell, Andrew, as you stated, locking is hard, and I am not in detail familiar with the mscc driver and the supported PHYs behavior. Also, I only have VSC8501, the single PHY chip, and none of the multi PHY chips to test. And testing these corner cases and race conditions is hard anyways. Thus my current patch is not touching the locking code at all, and assumes the current mainline code is correct in that regard. Because I don't understand all implications, I'm hesitant to change the existing locking scheme. Maybe this can be a separate patch? In the current patch set I'm not making the situation worse (unlike the first one where I added locks which Russell pointed out). If you insist and all agree the locks should be removed with this patch set, I'll update it of course.