From patchwork Mon Oct 21 16:22:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 177108 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3635568ill; Mon, 21 Oct 2019 09:25:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6ggMAVrGB/NotYwunUueuAyPugC0l3I8dUAYTn3GIpsfp/DquE+NxaPWZPocyaXk5VQbp X-Received: by 2002:aa7:d8c6:: with SMTP id k6mr26002084eds.87.1571675153862; Mon, 21 Oct 2019 09:25:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571675153; cv=none; d=google.com; s=arc-20160816; b=mjz2S9LhskmeR1hVh2VAB9MTA3ppCqWSjgRJ3U30u50C2C4WwcJzJYNuEKrMcCZuWL hJvrdnLN9xY4thwa7MglTpZ51P9VXf/pgmQJx2jledqTly94uc+zLc2sELARIMDPMamq abNuPbdH1JxD6rEb9nNT+lLw0FVp63ngZ3ZgTItXGjGOp1duBy4wAq9/ihX30BTEY3pU SPFtbIbG7A3UiRnss8/cboIM9YzOnWYAtrZX0C3wXTqFPQCv2wszPUaGDYidlEEc+qgu oyflcebQtuFIouuJsUlO0WM9OZe+HXXsq+zp1K6otFNUiw9rUH8QYieD9jRlGF2D99PR tW4g== 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=37w2LlXvn3Wrjye1P1qHs1kxD5CLhDWoXSpLWJNW8wo=; b=euLp3TL54NEZk7dSREnEe/bbsL7eYXd8UfOG1oHIm2BZuztuB1sIJv8bEzMK+GyiGa zVtz28SPCAOpnKRw5HbRZ0g9Sqa60f9s7PHfhHX+SyQo2se+Pf9EnLxwtaov1FqIorBB g3IdqDj57b4KIVIYY/8Es/CoKej8taMVn3hxkkGQ/7B9CrSALLc5dP5OOVacEXrnhsha /+HzBgJgVYUPp1qfzAS+sVFsv1lgQT9OP70guB3i/Iqx2TTFvBkpGXnHOlHuJVymBk6D TlS0MypEuvx4JXjeows5mCQj/qeFMm1uo+/Nytx71hEUwXDaOtMMcO+byW3/G1tgj+kR wrSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 z10si9186164ejx.236.2019.10.21.09.25.53; Mon, 21 Oct 2019 09:25:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729962AbfJUQZm (ORCPT + 26 others); Mon, 21 Oct 2019 12:25:42 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:36430 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729504AbfJUQZl (ORCPT ); Mon, 21 Oct 2019 12:25:41 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 13A73C129C2355F654D0; Tue, 22 Oct 2019 00:25:30 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Tue, 22 Oct 2019 00:25:20 +0800 From: John Garry To: , CC: , , , Luo Jiaxing , "John Garry" Subject: [PATCH 15/18] scsi: hisi_sas: Add module parameter for debugfs dump count Date: Tue, 22 Oct 2019 00:22:12 +0800 Message-ID: <1571674935-108326-16-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1571674935-108326-1-git-send-email-john.garry@huawei.com> References: <1571674935-108326-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 df41d58eb964..57723b0fc025 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -3818,7 +3818,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; } @@ -3869,7 +3869,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"); @@ -3908,14 +3908,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; }