From patchwork Tue Aug 22 09:57:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9914773 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 AC88B603F9 for ; Tue, 22 Aug 2017 10:16:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFE2E287DC for ; Tue, 22 Aug 2017 10:16:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4A402885C; Tue, 22 Aug 2017 10:16:42 +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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=unavailable 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 F1DB5287DC for ; Tue, 22 Aug 2017 10:16:41 +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:References: In-Reply-To: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:List-Owner; bh=X9KdTbu0AzVXC56xzmEJShH93+tK6VuIaA9/FUxHHvc=; b=QHuFFE8IX4vYrb6et5qrY3x6Ze 2yIRTicf828vaudLlBpJgu7XkLqkd2GbZGfgm3H+ahX0bnDlnpGa8JEXoGx8g0chKJO8TsgF/a8nb 7ot0dIxN0uCE1/IbKoeYb5j0fx44F3WKQg4FSOeR14As4V23Rq9ZGrNYxKJPu6OenDLiP0DF9PzaC 1r2f+b9G2Uho4l8hQ1WdLBxJiwWwLrvKOlVWaoVbIXGvLfilpz7XHPKu1/imlGJRoCWu5D93+7ucO bgE/pRWaqK1zAMnLFPSn65rl+iDEjOKU/Osz2ucgSMsfrVxn+8eLcra1wtMaLnuhJepv1VRCdsQJl PboFbk7Q==; 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 1dk6Ef-0005Rr-LL; Tue, 22 Aug 2017 10:16:37 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dk6DK-0003Sd-OO for linux-arm-kernel@bombadil.infradead.org; Tue, 22 Aug 2017 10:15:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: 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=Y0/JGs+wSDca0AzPTVCPwmKocIHR5msiQUhNUQeEmm8=; b=NzZiIsBxDGOgjlPaRa2MRIdl1 nKqPmdnp2kZ0PNr9hxrX5TUk6jb7oLO3CwqAf5vz1t+jSkxtwISdcCOuruvM096uqkm4m7ifW+QSa QyvXoB0N9l/WCtSzmUjtHrpzm9hFLglzkWSbW+PzsiOkk7lWcmn/TfFldE82vBjN8YsNrzsY4d4VI pIEbvmg+PlVswugi6/yrBr5woNfYi9EuqN+TbDfnbopGcXTr3pxNdfqM/O4lVaP4WWqYqI32EFvoh In7e2i6JaaJ6j89ZE03f4o30OTKbo4OY6kGvv3/0rIQTrSOzwEMXZRHnw0bHNk8RJ1/Bu1y5GvpvA FNe7i9/rQ==; Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dk5xc-0001rM-AP for linux-arm-kernel@lists.infradead.org; Tue, 22 Aug 2017 09:59:01 +0000 Received: by mail-wr0-x22b.google.com with SMTP id p14so52003022wrg.1 for ; Tue, 22 Aug 2017 02:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Y0/JGs+wSDca0AzPTVCPwmKocIHR5msiQUhNUQeEmm8=; b=FHw4agmWlLP+FdvVFoHJOEs+ZnyJuxsTUJO8cPfowfc/DoKh0EPCoNsBFmWB9pmXHT aIH+7gknRIOUgAICG8BZVSWGHVo13tWG+RbNmVfUVNmwFy1/6H4Ao3QTTPt+nGW2Y8CT MxQFoNxnas36TwyxUpGfp8bJMZAD6oCGR7RAc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Y0/JGs+wSDca0AzPTVCPwmKocIHR5msiQUhNUQeEmm8=; b=TcWdsvlHeeSVaWvIyg334U6Kn6h9hNBDD6dGO2UxpapWfdR+uGXt9xlAfDtXAMWpGC kyHaxAE6QevkLPDCGw775KNh58LLcpULVSx3mNglPXsCFvyLoJzXYHnvg8BkNRwA1Sa6 sqa/xiu57Bu+nq49J9eullElzXEGSr4JNXwWX4/WzuFeny9AdXfhMozemxfx04yKhbq1 o8hHuwmj1QTsV/QwEv6xnLoBn3E7QQCSSBMC2d2+PKgQsr/xb+RXxQL29RIekhicw8lP 04nEYPauXkr8+lGFOtJA1tpSizcVheppnvWcyjU44yz7VbDnHf51Hks4Qq3q+ymrfPRi vbYQ== X-Gm-Message-State: AHYfb5jmu8+UIl7cOAibzYiYFWnuTcf0tYHTXqZBRh3PKUjlQMp8DXJq MmfskWW961K6ABkC X-Received: by 10.28.30.77 with SMTP id e74mr27601wme.172.1503395918742; Tue, 22 Aug 2017 02:58:38 -0700 (PDT) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.dhcp.avagotech.net ([192.19.237.250]) by smtp.gmail.com with ESMTPSA id e137sm12257913wma.29.2017.08.22.02.58.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Aug 2017 02:58:38 -0700 (PDT) From: Anup Patel To: Vinod Koul , Dan Williams Subject: [PATCH v3 11/17] dmaengine: bcm-sba-raid: Peek mbox when we have no free requests Date: Tue, 22 Aug 2017 15:27:00 +0530 Message-Id: <1503395827-19428-12-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503395827-19428-1-git-send-email-anup.patel@broadcom.com> References: <1503395827-19428-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170822_105900_401241_024CBD8A X-CRM114-Status: GOOD ( 14.09 ) 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: Florian Fainelli , Anup Patel , Scott Branden , Ray Jui , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 When setting up RAID array on several NVMe disks we observed that sba_alloc_request() start failing (due to no free requests left) and RAID array setup becomes very slow. To improve performance, we do mbox channel peek when we have no free requests. This improves performance of RAID array setup because mbox requests that were completed but not processed by mbox completion worker will be processed immediately by mbox channel peek. Signed-off-by: Anup Patel Reviewed-by: Ray Jui Reviewed-by: Scott Branden --- drivers/dma/bcm-sba-raid.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/dma/bcm-sba-raid.c b/drivers/dma/bcm-sba-raid.c index f14ed0a..399250e 100644 --- a/drivers/dma/bcm-sba-raid.c +++ b/drivers/dma/bcm-sba-raid.c @@ -200,6 +200,14 @@ static inline u32 __pure sba_cmd_pq_c_mdata(u32 d, u32 b1, u32 b0) /* ====== General helper routines ===== */ +static void sba_peek_mchans(struct sba_device *sba) +{ + int mchan_idx; + + for (mchan_idx = 0; mchan_idx < sba->mchans_count; mchan_idx++) + mbox_client_peek_data(sba->mchans[mchan_idx]); +} + static struct sba_request *sba_alloc_request(struct sba_device *sba) { unsigned long flags; @@ -211,8 +219,17 @@ static struct sba_request *sba_alloc_request(struct sba_device *sba) if (req) list_move_tail(&req->node, &sba->reqs_alloc_list); spin_unlock_irqrestore(&sba->reqs_lock, flags); - if (!req) + + if (!req) { + /* + * We have no more free requests so, we peek + * mailbox channels hoping few active requests + * would have completed which will create more + * room for new requests. + */ + sba_peek_mchans(sba); return NULL; + } req->flags = SBA_REQUEST_STATE_ALLOCED; req->first = req; @@ -560,17 +577,15 @@ static enum dma_status sba_tx_status(struct dma_chan *dchan, dma_cookie_t cookie, struct dma_tx_state *txstate) { - int mchan_idx; enum dma_status ret; struct sba_device *sba = to_sba_device(dchan); - for (mchan_idx = 0; mchan_idx < sba->mchans_count; mchan_idx++) - mbox_client_peek_data(sba->mchans[mchan_idx]); - ret = dma_cookie_status(dchan, cookie, txstate); if (ret == DMA_COMPLETE) return ret; + sba_peek_mchans(sba); + return dma_cookie_status(dchan, cookie, txstate); }