From patchwork Mon Aug 15 23:25:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 73934 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1695266qga; Mon, 15 Aug 2016 16:27:19 -0700 (PDT) X-Received: by 10.66.0.231 with SMTP id 7mr58465094pah.118.1471303639368; Mon, 15 Aug 2016 16:27:19 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x67si28808029pff.126.2016.08.15.16.27.19; Mon, 15 Aug 2016 16:27:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932182AbcHOX0G (ORCPT + 4 others); Mon, 15 Aug 2016 19:26:06 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:35594 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752408AbcHOX0E (ORCPT ); Mon, 15 Aug 2016 19:26:04 -0400 Received: by mail-wm0-f48.google.com with SMTP id f65so113377767wmi.0 for ; Mon, 15 Aug 2016 16:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HKyEdX8rzQJn4aipcTydI63oKncB6HBOBCstBpGvMs8=; b=O9wQH4091rFMMBVKtNVBm67H1K3fXhko+GlnjYOMgO2Pf/Ijws0JWUy2A2OJdJaXbu 8u+lQ3zPsdh3VCltfUlFMHJ5T9IunOoa5Bp6PXDxpsw76U2NqjBUiOoJLQqmi6fJeq3h +WplrjNqxG4qrMIgmD2JuygCodsyxX0fmMWbg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HKyEdX8rzQJn4aipcTydI63oKncB6HBOBCstBpGvMs8=; b=AXDlAY5QaDp55VT8Ad3Upo7BW6Vr2DTUZUflWLOPzPpsMlPeBEjiQ4dsxibl9RfbhM Is2EfXFdA75vl317Ea20BCxHjJ+r7+xEmdmIR1M06cQLJtnamaU/TBP6hGs7EaumL30B bNSgEnurHTqwoB0ZRaJxvSXyfb7/d2sTsjGYEeqi+SV8+/C2FrVx4DCcDpLR6Zpk0nmk imkszuichOrAnDB2s5HvvhWiW+8Z1XgvGjUAaL0vL/DeP+0gRPZ3NPB38Ws6tplSnGt9 n6h2shIca7s5/XxpAubmRwi84Q2q3di51IQqW7bwX7/5Q27Db8WuxH/rZyHuVcZ8YcL3 3JhQ== X-Gm-Message-State: AEkoouuFsQ/d8+E0uDZYO/+a9/XgAiZRSDlHO1mhI/l65+U4czYkTqvPTWihp43rFA3GqxpJ X-Received: by 10.25.44.71 with SMTP id s68mr5965676lfs.197.1471303562712; Mon, 15 Aug 2016 16:26:02 -0700 (PDT) Received: from localhost.localdomain (20-202-94-178.pool.ukrtel.net. [178.94.202.20]) by smtp.gmail.com with ESMTPSA id i5sm3701035lfe.40.2016.08.15.16.26.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Aug 2016 16:26:02 -0700 (PDT) From: Ivan Khoronzhuk To: davem@davemloft.net, netdev@vger.kernel.org, mugunthanvnm@ti.com, grygorii.strashko@ti.com Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, nsekhar@ti.com, Ivan Khoronzhuk Subject: [PATCH v3 2/5] net: ethernet: ti: davinci_cpdma: fix locking while ctrl_stop Date: Tue, 16 Aug 2016 02:25:46 +0300 Message-Id: <1471303549-4134-3-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471303549-4134-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1471303549-4134-1-git-send-email-ivan.khoronzhuk@linaro.org> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The interrupts shouldn't be disabled while receiving skb, but while ctrl_stop, the channels are stopped and all remaining packets are handled with netif_receive_skb(): lock_irq_save cpdma_ctlr_stop cpdma_chan_top __cpdma_chan_free cpsw_rx_handler netif_receive_skb So, split locking while ctrl stop thus interrupts are still enabled while skbs handling. It can cause WARN_ONCE in rare cases when ctrl is stopping while not all packets were handled with NAPIs. Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/davinci_cpdma.c | 2 ++ 1 file changed, 2 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c index 167fd65..ffb32af 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.c +++ b/drivers/net/ethernet/ti/davinci_cpdma.c @@ -334,12 +334,14 @@ int cpdma_ctlr_stop(struct cpdma_ctlr *ctlr) } ctlr->state = CPDMA_STATE_TEARDOWN; + spin_unlock_irqrestore(&ctlr->lock, flags); for (i = 0; i < ARRAY_SIZE(ctlr->channels); i++) { if (ctlr->channels[i]) cpdma_chan_stop(ctlr->channels[i]); } + spin_lock_irqsave(&ctlr->lock, flags); dma_reg_write(ctlr, CPDMA_RXINTMASKCLEAR, 0xffffffff); dma_reg_write(ctlr, CPDMA_TXINTMASKCLEAR, 0xffffffff);