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=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED 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 E8180C43381 for ; Thu, 14 Feb 2019 04:47:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF5B921904 for ; Thu, 14 Feb 2019 04:47:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395503AbfBNErd (ORCPT ); Wed, 13 Feb 2019 23:47:33 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:48404 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395497AbfBNErd (ORCPT ); Wed, 13 Feb 2019 23:47:33 -0500 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::bf5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 4EC5C14CF56C7; Wed, 13 Feb 2019 20:47:32 -0800 (PST) Date: Wed, 13 Feb 2019 20:47:31 -0800 (PST) Message-Id: <20190213.204731.2262809689964875254.davem@davemloft.net> To: andrew@lunn.ch Cc: dave.anglin@bell.net, linux@arm.linux.org.uk, vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com, netdev@vger.kernel.org Subject: Re: [PATCH net] dsa: mv88e6xxx: Ensure all pending interrupts are handled prior to exit From: David Miller In-Reply-To: <20190214020723.GE24589@lunn.ch> References: <824d011b-3692-69c3-5e2c-58e950a80abf@bell.net> <6a1ebc61-3505-beb8-21cb-ea42ad9fe67e@bell.net> <20190214020723.GE24589@lunn.ch> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 13 Feb 2019 20:47:32 -0800 (PST) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Andrew Lunn Date: Thu, 14 Feb 2019 03:07:23 +0100 > On Mon, Feb 11, 2019 at 01:40:21PM -0500, John David Anglin wrote: >> The GPIO interrupt controller on the espressobin board only supports edge interrupts. >> If one enables the use of hardware interrupts in the device tree for the 88E6341, it is >> possible to miss an edge. When this happens, the INTn pin on the Marvell switch is >> stuck low and no further interrupts occur. >> >> I found after adding debug statements to mv88e6xxx_g1_irq_thread_work() that there is >> a race in handling device interrupts (e.g. PHY link interrupts). Some interrupts are >> directly cleared by reading the Global 1 status register. However, the device interrupt >> flag, for example, is not cleared until all the unmasked SERDES and PHY ports are serviced. >> This is done by reading the relevant SERDES and PHY status register. >> >> The code only services interrupts whose status bit is set at the time of reading its status >> register. If an interrupt event occurs after its status is read and before all interrupts >> are serviced, then this event will not be serviced and the INTn output pin will remain low. >> >> This is not a problem with polling or level interrupts since the handler will be called >> again to process the event. However, it's a big problem when using level interrupts. >> >> The fix presented here is to add a loop around the code servicing switch interrupts. If >> any pending interrupts remain after the current set has been handled, we loop and process >> the new set. If there are no pending interrupts after servicing, we are sure that INTn has >> gone high and we will get an edge when a new event occurs. >> >> Tested on espressobin board. >> >> Signed-off-by: John David Anglin > > Fixes: dc30c35be720 ("net: dsa: mv88e6xxx: Implement interrupt support.") > > Tested-by: Andrew Lunn > > David, please ensure that Heiner's patch: > > net: phy: fix interrupt handling in non-started states > > is applied first. Otherwise we can get into an interrupt storm. Ok, all done. Should I queue just this one for -stable? I didn't queue up Heiner's change for -stable because it fixes a 5.0-rcX regression.