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=-8.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham 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 9E4A5C282C4 for ; Tue, 12 Feb 2019 19:37:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 62D7E222C0 for ; Tue, 12 Feb 2019 19:37:22 +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="IcmE3c6l" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732284AbfBLThV (ORCPT ); Tue, 12 Feb 2019 14:37:21 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:48910 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727428AbfBLThU (ORCPT ); Tue, 12 Feb 2019 14:37:20 -0500 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=SldYNqglna9yLgbuN8CYVchu2r0BdPwj+N4Af83G4xQ=; b=IcmE3c6lDOJ2O29n4YnxF9sXhq m7bm1iqiEBrKg1TYxy1y9IWxXrg/0If1JfMHjLU8BwpBE2WyMISi893VfrMw+B1vqTYIaN22quO2Q joDO7ZBnlryvUVEe1T9p8njDth1b0gUEilIGQ9fmT0lXJffmQb/+c9WEb8KHZ6ux9SkM=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1gtdro-0006Ut-EM; Tue, 12 Feb 2019 20:37:16 +0100 Date: Tue, 12 Feb 2019 20:37:16 +0100 From: Andrew Lunn To: Heiner Kallweit Cc: Florian Fainelli , David Miller , "netdev@vger.kernel.org" , Russell King - ARM Linux Subject: Re: [PATCH net] net: phy: fix interrupt handling in non-started states Message-ID: <20190212193716.GD7527@lunn.ch> References: <25e86edc-0b88-8c03-b692-776e971331f2@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25e86edc-0b88-8c03-b692-776e971331f2@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Feb 12, 2019 at 07:56:15PM +0100, Heiner Kallweit wrote: > phylib enables interrupts before phy_start() has been called, and if > we receive an interrupt in a non-started state, the interrupt handler > returns IRQ_NONE. This causes problems with at least one Marvell chip > as reported by Andrew. > Fix this by handling interrupts the same as in phy_mac_interrupt(), > basically always running the phylib state machine. It knows when it > has to do something and when not. > This change allows to handle interrupts gracefully even if they > occur in a non-started state. > > Fixes: 2b3e88ea6528 ("net: phy: improve phy state checking") > Reported-by: Andrew Lunn > Signed-off-by: Heiner Kallweit > --- > drivers/net/phy/phy.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c > index 189cd2048c3a..ca5e0c0f018c 100644 > --- a/drivers/net/phy/phy.c > +++ b/drivers/net/phy/phy.c > @@ -762,9 +762,6 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat) > { > struct phy_device *phydev = phy_dat; > > - if (!phy_is_started(phydev)) > - return IRQ_NONE; /* It can't be ours. */ > - > if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev)) > return IRQ_NONE; Hi Heiner Did you look at ommit 3c3070d713d798f7f9e7ee3614e49b47655d14d8 Author: Maciej W. Rozycki Date: Tue Oct 3 16:18:35 2006 +0100 [PATCH] 2.6.18: sb1250-mac: Phylib IRQ handling fixes This patch fixes a couple of problems discovered with interrupt handling in the phylib core, namely: 1. The driver uses timer and workqueue calls, but does not include nor . 2. The driver uses schedule_work() for handling interrupts, but does not make sure any pending work scheduled thus has been completed before driver's structures get freed from memory. This is especially important as interrupts may keep arriving if the line is shared with another PHY. The solution is to ignore phy_interrupt() calls if the reported device has already been halted and calling flush_scheduled_work() from phy_stop_interrupts() (but guarded with current_is_keventd() in case the function has been called through keventd from the MAC device's close call to avoid a deadlock on the netlink lock). Signed-off-by: Maciej W. Rozycki patch-mips-2.6.18-20060920-phy-irq-16 Signed-off-by: Jeff Garzik There has been a lot of change since then, so maybe this is no longer an issue? Thanks Andrew