From patchwork Thu Jan 28 15:34:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Saxena X-Patchwork-Id: 8151671 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 87AAB9F818 for ; Thu, 28 Jan 2016 15:37:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8CF8E20364 for ; Thu, 28 Jan 2016 15:37:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 851CE20373 for ; Thu, 28 Jan 2016 15:37:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967125AbcA1Pgx (ORCPT ); Thu, 28 Jan 2016 10:36:53 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:36683 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967059AbcA1PgA (ORCPT ); Thu, 28 Jan 2016 10:36:00 -0500 Received: by mail-pa0-f41.google.com with SMTP id yy13so24767815pab.3 for ; Thu, 28 Jan 2016 07:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=avagotech.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qXwmbjmdM+5x+LrmE277FRrAJ9DtCprLIe7qskixyxQ=; b=Bd/mtTUqT6XOaCda9lTFPJoch5YSiRD+8i3NFEeoSaCAiNKJRvlbQISNXbnU4Cg3sS A9+d3X1LFLDiCuaZzFAoe2DxE91pTx+1z4KCspdqdw/XJ9mwjbPR3rcll7BnXQu9BnAS K39K3dHTXPenknOSafeWvZZn9dgo7cpazmtIA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qXwmbjmdM+5x+LrmE277FRrAJ9DtCprLIe7qskixyxQ=; b=GcYWJ0r6qWPZNSqXqq4tG7Z/0/RJG5pljZSjqzcgkRuvnXuDhjicsEokW3s0bHEEuR dLKxCvWRpwAOPqlojZ2F+PPsh1SOaxJx1+/MsspycHJ1ZElm4NVSKETAE3o5uvJBmsEn LIZNS4O8e62ysRRpcUQwj/Zyl0k1z+HLX3efy2nNl7417R8z4YHheTLJ3rLeZjloLdzR fqCCksbF0f7DPhp3fnjutPx5a2sUzuNKas4mkpJviFMzJJKu16ha/Awt00FKDL4x0Mjt Pi7r6Y/Myj0KENXZPgV05XP4a6YlMhMa3umw6BUWFsyvX1Wl+htcgAKamajotW/ldHw9 /tmA== X-Gm-Message-State: AG10YOTRXsohHHfURwRMVOH5uKgceLaRAlEPLRrDtr201rWRTFm+p6pS6h5NRV2sVe+nBojz X-Received: by 10.66.152.204 with SMTP id va12mr5511322pab.0.1453995360326; Thu, 28 Jan 2016 07:36:00 -0800 (PST) Received: from host1.dhcp.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id y18sm17231752pfi.84.2016.01.28.07.35.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Jan 2016 07:35:58 -0800 (PST) From: Sumit Saxena To: jbottomley@parallels.com, hch@infradead.org, martin.petersen@oracle.com, thenzl@redhat.com Cc: linux-scsi@vger.kernel.org, kashyap.desai@avagotech.com, sumit.saxena@avagotech.com Subject: [PATCH v2 13/15] megaraid_sas: Introduce module parameter for SCSI command-timeout Date: Thu, 28 Jan 2016 21:04:34 +0530 Message-Id: <1453995276-24955-14-git-send-email-sumit.saxena@avagotech.com> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1453995276-24955-1-git-send-email-sumit.saxena@avagotech.com> References: <1453995276-24955-1-git-send-email-sumit.saxena@avagotech.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch will introduce module-parameter for SCSI command timeout value and fix setting of resetwaitime beyond a value. There was some comment from Tomas on last time sent patch regarding why should driver provided scmd_timeout module parameter. This is done for special cases where user wants to tune scmd_timeout value during driver load time. Default value is same as before-90 secs. There are no changes in this patch on top of last time sent patch. Signed-off-by: Kashyap Desai Signed-off-by: Sumit Saxena Reviewed-by: Tomas Henzl --- drivers/scsi/megaraid/megaraid_sas_base.c | 15 ++++++++++++--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index d2ea977..54922e5 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -83,7 +83,7 @@ module_param(throttlequeuedepth, int, S_IRUGO); MODULE_PARM_DESC(throttlequeuedepth, "Adapter queue depth when throttled due to I/O timeout. Default: 16"); -int resetwaittime = MEGASAS_RESET_WAIT_TIME; +unsigned int resetwaittime = MEGASAS_RESET_WAIT_TIME; module_param(resetwaittime, int, S_IRUGO); MODULE_PARM_DESC(resetwaittime, "Wait time in seconds after I/O timeout " "before resetting adapter. Default: 180"); @@ -100,6 +100,10 @@ unsigned int dual_qdepth_disable; module_param(dual_qdepth_disable, int, S_IRUGO); MODULE_PARM_DESC(dual_qdepth_disable, "Disable dual queue depth feature. Default: 0"); +unsigned int scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT; +module_param(scmd_timeout, int, S_IRUGO); +MODULE_PARM_DESC(scmd_timeout, "scsi command timeout (10-90s), default 90s. See megasas_reset_timer."); + MODULE_LICENSE("GPL"); MODULE_VERSION(MEGASAS_VERSION); MODULE_AUTHOR("megaraidlinux.pdl@avagotech.com"); @@ -1850,7 +1854,7 @@ static int megasas_slave_configure(struct scsi_device *sdev) * The RAID firmware may require extended timeouts. */ blk_queue_rq_timeout(sdev->request_queue, - MEGASAS_DEFAULT_CMD_TIMEOUT * HZ); + scmd_timeout * HZ); return 0; } @@ -2645,7 +2649,7 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd) unsigned long flags; if (time_after(jiffies, scmd->jiffies_at_alloc + - (MEGASAS_DEFAULT_CMD_TIMEOUT * 2) * HZ)) { + (scmd_timeout * 2) * HZ)) { return BLK_EH_NOT_HANDLED; } @@ -5254,6 +5258,11 @@ static int megasas_init_fw(struct megasas_instance *instance) instance->throttlequeuedepth = MEGASAS_THROTTLE_QUEUE_DEPTH; + if (resetwaittime > MEGASAS_RESET_WAIT_TIME) + resetwaittime = MEGASAS_RESET_WAIT_TIME; + + if ((scmd_timeout < 10) || (scmd_timeout > MEGASAS_DEFAULT_CMD_TIMEOUT)) + scmd_timeout = MEGASAS_DEFAULT_CMD_TIMEOUT; /* Launch SR-IOV heartbeat timer */ if (instance->requestorId) { diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 64926f7..e740e26 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -91,7 +91,7 @@ void megasas_start_timer(struct megasas_instance *instance, struct timer_list *timer, void *fn, unsigned long interval); extern struct megasas_mgmt_info megasas_mgmt_info; -extern int resetwaittime; +extern unsigned int resetwaittime; extern unsigned int dual_qdepth_disable; static void megasas_free_rdpq_fusion(struct megasas_instance *instance); static void megasas_free_reply_fusion(struct megasas_instance *instance);