Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751744AbdHQGg5 (ORCPT ); Thu, 17 Aug 2017 02:36:57 -0400 Received: from mga06.intel.com ([134.134.136.31]:26245 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751107AbdHQGgz (ORCPT ); Thu, 17 Aug 2017 02:36:55 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,386,1498546800"; d="scan'208";a="301253794" Date: Thu, 17 Aug 2017 12:10:08 +0530 From: Vinod Koul To: Anup Patel Cc: Rob Herring , Mark Rutland , Dan Williams , Florian Fainelli , Scott Branden , Ray Jui , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, dmaengine@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com Subject: Re: [PATCH v2 11/16] dmaengine: bcm-sba-raid: Peek mbox when we have no free requests Message-ID: <20170817064008.GB3053@localhost> References: <1501583880-32072-1-git-send-email-anup.patel@broadcom.com> <1501583880-32072-12-git-send-email-anup.patel@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1501583880-32072-12-git-send-email-anup.patel@broadcom.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2579 Lines: 77 On Tue, Aug 01, 2017 at 04:07:55PM +0530, Anup Patel wrote: > 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); why do you want to do this while checking status..? -- ~Vinod