From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A77BFA372A for ; Wed, 16 Oct 2019 15:37:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6DA6620854 for ; Wed, 16 Oct 2019 15:37:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DMprdknd"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="KGODKyti" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DA6620854 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lunn.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=B7iTgOVHXv3cobpePgkr/GIQogcv+ghY0tkLi/BNjHs=; b=DMprdknd1Gahyq eNLkBu8039lTtRfzYzCdQlENLQAWpqp+i3OSu1AiECK3aSzEY3Q7tL0cdd4pXtriMNorxvMUCVexP v7cJDWeeuf8JC0ciw9D9YzZQyHbBVdwQCv9TWfX1ANrb/RMY73YVBKnVZqUDl1NS/Bv5bu9KPxXVl Bmb22EPHS7uOEwI+MAFG9E0QVx2QUsk8qbnbcOowvwvldJngfsyiwakWcitPM81L3yJiTh2Dchyhw LoAwAfkDPzX1APR3MnRVNLpva6L5DN2a1+V0GjQmcCJA/fdXh9flx3nLzcj40NSVtrZvBLN9D+SNA ulQBHLN26LPxY9Wn7jpQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iKlMB-0003Bz-DH; Wed, 16 Oct 2019 15:36:59 +0000 Received: from vps0.lunn.ch ([185.16.172.187]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iKlM8-0003BP-UO; Wed, 16 Oct 2019 15:36:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender: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=+5f6dY8evhyxODaTKehL/4N9iRbwuC90F8UXeraO9vA=; b=KGODKytivjW/MSdVeEUIQ+rVkz 3ilT5scwlhtrAdRHOF5qItaKrEvpjoegAiPCMPGunYirlMsdopw/WifZ62cYSu1bXEWg3cGchJyqv I2zBjIlQlLU5Ufceb9tXkmUxGwTa9MBw9eRtzdp5iw7V2/FWc8ui2HX70BCRCMcncdK8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.92.2) (envelope-from ) id 1iKlLy-0008Fe-Gc; Wed, 16 Oct 2019 17:36:46 +0200 Date: Wed, 16 Oct 2019 17:36:46 +0200 From: Andrew Lunn To: Russell King - ARM Linux admin Subject: Re: lan78xx and phy_state_machine Message-ID: <20191016153646.GG17013@lunn.ch> References: <20191014140604.iddhmg5ckqhzlbkw@beryllium.lan> <20191014163004.GP25745@shell.armlinux.org.uk> <20191014192529.z7c5x6hzixxeplvw@beryllium.lan> <25cfc92d-f72b-d195-71b1-f5f238c7988d@gmx.net> <20191014221211.GR25745@shell.armlinux.org.uk> <524267e6-df8e-d884-aeef-1ed8700e4e58@gmail.com> <20191015220925.GW25745@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191015220925.GW25745@shell.armlinux.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191016_083656_979565_0AFA035C X-CRM114-Status: UNSURE ( 6.59 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Woojung Huh , linux-rpi-kernel@lists.infradead.org, Florian Fainelli , Daniel Wagner , netdev@vger.kernel.org, Microchip Linux Driver Support , bcm-kernel-feedback-list@broadcom.com, Stefan Wahren , linux-arm-kernel@lists.infradead.org, Heiner Kallweit Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org > > - lan78xx_phy_init() (incl. the call to phy_connect_direct()) is called > > after register_netdev(). This may cause races. > > That isn't a problem. We have lots of network device drivers that do > this - in their open() function. Hi Russell Actually, here is it. lan7801_phy_init() finds the PHY device and connects it to the MAC. lan78xx_open() calls phy_start(), with the assumption lan7801_phy_init() has been called. But the stack trace just provided shows this assumption is wrong. As soon a register_netdev() is called, the kernel auto configuration is kicking in and opening the device. lan78xx_phy_init() needs to happen before register_netdev(), or inside lan78xx_open(). Andrew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DF6DFA3728 for ; Wed, 16 Oct 2019 15:36:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5E73B207FF for ; Wed, 16 Oct 2019 15:36:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="KGODKyti" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405088AbfJPPgx (ORCPT ); Wed, 16 Oct 2019 11:36:53 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:48680 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726707AbfJPPgx (ORCPT ); Wed, 16 Oct 2019 11:36:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender: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=+5f6dY8evhyxODaTKehL/4N9iRbwuC90F8UXeraO9vA=; b=KGODKytivjW/MSdVeEUIQ+rVkz 3ilT5scwlhtrAdRHOF5qItaKrEvpjoegAiPCMPGunYirlMsdopw/WifZ62cYSu1bXEWg3cGchJyqv I2zBjIlQlLU5Ufceb9tXkmUxGwTa9MBw9eRtzdp5iw7V2/FWc8ui2HX70BCRCMcncdK8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.92.2) (envelope-from ) id 1iKlLy-0008Fe-Gc; Wed, 16 Oct 2019 17:36:46 +0200 Date: Wed, 16 Oct 2019 17:36:46 +0200 From: Andrew Lunn To: Russell King - ARM Linux admin Cc: Heiner Kallweit , Woojung Huh , Microchip Linux Driver Support , Florian Fainelli , Daniel Wagner , netdev@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, Stefan Wahren , linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org Subject: Re: lan78xx and phy_state_machine Message-ID: <20191016153646.GG17013@lunn.ch> References: <20191014140604.iddhmg5ckqhzlbkw@beryllium.lan> <20191014163004.GP25745@shell.armlinux.org.uk> <20191014192529.z7c5x6hzixxeplvw@beryllium.lan> <25cfc92d-f72b-d195-71b1-f5f238c7988d@gmx.net> <20191014221211.GR25745@shell.armlinux.org.uk> <524267e6-df8e-d884-aeef-1ed8700e4e58@gmail.com> <20191015220925.GW25745@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191015220925.GW25745@shell.armlinux.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > > - lan78xx_phy_init() (incl. the call to phy_connect_direct()) is called > > after register_netdev(). This may cause races. > > That isn't a problem. We have lots of network device drivers that do > this - in their open() function. Hi Russell Actually, here is it. lan7801_phy_init() finds the PHY device and connects it to the MAC. lan78xx_open() calls phy_start(), with the assumption lan7801_phy_init() has been called. But the stack trace just provided shows this assumption is wrong. As soon a register_netdev() is called, the kernel auto configuration is kicking in and opening the device. lan78xx_phy_init() needs to happen before register_netdev(), or inside lan78xx_open(). Andrew