Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: akinobu.mita@gmail.com (Akinobu Mita)
Subject: [PATCH v4 7/7] nvme-pci: enable to trigger device coredump by hand
Date: Mon, 20 May 2019 00:06:58 +0900	[thread overview]
Message-ID: <1558278418-5702-8-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1558278418-5702-1-git-send-email-akinobu.mita@gmail.com>

This provides a way to trigger the nvme device coredump by writing
anything to /sys/devices/.../coredump attribute.

Cc: Johannes Berg <johannes at sipsolutions.net>
Cc: Keith Busch <keith.busch at intel.com>
Cc: Jens Axboe <axboe at fb.com>
Cc: Christoph Hellwig <hch at lst.de>
Cc: Sagi Grimberg <sagi at grimberg.me>
Cc: Minwoo Im <minwoo.im.dev at gmail.com>
Cc: Kenneth Heitke <kenneth.heitke at intel.com>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni at wdc.com>
Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>
---
* v4
- No change since v3

 drivers/nvme/host/pci.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 6436e72..04084b9 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3266,6 +3266,14 @@ static void nvme_coredump_complete(struct nvme_dev *dev)
 	nvme_coredump_clear(dev);
 }
 
+static void nvme_coredump(struct device *dev)
+{
+	struct nvme_dev *ndev = dev_get_drvdata(dev);
+
+	nvme_dev_disable(ndev, false, true);
+	nvme_reset_ctrl_sync(&ndev->ctrl);
+}
+
 #else
 
 static void nvme_coredump_init(struct nvme_dev *dev)
@@ -3281,6 +3289,10 @@ static void nvme_coredump_complete(struct nvme_dev *dev)
 {
 }
 
+static void nvme_coredump(struct device *dev)
+{
+}
+
 #endif /* CONFIG_DEV_COREDUMP */
 
 static pci_ers_result_t nvme_error_detected(struct pci_dev *pdev,
@@ -3388,6 +3400,7 @@ static struct pci_driver nvme_driver = {
 	.shutdown	= nvme_shutdown,
 	.driver		= {
 		.pm	= &nvme_dev_pm_ops,
+		.coredump = nvme_coredump,
 	},
 	.sriov_configure = pci_sriov_configure_simple,
 	.err_handler	= &nvme_err_handler,
-- 
2.7.4

      parent reply	other threads:[~2019-05-19 15:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-19 15:06 [PATCH v4 0/7] nvme-pci: support device coredump Akinobu Mita
2019-05-19 15:06 ` [PATCH v4 1/7] devcoredump: use memory_read_from_buffer Akinobu Mita
2019-05-19 15:06 ` [PATCH v4 2/7] devcoredump: fix typo in comment Akinobu Mita
2019-05-19 15:06 ` [PATCH v4 3/7] devcoredump: allow to create several coredump files in one device Akinobu Mita
2019-05-19 15:06 ` [PATCH v4 4/7] nvme: add basic facilities to get telemetry log page Akinobu Mita
2019-05-19 15:06 ` [PATCH v4 5/7] nvme-pci: add device coredump infrastructure Akinobu Mita
2019-05-19 15:06 ` [PATCH v4 6/7] nvme-pci: trigger device coredump on command timeout Akinobu Mita
2019-05-19 15:06 ` Akinobu Mita [this message]

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=1558278418-5702-8-git-send-email-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.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