Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5617626rwi; Tue, 18 Oct 2022 01:28:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM58ZUO6qz28y8NWya/dUnZQnU8a67+jssxSZlmr3i1b+lW2asj31LzfYuFCWMaIHEzIpmxZ X-Received: by 2002:a05:6a00:2291:b0:563:9d0d:62ae with SMTP id f17-20020a056a00229100b005639d0d62aemr2094548pfe.17.1666081695849; Tue, 18 Oct 2022 01:28:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666081695; cv=none; d=google.com; s=arc-20160816; b=rv4wi44sv5JCjrDTKDtALZMLX5PFgoc2dooz9WxPrABvPKsZmUlbg/WfHiMWfAFVzX 2waGsXf1k6kwiSlXQPdyXu7F1xba29wKNBL5IBEb+CVUVh7UcvSfKoBPeXp0JriGZ/rv a7EhJQKFBst0wTQaWyeAqymAGqheoov1/KnSwtKlutGNEeON2OOD5kc671HSsmF6T45h wS0omlmWsAZXdVSSnpi1xEJLHbf/OVjZHw9aTTQvI5YC1/NqHv/ACgYYhF71hRE5nqg6 IirFfF1/vl6BfxwHlY8YUgtFqPqRA5nYrkon0tLbfr9lVgNUBUh/2hThxjKrGhPhWA49 JVDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=r1TxYC0slJVe2mkpKf7pL1bopDnMUMi1PqaWciekznc=; b=FuproBW8mJR3Vf7kBnE2zzDfGRITzREIT55d0smMQWKmR21x9ty4CAasdj0AQ6Y8QO ZutnjrK+HSQFaWy9HJXeiuxCzwDz5K3Xgzdf0YyD/l2vjOaztIpUXNFumk/0mSGR2lr0 1KAKIwFb/KzsKOYOpch7NA2HPbmG7ueXua5qiiJrcxU+PzaLgvzycUX8FwMkVx2QyXO+ bbPSz7uWt1UkMLSO6ldvqHKh66TWgsnoTs2BNvLdE5JEc8y+qW8qTDTspn7ZQoVVbGOm cQUOPzp5Y8BZPOEXuCRig4Ndm1tiVEgSRz6b8ZHEXLnPLNDq4smQtbvR3co3jz5RNzJF Su6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=Zlx+jYyn; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w24-20020a17090aaf9800b0020d39ffe9aesi18489069pjq.112.2022.10.18.01.28.04; Tue, 18 Oct 2022 01:28:15 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=Zlx+jYyn; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230218AbiJRICm (ORCPT + 99 others); Tue, 18 Oct 2022 04:02:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229770AbiJRICj (ORCPT ); Tue, 18 Oct 2022 04:02:39 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3517C84E6A; Tue, 18 Oct 2022 01:02:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=r1TxYC0slJVe2mkpKf7pL1bopDnMUMi1PqaWciekznc=; b=Zlx+jYynivcCjWcnHQqo0vFWcH 4RA26wsE8kmjTnrYuDmdB4uO+aAMan0UlfSnw7Sym074Wkmzo1T+23QGJ81jhnTKHVNxUDDeiaQUB hXim3dcqdj5mbv5CtplvZRbYD1ULewNaq6Qi3a56h31fXxFAKH4mB6CxRkAhQmnvooQS5/uHgyMP6 qEDIZzCffCKoKdRvKJUE2mL3v0russVwkMizIgKv1oXEZP/AAzAN7E0xqCyWosCA8j+mqKrjEFQr4 4ACKb51M+xESOMf6+aZy/1ufWvT8GeKTviRQBfIWZVYMjZQRBRgGprab95R9973U1tr0paXyl8+gg 5pTo+kdg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34766) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1okhYO-0004Bh-B2; Tue, 18 Oct 2022 09:02:24 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1okhYJ-0000vX-NR; Tue, 18 Oct 2022 09:02:19 +0100 Date: Tue, 18 Oct 2022 09:02:19 +0100 From: "Russell King (Oracle)" To: Frank Cc: Peter Geis , Andrew Lunn , Heiner Kallweit , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , yinghong.zhang@motor-comm.com, fei.zhang@motor-comm.com, hua.sun@motor-comm.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v7] net: phy: Add driver for Motorcomm yt8521 gigabit ethernet phy Message-ID: References: <20221018011439.1169-1-Frank.Sae@motor-comm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221018011439.1169-1-Frank.Sae@motor-comm.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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, Oct 18, 2022 at 09:14:39AM +0800, Frank wrote: > Add a driver for the motorcomm yt8521 gigabit ethernet phy. We have verified > the driver on StarFive VisionFive development board, which is developed by > Shanghai StarFive Technology Co., Ltd.. On the board, yt8521 gigabit ethernet > phy works in utp mode, RGMII interface, supports 1000M/100M/10M speeds, and > wol(magic package). > > Signed-off-by: Frank > --- > patch v7: > Hi Russell > > > As previously pointed out, dropping the MDIO bus lock in a > > phy_select_page()..phy_restore_page() region unsafe. I think you need > > to ensure that yt8521_fiber_config_aneg() is safe to be called under > > the lock, and I suspect having a version of genphy_config_aneg() which > > can be called with the lock held would be a better approach. > > with your suggestion we add yt8521_set_page() which does not hold the lock. And so you don't understand the locking issues... If you drop the lock, it means that some other thread (e.g. userspace) can come in and change the page register under you, which will completely change which register(s) you are accessing. Please implement locking properly, don't bodge around with it. I made my suggestion above specifically after having thought about the issues and what would be possible to give a correct locking implementation. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!