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,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 5CD39C169C4 for ; Mon, 11 Feb 2019 23:33:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24138214DA for ; Mon, 11 Feb 2019 23:33:39 +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="JfAdSi7u" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727793AbfBKXdi (ORCPT ); Mon, 11 Feb 2019 18:33:38 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:47579 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727424AbfBKXdh (ORCPT ); Mon, 11 Feb 2019 18:33:37 -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=orraGw5HoX4fXpfxQJPIkyD3sATYEXztVMVWoxaH3qc=; b=JfAdSi7u5U8PUuefdKkgv1Q0L+ b6yr5Yd0MLUsiwGG+uDvTiMKu5c68famBjotgwjGk60OqDPen2jHimeINPEkaOfkJuEXzUheZ80/a +vI3E3HHm90+dSkFqkIy6u5cFd6sD/ocT5Uf0Cy9OfeCCkAF59y1Eene96lEOriSFhQU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1gtL4p-0005OJ-JA; Tue, 12 Feb 2019 00:33:27 +0100 Date: Tue, 12 Feb 2019 00:33:27 +0100 From: Andrew Lunn To: John David Anglin Cc: Russell King , Vivien Didelot , Florian Fainelli , netdev@vger.kernel.org Subject: Re: [PATCH net] dsa: mv88e6xxx: Ensure all pending interrupts are handled prior to exit Message-ID: <20190211233327.GB8591@lunn.ch> References: <20190123002240.GF3634@lunn.ch> <20190130172818.GJ21904@lunn.ch> <2ea9fd81-f92d-9505-dd0b-bdd0f67d8ce7@bell.net> <20190130223846.GB30115@lunn.ch> <9415d82e-965b-7777-0ad0-f23d6c9f177e@bell.net> <53b49df8-53ed-704f-9197-230b18d83090@bell.net> <824d011b-3692-69c3-5e2c-58e950a80abf@bell.net> <6a1ebc61-3505-beb8-21cb-ea42ad9fe67e@bell.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6a1ebc61-3505-beb8-21cb-ea42ad9fe67e@bell.net> 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 > Signed-off-by: John David Anglin > --- > drivers/net/dsa/mv88e6xxx/chip.c | 28 ++++++++++++++++++++++------ > 1 file changed, 22 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c > index 8dca2c949e73..12fd7ce3f1ff 100644 > --- a/drivers/net/dsa/mv88e6xxx/chip.c > +++ b/drivers/net/dsa/mv88e6xxx/chip.c > @@ -261,6 +261,7 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_work(struct mv88e6xxx_chip *chip) > unsigned int sub_irq; > unsigned int n; > u16 reg; > + u16 ctl1; > int err; > > mutex_lock(&chip->reg_lock); > @@ -270,13 +271,28 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_work(struct mv88e6xxx_chip *chip) > if (err) > goto out; > > - for (n = 0; n < chip->g1_irq.nirqs; ++n) { > - if (reg & (1 << n)) { > - sub_irq = irq_find_mapping(chip->g1_irq.domain, n); > - handle_nested_irq(sub_irq); > - ++nhandled; > + do { > + for (n = 0; n < chip->g1_irq.nirqs; ++n) { > + if (reg & (1 << n)) { > + sub_irq = irq_find_mapping(chip->g1_irq.domain, > + n); > + handle_nested_irq(sub_irq); > + ++nhandled; > + } > } > - } > + > + mutex_lock(&chip->reg_lock); > + err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &ctl1); > + if (err) > + goto unlock; > + err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, ®); > +unlock: > + mutex_unlock(&chip->reg_lock); > + if (err) > + goto out; > + ctl1 &= GENMASK(chip->g1_irq.nirqs, 0); > + } while (reg & ctl1); Hi David I just tested this on one of my boards. It loops endlessly: [ 47.173396] mv88e6xxx_g1_irq_thread_work: c881 a8 80 [ 47.182108] mv88e6xxx_g1_irq_thread_work: c881 a8 80 [ 47.190820] mv88e6xxx_g1_irq_thread_work: c881 a8 80 [ 47.199535] mv88e6xxx_g1_irq_thread_work: c881 a8 80 [ 47.208254] mv88e6xxx_g1_irq_thread_work: c881 a8 80 These are reg, ctl1, reg & ctl1. So there is an unhandled device interrupt. I think this is because device interrupts are not masked before installing the interrupt handler. But i've not fully got to the bottom of this yet. Andrew