From patchwork Fri Dec 18 13:27:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Saxena X-Patchwork-Id: 7883921 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DE9D2BEEE5 for ; Fri, 18 Dec 2015 13:28:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BFEB204A0 for ; Fri, 18 Dec 2015 13:28:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2FC872049D for ; Fri, 18 Dec 2015 13:28:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932350AbbLRN2d (ORCPT ); Fri, 18 Dec 2015 08:28:33 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:35267 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932270AbbLRN2a (ORCPT ); Fri, 18 Dec 2015 08:28:30 -0500 Received: by mail-pa0-f50.google.com with SMTP id jx14so31895084pad.2 for ; Fri, 18 Dec 2015 05:28:30 -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=54VUhb48B+JMMe1I5JD2sM4MOAoIkAxAt5e3xS3syi0=; b=xii8o/ExCe52FD4jfB1YW0gFx3INiFQcMQ1icy0yAsWoXfqJt4ufz979Djv+UH+T1S Y0ljWTnx/OhwC5q5ZV25PGXj1U8S0dXYwZBstsgruEIl9AnJ4f16UHHUaEMuERnMtVXr QPi3vNJMEAiQd+7I5eBajGWd1lz8UasI9tzdY= 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=54VUhb48B+JMMe1I5JD2sM4MOAoIkAxAt5e3xS3syi0=; b=Z/JH8o7j9Tu+wyBmxf457U5Vaxi1PQCWzCV+lmGJqe3LDL+Z1KuCIb32DlNWaU2cMx cu25DkXnrmUFv66y6inxWTh5NUKcc+DiL4px+WBaHT1BVJ8Y8VTgriRwQKUfP6QY9/T4 BjrXmNgbRrm27k0Qc/5iGVdxRy9oJOJagpU5Kx2SUWYkKnnzpRPSp+DneIPmD5FWjE0n bcixebqFmYGlRwSN6q674vIGrls/Fv4vnob1/uG91AMcsN69E/eqI674i/KZv/Qnztcf plJ/GDx3N/OvgZ7wntMYt8PhbUNgIsn2krAu/Df0z8y7wWxSNHZnozKsXcL54Jfh8b11 23lw== X-Gm-Message-State: ALoCoQlLLJs0u6xHwapGCzncv1qTlFP8ojg/EMugF/h61Msc/KnkaSEQYeQXnqbPaQpbZKLGGszz3FVq3+Zx2M/yWGhpuca6jw== X-Received: by 10.66.216.73 with SMTP id oo9mr5190224pac.148.1450445310113; Fri, 18 Dec 2015 05:28:30 -0800 (PST) Received: from host1.dhcp.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id 2sm18089348pfl.56.2015.12.18.05.28.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Dec 2015 05:28:28 -0800 (PST) From: Sumit Saxena X-Google-Original-From: Sumit Saxena To: jbottomley@parallels.com, hch@infradead.org, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, kashyap.desai@avagotech.com, sumit.saxena@avagotech.com Subject: [PATCH 10/15] megaraid_sas: IO throttling support Date: Fri, 18 Dec 2015 18:57:03 +0530 Message-Id: <1450445228-26571-11-git-send-email-Sumit.Saxena@avagotech.com> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1450445228-26571-1-git-send-email-Sumit.Saxena@avagotech.com> References: <1450445228-26571-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,T_DKIM_INVALID,T_RP_MATCHES_RCVD,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 add capability in driver to tell firmware that it can throttle IOs in case Controller's Queue depth is downgraded post OFU (Online firmware upgrade). This feature will ensure firmware can be downgraded from higher queue depth to lower queue depth without needing system reboot. Added throttling code in IO path of driver, in case OS tries to send more IOs than post OFU firmware's queue depth. Signed-off-by: Sumit Saxena Signed-off-by: Kashyap Desai --- drivers/scsi/megaraid/megaraid_sas.h | 6 ++++-- drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 4595ef4..9d2b3da 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1537,7 +1537,8 @@ union megasas_sgl_frame { typedef union _MFI_CAPABILITIES { struct { #if defined(__BIG_ENDIAN_BITFIELD) - u32 reserved:21; + u32 reserved:20; + u32 support_qd_throttling:1; u32 support_fp_rlbypass:1; u32 support_vfid_in_ioframe:1; u32 support_ext_io_size:1; @@ -1561,7 +1562,8 @@ typedef union _MFI_CAPABILITIES { u32 support_ext_io_size:1; u32 support_vfid_in_ioframe:1; u32 support_fp_rlbypass:1; - u32 reserved:21; + u32 support_qd_throttling:1; + u32 reserved:20; #endif } mfi_capabilities; __le32 reg; diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 7cc7806..1248c7a 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -801,6 +801,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) if (!dual_qdepth_disable) drv_ops->mfi_capabilities.support_ext_queue_depth = 1; + drv_ops->mfi_capabilities.support_qd_throttling = 1; /* Convert capability to LE32 */ cpu_to_le32s((u32 *)&init_frame->driver_operations.mfi_capabilities); @@ -2182,6 +2183,12 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance, atomic_inc(&instance->ldio_outstanding); } + if (atomic_read(&instance->fw_outstanding) >= + instance->host->can_queue) { + dev_err(&instance->pdev->dev, "Throttle IOs beyond Controller queue depth\n"); + return SCSI_MLQUEUE_HOST_BUSY; + } + cmd = megasas_get_cmd_fusion(instance, scmd->request->tag); index = cmd->index;