From patchwork Fri Feb 15 07:40:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suganath Prabu S X-Patchwork-Id: 10814277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A44CD17E9 for ; Fri, 15 Feb 2019 07:41:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72B7A2EB0C for ; Fri, 15 Feb 2019 07:41:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 713822EB93; Fri, 15 Feb 2019 07:41:08 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B1A92EB0C for ; Fri, 15 Feb 2019 07:41:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390244AbfBOHlH (ORCPT ); Fri, 15 Feb 2019 02:41:07 -0500 Received: from mail-yb1-f194.google.com ([209.85.219.194]:45012 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728823AbfBOHlH (ORCPT ); Fri, 15 Feb 2019 02:41:07 -0500 Received: by mail-yb1-f194.google.com with SMTP id j85so101676ybg.11 for ; Thu, 14 Feb 2019 23:41:07 -0800 (PST) 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=T41ztuycnt/Lyvj02Hp0CQi6itCWV3yTIAhY51tzQNw=; b=iDb0FYrHUNYArwyXURiafZjgQgVl75RCwjRJ3/GzO9g8j5OGOIBIOyy02v3aUZ1zpf XzBDAgRSopaPV22f3niqCkowW0W87S2CPZ5yJ865SiYwsGz/MKunm8TwEEpFfkbHR7Tk /XrYMEnIIXQ0uYLuB5CMYzCINJJ1I2VNaIrMo= 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=T41ztuycnt/Lyvj02Hp0CQi6itCWV3yTIAhY51tzQNw=; b=VOrIaSrNe5NHLvJjyeU1UVzUoF5el44tWRjve4XuHWKDMFP5mp3BF9LaipSAXAQKXo eReqEu1zyY0KRgQ+wB2mxI4P7wbtb9R7v4Sb+MSYEt57zSdApJuSZAvXawDAfob+rd33 CvlhXGrLw0pg9gfUvmZsgbg6VPxUneMTFPaGtRZtigEL53lZbeox3Vb+0iY2K+ayFFEv Wr6OmPu9el4fDlRt+O/4Hd/4xwRvh/TVs11AcZpvnBp+QCOLRIQ7IPbUtmkldHT+vjAJ YII9rsOIHSilCEqJ6btWwosauQigcHOcyng80ZEequQNWPfQwrGW1ea68Kvy1zPT1Rp3 /RbQ== X-Gm-Message-State: AHQUAuarf3LxikXwgLiLX8/VGUDofZrAcmM0hchsevS3nzMwtYwPVtoB TjPyKYYDx7WaZUl82rRyQY7biTg0QEUQeAsVLsEmU+n/YdNUdMlT9+OsC1rtktcMR0IWTUfGlPp wo7g3IdUQ6SVD9RRfwrL90AkImWb5YwIr7bM1z33uRBD0n7NQRtqVBWY0yLI952Z1GOcCnRyUav KEnB3GJ9jXS6jRUcRL67M0 X-Google-Smtp-Source: AHgI3IaT4MPrD0l3fK+smDMZp6WD5ok/E1YMR4KOeD5jhhs/od4tRJT7nA2VnKmWsOyiyhLS0SJvIA== X-Received: by 2002:a25:4f8a:: with SMTP id d132mr6807801ybb.370.1550216466351; Thu, 14 Feb 2019 23:41:06 -0800 (PST) Received: from dhcp-10-123-20-72.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id c124sm1696388ywe.12.2019.02.14.23.41.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 23:41:05 -0800 (PST) From: Suganath Prabu To: linux-scsi@vger.kernel.org Cc: Sathya.Prakash@broadcom.com, sreekanth.reddy@broadcom.com, Suganath Prabu Subject: [v1 6/7] mpt3sas: Improve the threshold value and introduce module param. Date: Fri, 15 Feb 2019 02:40:29 -0500 Message-Id: <1550216430-36612-7-git-send-email-suganath-prabu.subramani@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1550216430-36612-1-git-send-email-suganath-prabu.subramani@broadcom.com> References: <1550216430-36612-1-git-send-email-suganath-prabu.subramani@broadcom.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP * Reduce the threshold value to 1/4 of the queue depth. * With this FW can find enough entries to post the Reply Descriptors in the reply descriptor post queue. * With module param, user can play with threshold value, the same irqpoll_weight is used as the budget in processing of reply descriptor post queues in _base_process_reply_queue. Signed-off-by: Suganath Prabu --- drivers/scsi/mpt3sas/mpt3sas_base.c | 14 ++++++++++++-- drivers/scsi/mpt3sas/mpt3sas_base.h | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index aadd9e2..880bd22 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -94,6 +94,11 @@ module_param(max_msix_vectors, int, 0); MODULE_PARM_DESC(max_msix_vectors, " max msix vectors"); +static int irqpoll_weight = -1; +module_param(irqpoll_weight, int, 0); +MODULE_PARM_DESC(irqpoll_weight, + "irq poll weight (default= one fourth of HBA queue depth)"); + static int mpt3sas_fwfault_debug; MODULE_PARM_DESC(mpt3sas_fwfault_debug, " enable detection of firmware fault and halt firmware - (default=0)"); @@ -1404,7 +1409,7 @@ static int _base_process_reply_queue(struct adapter_reply_queue *reply_q) { union reply_descriptor rd; - u32 completed_cmds; + u64 completed_cmds; u8 request_descript_type; u16 smid; u8 cb_idx; @@ -1502,7 +1507,7 @@ _base_process_reply_queue(struct adapter_reply_queue *reply_q) * So that FW can find enough entries to post the Reply * Descriptors in the reply descriptor post queue. */ - if (completed_cmds > ioc->hba_queue_depth/3) { + if (!base_mod64(completed_cmds, ioc->thresh_hold)) { if (ioc->combined_reply_queue) { writel(reply_q->reply_post_host_index | ((msix_index & 7) << @@ -6608,6 +6613,11 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) if (r) goto out_free_resources; + if (irqpoll_weight > 0) + ioc->thresh_hold = irqpoll_weight; + else + ioc->thresh_hold = ioc->hba_queue_depth/4; + _base_init_irqpolls(ioc); init_waitqueue_head(&ioc->reset_wq); diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 3895407..dab64f3 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -1028,6 +1028,8 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc); * @msix_load_balance: Enables load balancing of interrupts across * the multiple MSIXs * @schedule_dead_ioc_flush_running_cmds: callback to flush pending commands + * @thresh_hold: Max number of reply descriptors processed + * before updating Host Index * @scsi_io_cb_idx: shost generated commands * @tm_cb_idx: task management commands * @scsih_cb_idx: scsih internal commands @@ -1205,6 +1207,7 @@ struct MPT3SAS_ADAPTER { u32 non_operational_loop; atomic64_t total_io_cnt; bool msix_load_balance; + u16 thresh_hold; /* internal commands, callback index */ u8 scsi_io_cb_idx;