From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f169.google.com ([209.85.128.169]:41012 "EHLO mail-wr0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751697AbeBYNAx (ORCPT ); Sun, 25 Feb 2018 08:00:53 -0500 Received: by mail-wr0-f169.google.com with SMTP id f14so18441369wre.8 for ; Sun, 25 Feb 2018 05:00:52 -0800 (PST) Subject: Re: Potential issue with f5e64032a799 "net: phy: fix resume handling" To: Andrew Lunn , Russell King Cc: "netdev@vger.kernel.org" References: <4886212b-0274-ffa0-f98e-da2e43a3b042@gmail.com> <20180203201748.GN16818@lunn.ch> From: Heiner Kallweit Message-ID: <80586c54-2a59-04ef-a623-78d340ba6206@gmail.com> Date: Sun, 25 Feb 2018 14:00:43 +0100 MIME-Version: 1.0 In-Reply-To: <20180203201748.GN16818@lunn.ch> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: Am 03.02.2018 um 21:17 schrieb Andrew Lunn: > On Sat, Feb 03, 2018 at 05:41:54PM +0100, Heiner Kallweit wrote: >> This commit forces callers of phy_resume() and phy_suspend() to hold >> mutex phydev->lock. This was done for calls to phy_resume() and >> phy_suspend() in phylib, however there are more callers in network >> drivers. I'd assume that these other calls issue a warning now >> because of the lock not being held. >> So is there something I miss or would this have to be fixed? > > Hi Heiner > > This is a good point. > > Yes, it looks like some fixes are needed. But what exactly? > The issue with phy_suspend/phy_resume and the changed locking behavior is still open AFAICS. There was a proposed fix https://www.mail-archive.com/netdev@vger.kernel.org/msg215455.html and then the discussion stopped. I think we need the fix before 4.16 leaves the rc phase. Heiner > The phy state machine will suspend and resume the phy is you call > phy_stop() and phy_start() in the MAC suspend and resume functions. > > A few examples: > > tc35815_suspend(), ravb_suspend() via ravb_close(), sh_eth_suspend() > via sh_eth_close(), fec_suspend(), mpc52xx_fec_of_suspend() via > mpc52xx_fec_close(), ucc_geth_suspend(), etc... > > So i suspect those drivers which call phy_suspend()/phy_resume() > should really be modified to call phy_stop()/phy_start(). > > hns_nic_config_phy_loopback() is just funky, and probably needs the > help of the hns guys to fix. > > dsa_slave_suspend() already does a phy_stop(), so the phy_suspend() > can be removed. > > The comments in lpc_eth_open() suggest the phy_resume() is needed, so > locks should be added. socfpga_dwmac_resume() seems to be the same. > > Andrew >