From patchwork Thu Feb 14 05:46:10 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: 10811835 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 C0BAE13A4 for ; Thu, 14 Feb 2019 05:46:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AED152D37A for ; Thu, 14 Feb 2019 05:46:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2A312D390; Thu, 14 Feb 2019 05:46:43 +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 399952D37A for ; Thu, 14 Feb 2019 05:46:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393072AbfBNFqm (ORCPT ); Thu, 14 Feb 2019 00:46:42 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:42133 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbfBNFqm (ORCPT ); Thu, 14 Feb 2019 00:46:42 -0500 Received: by mail-ed1-f66.google.com with SMTP id r15so3973262eds.9 for ; Wed, 13 Feb 2019 21:46:41 -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=BXTQvmqfud7JcPJ9/Z/osEwF6O4MlWXEJlcVMnxaZRyS9JOl0/rUYMyrN/5E6pVRSL tcitVVwEZid+OP4KWpRpE5shDDLmPcJsALDLi0BlP0thl9D9HSS0B5a4Um8cZmHu1rTN s3EWO+PWX7eo33o0z17T8wd00xJbb70pXYBrw= 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=KU+7XZlaOBerRWpEw5eTBtEv+tN9IidcdL1bw/MKbf4gSKmQ1EVnN+1sl02HlaKIKF R1qkZzw5Q6gQt0rsNXPwVP2pAft2QG1QLLxkxGuUQkEgk5UeVEWhpmAsaLtQq0j/h47L XO0tqJFm5+UfVi/FKlGMgAx9HotisbBSPWTB/dIUbRdTIZn5X05MgG421Zyg21AmGquH JAgniIMMSJWv1LLk+0ZAiTf7ix7R129B1625FnphzN95EzmPXcztIfo63HHn8+l+C40z JqlZvJAyr7omE52KdApmxo0IpzI8COFXhvIeKq7afxgH13CS2sJuo+Otvc1oPLq/NRJG bUGQ== X-Gm-Message-State: AHQUAuamijxj+Qnn0iZZzsMPOlIyzeQfb45iqWlaaCVsBMvib2Bf8BRL Hcq0eE4To0kQlbtXVzBPewi+fiuZvf4PLF4VwFYluewDKylIU/aYCFRxvPuDaTHoQDJAwk1iOBI X9vHIUKAOHNYPZr0R8lWbtDOOJ2K2B+Y8mfRcOZ+0HFvUHAiouOoakwu90l/g2VyCSp+AcfwLXO O/mX/bpmMdWpfPw03EzBsf X-Google-Smtp-Source: AHgI3IZ+kSmU7d1U+R4EZIxuqj12/xerUEShBiW0rRrJluFgC+1x8KGLOsjhW30ohYxY8BmodeEhtA== X-Received: by 2002:a17:906:bf2:: with SMTP id z18mr1432493ejg.52.1550123200247; Wed, 13 Feb 2019 21:46:40 -0800 (PST) Received: from dhcp-10-123-20-72.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id h1sm311791ejx.41.2019.02.13.21.46.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 21:46:39 -0800 (PST) From: Suganath Prabu To: linux-scsi@vger.kernel.org Cc: Sathya.Prakash@broadcom.com, sreekanth.reddy@broadcom.com, Suganath Prabu Subject: [PATCH 5/6] mpt3sas: Improve the threshold value and introduce module param. Date: Thu, 14 Feb 2019 00:46:10 -0500 Message-Id: <1550123171-15993-6-git-send-email-suganath-prabu.subramani@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1550123171-15993-1-git-send-email-suganath-prabu.subramani@broadcom.com> References: <1550123171-15993-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;