From: John Garry <john.garry@huawei.com>
To: <jejb@linux.vnet.ibm.com>, <martin.petersen@oracle.com>
Cc: <linuxarm@huawei.com>, <linux-kernel@vger.kernel.org>,
<linux-scsi@vger.kernel.org>, Luo Jiaxing <luojiaxing@huawei.com>,
John Garry <john.garry@huawei.com>
Subject: [PATCH 2/6] scsi: hisi_sas: Add manual trigger for debugfs dump
Date: Wed, 6 Feb 2019 18:52:52 +0800 [thread overview]
Message-ID: <1549450376-114929-3-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1549450376-114929-1-git-send-email-john.garry@huawei.com>
From: Luo Jiaxing <luojiaxing@huawei.com>
Add an interface to manually trigger a debugfs dump.
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
---
drivers/scsi/hisi_sas/hisi_sas_main.c | 34 +++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 1a3d31d4258c..35619bdad1d5 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -2977,6 +2977,36 @@ static void hisi_sas_debugfs_snapshot_regs(struct hisi_hba *hisi_hba)
hisi_hba->hw->snapshot_restore(hisi_hba);
}
+static ssize_t hisi_sas_debugfs_trigger_dump_write(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct hisi_hba *hisi_hba = file->f_inode->i_private;
+ char buf[8];
+
+ /* A bit racy, but don't care too much since it's only debugfs */
+ if (hisi_hba->debugfs_snapshot)
+ return -EFAULT;
+
+ if (count > 8)
+ return -EFAULT;
+
+ if (copy_from_user(buf, user_buf, count))
+ return -EFAULT;
+
+ if (buf[0] != '1')
+ return -EFAULT;
+
+ queue_work(hisi_hba->wq, &hisi_hba->debugfs_work);
+
+ return count;
+}
+
+static const struct file_operations hisi_sas_debugfs_trigger_dump_fops = {
+ .write = &hisi_sas_debugfs_trigger_dump_write,
+ .owner = THIS_MODULE,
+};
+
void hisi_sas_debugfs_work_handler(struct work_struct *work)
{
struct hisi_hba *hisi_hba =
@@ -2999,6 +3029,10 @@ void hisi_sas_debugfs_init(struct hisi_hba *hisi_hba)
hisi_hba->debugfs_dir = debugfs_create_dir(dev_name(dev),
hisi_sas_debugfs_dir);
+ debugfs_create_file("trigger_dump", 0600,
+ hisi_hba->debugfs_dir,
+ hisi_hba,
+ &hisi_sas_debugfs_trigger_dump_fops);
/* Alloc buffer for global */
sz = hisi_hba->hw->debugfs_reg_global->count * 4;
--
2.17.1
next prev parent reply other threads:[~2019-02-06 10:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-06 10:52 [PATCH 0/6] hisi_sas: DIX support, performance optimisation, and misc patches John Garry
2019-02-06 10:52 ` [PATCH 1/6] scsi: hisi_sas: Add support for DIX feature for v3 hw John Garry
2019-02-08 23:13 ` Martin K. Petersen
2019-02-11 11:36 ` chenxiang (M)
2019-02-13 3:01 ` Martin K. Petersen
2019-02-06 10:52 ` John Garry [this message]
2019-02-06 10:52 ` [PATCH 3/6] scsi: hisi_sas: change queue depth from 512 to 4096 John Garry
2019-02-06 10:52 ` [PATCH 4/6] scsi: hisi_sas: Issue internal abort on all relevant queues John Garry
2019-02-06 10:52 ` [PATCH 5/6] scsi: hisi_sas: Use pci_irq_get_affinity() for v3 hw as experimental John Garry
2019-02-06 10:52 ` [PATCH 6/6] scsi: hisi_sas: Do some more tidy-up John Garry
2019-02-08 23:08 ` [PATCH 0/6] hisi_sas: DIX support, performance optimisation, and misc patches Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1549450376-114929-3-git-send-email-john.garry@huawei.com \
--to=john.garry@huawei.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=luojiaxing@huawei.com \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®