From patchwork Thu Oct 24 14:08:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 177504 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2247515ill; Thu, 24 Oct 2019 07:11:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxeIazgSzuHt/U65qc4szLdf0jDbC8E040elUbkV4+jxz150W5l78MB/zcyO1Kvk1PxV21E X-Received: by 2002:a05:6402:2c5:: with SMTP id b5mr20783567edx.157.1571926312297; Thu, 24 Oct 2019 07:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571926312; cv=none; d=google.com; s=arc-20160816; b=bWp6ZzIJuhPxD8bGUwNi4hoFBvXV5KNIiDhcmYHGGM3SgpI9MMqkg+Ul90bfUtzc5F kC5eXwAf2FvYXL2FJkM7SL8MXgVbOHmsn69Wx5AEhRYWmxPfX12u/kUxosKnz1SpnJ1k DOo8tfJ1xBfKIQKlOLqLklduhHI1lh9NpvANf8n3jJCxBtQb5oJ370TKpW+bJYRgmxb8 15Or/u6OZ7Hkk8gIMJ/PrYq/Ch7JlVeE1sIm4yo6VYLl9+GLcacM9kYW33/ckv5BcJ87 MGNTYAWAE8CsxdxDGrxDECANOHBO3Yvr8zw2BbT32sytfZa8lMmQ4uyQ/G4KhnlyAz+Y nHkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=Ih3xYTElp/1OSSosB7QC6nVOzL240q1PFfnNIWbayog=; b=tmv86uXNOifdpC1Wt/iBTbwFZTTXpwTgggiccRGw5DoDlLsLwNMuP3Q/6d1HvNsSja FiSUCtbr5HlXm6cleBWOAPHmJ4NCcIT7h/vGjSMsPdEO8anOx+WehQp/kNeso/S+5iRA MHf3CIYpfGs7KV+IBrGDl9ZyFcoM9XgRYzRZ1etSeNOqd6crjBTgJfIjRLwPiYXOD6iH F3k4F1JfrhIdZGwnP2pikyWvPhoDq9D22j5LO1qVILQBO4+KawwgRTsITMRuQxjGrDVO 17pKzg+TAyPd1b56r1oHNZ+RKEi7i734kIHGyXtiJ4TTUatxK7/PVg1FdRS6S4miZ0Fv jstw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16si15198398ejj.360.2019.10.24.07.11.52 for ; Thu, 24 Oct 2019 07:11:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502655AbfJXOLv (ORCPT ); Thu, 24 Oct 2019 10:11:51 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5159 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391366AbfJXOLu (ORCPT ); Thu, 24 Oct 2019 10:11:50 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 55E5C1F77963E3E35CE9; Thu, 24 Oct 2019 22:11:35 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Thu, 24 Oct 2019 22:11:28 +0800 From: John Garry To: , CC: , , , Luo Jiaxing , "John Garry" Subject: [PATCH v2 15/18] scsi: hisi_sas: Add module parameter for debugfs dump count Date: Thu, 24 Oct 2019 22:08:22 +0800 Message-ID: <1571926105-74636-16-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1571926105-74636-1-git-send-email-john.garry@huawei.com> References: <1571926105-74636-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Luo Jiaxing We still only use dump index #0 however. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 1 + drivers/scsi/hisi_sas/hisi_sas_main.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index b4c6bec4b92c..bdd4aa7ed730 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -598,6 +598,7 @@ struct hisi_sas_slot_dif_buf_table { extern struct scsi_transport_template *hisi_sas_stt; extern bool hisi_sas_debugfs_enable; +extern u32 hisi_sas_debugfs_dump_count; extern struct dentry *hisi_sas_debugfs_dir; extern void hisi_sas_stop_phys(struct hisi_hba *hisi_hba); diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index b599595ea095..5b3cee67bb24 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -3819,7 +3819,7 @@ static int hisi_sas_debugfs_alloc(struct hisi_hba *hisi_hba, int dump_index) return 0; fail: - for (i = 0; i < HISI_SAS_MAX_DEBUGFS_DUMP; i++) + for (i = 0; i < hisi_sas_debugfs_dump_count; i++) hisi_sas_debugfs_release(hisi_hba, i); return -ENOMEM; } @@ -3870,7 +3870,7 @@ void hisi_sas_debugfs_init(struct hisi_hba *hisi_hba) hisi_hba->debugfs_dump_dentry = debugfs_create_dir("dump", hisi_hba->debugfs_dir); - for (i = 0; i < HISI_SAS_MAX_DEBUGFS_DUMP; i++) { + for (i = 0; i < hisi_sas_debugfs_dump_count; i++) { if (hisi_sas_debugfs_alloc(hisi_hba, i)) { debugfs_remove_recursive(hisi_hba->debugfs_dir); dev_dbg(dev, "failed to init debugfs!\n"); @@ -3909,14 +3909,24 @@ EXPORT_SYMBOL_GPL(hisi_sas_debugfs_enable); module_param_named(debugfs_enable, hisi_sas_debugfs_enable, bool, 0444); MODULE_PARM_DESC(hisi_sas_debugfs_enable, "Enable driver debugfs (default disabled)"); +u32 hisi_sas_debugfs_dump_count = 1; +EXPORT_SYMBOL_GPL(hisi_sas_debugfs_dump_count); +module_param_named(debugfs_dump_count, hisi_sas_debugfs_dump_count, uint, 0444); +MODULE_PARM_DESC(hisi_sas_debugfs_dump_count, "Number of debugfs dumps to allow"); + static __init int hisi_sas_init(void) { hisi_sas_stt = sas_domain_attach_transport(&hisi_sas_transport_ops); if (!hisi_sas_stt) return -ENOMEM; - if (hisi_sas_debugfs_enable) + if (hisi_sas_debugfs_enable) { hisi_sas_debugfs_dir = debugfs_create_dir("hisi_sas", NULL); + if (hisi_sas_debugfs_dump_count > HISI_SAS_MAX_DEBUGFS_DUMP) { + pr_info("hisi_sas: Limiting debugfs dump count\n"); + hisi_sas_debugfs_dump_count = HISI_SAS_MAX_DEBUGFS_DUMP; + } + } return 0; }