From patchwork Mon Aug 7 13:47:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 9885399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD486603F2 for ; Mon, 7 Aug 2017 13:48:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD8F52863F for ; Mon, 7 Aug 2017 13:48:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C003C28691; Mon, 7 Aug 2017 13:48:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 51FCA28665 for ; Mon, 7 Aug 2017 13:48:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=WRwbnyUC/bM4QabLkiEXGAa2TSKZqD0HIIRbuCpKTcE=; b=BSj 0FBeiZZjo8d69zyd5/3SybE3TDlBYoLAuGuIdSzoYeRQAcMKplSxSXzRlG+IO3G3ne2p+u3B0jSNP WigwCYgoAXl1jR0wvc6N4tcmSyRJprv7Uj5ttV3KtBl4EC+IfCMGHGub9MZY0PiruqD5gWkM689JI I7rT990X8ZZx69bx4E9z56kRv1aAY7ekZiOlh5XgRNyZWaDLIsFhSSPnmIFAoYNjk+tYTAHk8ABgh XRHkzr/kfgjvHhnr/yP11QIBcFM+wLug/oToPtBmMJXGdU9sxw0yWae+lCSk3w9MREJGuQMUXa58+ JGPFwR3AVlZmIsAWR6myIlv/c9IBk2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1deiOf-0007Pe-GF; Mon, 07 Aug 2017 13:48:41 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1deiOM-00079I-1L for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2017 13:48:24 +0000 Received: by mail-wr0-x241.google.com with SMTP id o33so389372wrb.1 for ; Mon, 07 Aug 2017 06:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id; bh=WMkpt/XO1AJRsrxOmjRkdQmcp5u7ILcNdLMejlGVfYg=; b=0b7IkL7bMDmUzFqlNPvNaj90wC9VJEucSgIxvLGA8QGb2UdOkDj6nbf3vkKgXjZ2+F dNSdNZpMMyteyXUbLnTFz9yE57ubiP32tuYm+TYeai5nFAJyWpGwWZMzTCU5st+feyGU B17YJ8klLzfKusig7waZf3vP8fZZErt2M496SnWYDbrJwrohYiVWkiezD9nso0ZiQ4J5 Qh7x1n9jY+Mi/9kau5klSHUqTlH8huYDlQQgfhNIMDhQJIf8Qb/8Ao+fHPaTuWdHTuly cGEB+i4jjqnKIzL0v0Z14aFYZADUMsloOGsKmDVL7LF8iT9m7koNPNg9Ag4S8oTmYyxC 5uZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=WMkpt/XO1AJRsrxOmjRkdQmcp5u7ILcNdLMejlGVfYg=; b=egqV1L6hiOn5WM6y3fGzDTIQzXgzfL8pstRErLb4WZB/3T2mmFW/rQo9+lixZOYaml 4AglGBu0l4fZoQcH9DlOnLe8OnHNsZvvkqX8kUDcPSLVcMybXzCBzeV6rk5aNjj1DQn7 Kz49RjjKxN3AumlNt7QsOlhehFeTlhmd35pQ3bEEBP8sLEN83S+158+MgMGyTYMimdzj 0ra4hAP9KY0Wt+zMqoNIZDjc6FxtNqw+doyTXgyXjuek4uuawvCO13q/2Zu0OmGfloF/ 6DxZ+6R/VWoWoFhtDLtoD8+ZXJHjNx9WJIe/HzZ9W1O0/1Qsysz86vwSpNGysfgF3PEZ i25w== X-Gm-Message-State: AHYfb5ifAjvDVNhIr/TPh5BrP7tJui7z5Si0JTELZNw1iayRXYOwWGnJ wFuauZiFY9V2aAgX X-Received: by 10.223.139.147 with SMTP id o19mr420129wra.207.1502113678615; Mon, 07 Aug 2017 06:47:58 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id 16sm15097990wrx.26.2017.08.07.06.47.57 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 07 Aug 2017 06:47:58 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu Subject: [PATCH 1/2] can: xilinx: Fix ksoftirq CPU monopolization Date: Mon, 7 Aug 2017 15:47:56 +0200 Message-Id: <21850c76207942f5ae5c225f2627fb068d5234d0.1502113674.git.michal.simek@xilinx.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170807_064822_276270_BB085640 X-CRM114-Status: GOOD ( 12.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, Matthias Auchmann , linux-can@vger.kernel.org, Marc Kleine-Budde , =?UTF-8?q?S=C3=B6ren=20Brinkmann?= , Wolfgang Grandegger MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Matthias Auchmann When using both the RXOK and the RXNEMP interrupt, when there were more than one receive messages in the FIFO, ksoftirqd started to go crazy and monopolize one CPU. The reason being is that RXOK just fires once even if there are multiple frames sitting in the RX FIFO, so the code didn't reflect that properly. Changed that to only use the RXNEMP interrupt and thereby got rid of the bug. Signed-off-by: Matthias Auchmann Acked-by: Kedareswara rao Appana Signed-off-by: Michal Simek --- drivers/net/can/xilinx_can.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 89aec07c225f..05ea2820d27b 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -101,7 +101,7 @@ enum xcan_reg { #define XCAN_INTR_ALL (XCAN_IXR_TXOK_MASK | XCAN_IXR_BSOFF_MASK |\ XCAN_IXR_WKUP_MASK | XCAN_IXR_SLP_MASK | \ XCAN_IXR_RXNEMP_MASK | XCAN_IXR_ERROR_MASK | \ - XCAN_IXR_ARBLST_MASK | XCAN_IXR_RXOK_MASK) + XCAN_IXR_ARBLST_MASK) /* CAN register bit shift - XCAN___SHIFT */ #define XCAN_BTR_SJW_SHIFT 7 /* Synchronous jump width */ @@ -709,15 +709,7 @@ static int xcan_rx_poll(struct napi_struct *napi, int quota) isr = priv->read_reg(priv, XCAN_ISR_OFFSET); while ((isr & XCAN_IXR_RXNEMP_MASK) && (work_done < quota)) { - if (isr & XCAN_IXR_RXOK_MASK) { - priv->write_reg(priv, XCAN_ICR_OFFSET, - XCAN_IXR_RXOK_MASK); - work_done += xcan_rx(ndev); - } else { - priv->write_reg(priv, XCAN_ICR_OFFSET, - XCAN_IXR_RXNEMP_MASK); - break; - } + work_done += xcan_rx(ndev); priv->write_reg(priv, XCAN_ICR_OFFSET, XCAN_IXR_RXNEMP_MASK); isr = priv->read_reg(priv, XCAN_ISR_OFFSET); } @@ -728,7 +720,7 @@ static int xcan_rx_poll(struct napi_struct *napi, int quota) if (work_done < quota) { napi_complete_done(napi, work_done); ier = priv->read_reg(priv, XCAN_IER_OFFSET); - ier |= (XCAN_IXR_RXOK_MASK | XCAN_IXR_RXNEMP_MASK); + ier |= XCAN_IXR_RXNEMP_MASK; priv->write_reg(priv, XCAN_IER_OFFSET, ier); } return work_done; @@ -800,9 +792,9 @@ static irqreturn_t xcan_interrupt(int irq, void *dev_id) } /* Check for the type of receive interrupt and Processing it */ - if (isr & (XCAN_IXR_RXNEMP_MASK | XCAN_IXR_RXOK_MASK)) { + if (isr & XCAN_IXR_RXNEMP_MASK) { ier = priv->read_reg(priv, XCAN_IER_OFFSET); - ier &= ~(XCAN_IXR_RXNEMP_MASK | XCAN_IXR_RXOK_MASK); + ier &= ~XCAN_IXR_RXNEMP_MASK; priv->write_reg(priv, XCAN_IER_OFFSET, ier); napi_schedule(&priv->napi); }