Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5457000imm; Tue, 16 Oct 2018 10:30:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV62U5a9QzgL8NOljiDoQlAcqaXUTLA2TFaKl24QQDOVuL57F3iVFBbkGvfYI1iCi6htrKdJU X-Received: by 2002:a17:902:b28b:: with SMTP id u11-v6mr22184496plr.326.1539711029560; Tue, 16 Oct 2018 10:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539711029; cv=none; d=google.com; s=arc-20160816; b=yc4Di1GNgIhCOZxkgq+CtVKNfg8cVhuzYRJTEQbx6T4/UhtUs/RbfBchmjqoiPJLpH 9GUs6N61BDwAMFNT8mo9K8bAdmN6K2AD+CrYSwAhIDZt7BNZ/WMIMCOheDTGu5Xdc2+h g2xazxteflZG722bjMzLolYujhVb1Yskcuf8XBMxXr3qOQgKkxCbsZ2hderwo3eRuPP3 E7kpC18D19y1ySyG6w9gmHQFg1cy0R+qxqsTMoyXbtnWNBYsPql+MCbluf0Kb7sFRoM5 A9mo2hUVs8eqoGsSaJbPOHIB18VaAFNbo0mpdNlwvBRO93od3xnUWA9OC6Ut8kW42ePE fwjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SrZsYscDqhuC/Rsa9lIfQJe/9V+AcAHlKa3s4wX1awY=; b=fyuWEnMHXPvOKeIUPqCI6rxiisUmLPSf/KzCQAuV4ZXmcdvElcFJbExQXbPqLPAoxl bKfa3Q5FZQ8QcfeZ/zEsxaoYwEX8Uewd9ggbRt1r5vCbCWupPExu4MJsUzMfWot55U3Y CL6y0J5IxctS1nFpZO09Q0CrUK5EOjOK8lEv2iMh2uzY9tSjhSOo1t40iM6FZBO0IAS1 ZRLSkRFP30xjyvtfqkXxDldkfbtQmYZ8SqFLyMX1EhGt2/79n/ZGvX81mxYSkrfFcwET lj9+vu4jJ7vzsW2HD0Tt03h6G2n9ssMlbzVOqLHQYWttPgZlBG852a4znJ3LAFm/yRf3 9UhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CBKBLf56; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h91-v6si3854221pld.81.2018.10.16.10.30.13; Tue, 16 Oct 2018 10:30:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CBKBLf56; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731594AbeJQBPg (ORCPT + 99 others); Tue, 16 Oct 2018 21:15:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:34204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbeJQBPe (ORCPT ); Tue, 16 Oct 2018 21:15:34 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 628F220658; Tue, 16 Oct 2018 17:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710648; bh=KRMW/nsOss2tN8CxzE+xeJlK2zj18MBIWi4fqreeZjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CBKBLf56WZdhRioxODhYldUjsy2c4jZ5u0VrSvB89OVEr3aN3jh+HiJdwrZ7AhMkw coJ7RSZLsLEDafxKDQzm0lrj+IzwHvaYxJqmqWdS9TSbEOsyJLeuIqE5m2Mb2iMM+f PkhhR2iFxbqEofupDMd3ffAyJcpoCJ3u9FnCFjLY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , "David S. Miller" Subject: [PATCH 4.9 39/71] net: systemport: Fix wake-up interrupt race during resume Date: Tue, 16 Oct 2018 19:09:36 +0200 Message-Id: <20181016170541.340505693@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Fainelli [ Upstream commit 45ec318578c0c22a11f5b9927d064418e1ab1905 ] The AON_PM_L2 is normally used to trigger and identify the source of a wake-up event. Since the RX_SYS clock is no longer turned off, we also have an interrupt being sent to the SYSTEMPORT INTRL_2_0 controller, and that interrupt remains active up until the magic packet detector is disabled which happens much later during the driver resumption. The race happens if we have a CPU that is entering the SYSTEMPORT INTRL2_0 handler during resume, and another CPU has managed to clear the wake-up interrupt during bcm_sysport_resume_from_wol(). In that case, we have the first CPU stuck in the interrupt handler with an interrupt cause that has been cleared under its feet, and so we keep returning IRQ_NONE and we never make any progress. This was not a problem before because we would always turn off the RX_SYS clock during WoL, so the SYSTEMPORT INTRL2_0 would also be turned off as well, thus not latching the interrupt. The fix is to make sure we do not enable either the MPD or BRCM_TAG_MATCH interrupts since those are redundant with what the AON_PM_L2 interrupt controller already processes and they would cause such a race to occur. Fixes: bb9051a2b230 ("net: systemport: Add support for WAKE_FILTER") Fixes: 83e82f4c706b ("net: systemport: add Wake-on-LAN support") Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bcmsysport.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -828,14 +828,22 @@ static void bcm_sysport_resume_from_wol( { u32 reg; - /* Stop monitoring MPD interrupt */ - intrl2_0_mask_set(priv, INTRL2_0_MPD); - /* Clear the MagicPacket detection logic */ reg = umac_readl(priv, UMAC_MPD_CTRL); reg &= ~MPD_EN; umac_writel(priv, reg, UMAC_MPD_CTRL); + reg = intrl2_0_readl(priv, INTRL2_CPU_STATUS); + if (reg & INTRL2_0_MPD) + netdev_info(priv->netdev, "Wake-on-LAN (MPD) interrupt!\n"); + + if (reg & INTRL2_0_BRCM_MATCH_TAG) { + reg = rxchk_readl(priv, RXCHK_BRCM_TAG_MATCH_STATUS) & + RXCHK_BRCM_TAG_MATCH_MASK; + netdev_info(priv->netdev, + "Wake-on-LAN (filters 0x%02x) interrupt!\n", reg); + } + netif_dbg(priv, wol, priv->netdev, "resumed from WOL\n"); } @@ -868,11 +876,6 @@ static irqreturn_t bcm_sysport_rx_isr(in if (priv->irq0_stat & INTRL2_0_TX_RING_FULL) bcm_sysport_tx_reclaim_all(priv); - if (priv->irq0_stat & INTRL2_0_MPD) { - netdev_info(priv->netdev, "Wake-on-LAN interrupt!\n"); - bcm_sysport_resume_from_wol(priv); - } - return IRQ_HANDLED; } @@ -1901,9 +1904,6 @@ static int bcm_sysport_suspend_to_wol(st /* UniMAC receive needs to be turned on */ umac_enable_set(priv, CMD_RX_EN, 1); - /* Enable the interrupt wake-up source */ - intrl2_0_mask_clear(priv, INTRL2_0_MPD); - netif_dbg(priv, wol, ndev, "entered WOL mode\n"); return 0;