All of lore.kernel.org
 help / color / mirror / Atom feed
From: akinobu.mita@gmail.com (Akinobu Mita)
Subject: [PATCH v3 7/7] nvme-pci: enable to trigger device coredump by hand
Date: Mon, 13 May 2019 00:54:17 +0900	[thread overview]
Message-ID: <1557676457-4195-8-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1557676457-4195-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>
Signed-off-by: Akinobu Mita <akinobu.mita at gmail.com>
---
* v3
- Extracted from 'add device coredump infrastructure' patch
- Avoid deadlock in .coredump callback

 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 6522592..fad5395 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3288,6 +3288,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)
@@ -3302,6 +3310,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,
@@ -3409,6 +3421,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

WARNING: multiple messages have this Message-ID (diff)
From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Keith Busch <keith.busch@intel.com>, Jens Axboe <axboe@fb.com>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	Minwoo Im <minwoo.im.dev@gmail.com>,
	Kenneth Heitke <kenneth.heitke@intel.com>
Subject: [PATCH v3 7/7] nvme-pci: enable to trigger device coredump by hand
Date: Mon, 13 May 2019 00:54:17 +0900	[thread overview]
Message-ID: <1557676457-4195-8-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1557676457-4195-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@sipsolutions.net>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Minwoo Im <minwoo.im.dev@gmail.com>
Cc: Kenneth Heitke <kenneth.heitke@intel.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
* v3
- Extracted from 'add device coredump infrastructure' patch
- Avoid deadlock in .coredump callback

 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 6522592..fad5395 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3288,6 +3288,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)
@@ -3302,6 +3310,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,
@@ -3409,6 +3421,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-12 15:54 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-12 15:54 [PATCH v3 0/7] nvme-pci: support device coredump Akinobu Mita
2019-05-12 15:54 ` Akinobu Mita
2019-05-12 15:54 ` [PATCH v3 1/7] devcoredump: use memory_read_from_buffer Akinobu Mita
2019-05-12 15:54   ` Akinobu Mita
2019-05-13 15:28   ` Chaitanya Kulkarni
2019-05-13 15:28     ` Chaitanya Kulkarni
2019-05-12 15:54 ` [PATCH v3 2/7] devcoredump: fix typo in comment Akinobu Mita
2019-05-12 15:54   ` Akinobu Mita
2019-05-13 15:24   ` Chaitanya Kulkarni
2019-05-13 15:24     ` Chaitanya Kulkarni
2019-05-12 15:54 ` [PATCH v3 3/7] devcoredump: allow to create several coredump files in one device Akinobu Mita
2019-05-12 15:54   ` Akinobu Mita
2019-05-12 15:54 ` [PATCH v3 4/7] nvme: add basic facility to get telemetry log page Akinobu Mita
2019-05-12 15:54   ` Akinobu Mita
2019-05-13 15:34   ` Chaitanya Kulkarni
2019-05-13 15:34     ` Chaitanya Kulkarni
2019-05-14 14:04     ` Akinobu Mita
2019-05-14 14:04       ` Akinobu Mita
2019-05-12 15:54 ` [PATCH v3 5/7] nvme-pci: add device coredump infrastructure Akinobu Mita
2019-05-12 15:54   ` Akinobu Mita
2019-05-13  7:46   ` Minwoo Im
2019-05-13  7:46     ` Minwoo Im
2019-05-13 15:23     ` Chaitanya Kulkarni
2019-05-13 15:23       ` Chaitanya Kulkarni
2019-05-14 14:06       ` Akinobu Mita
2019-05-14 14:06         ` Akinobu Mita
2019-05-13 13:50   ` Keith Busch
2019-05-13 13:50     ` Keith Busch
2019-05-13 15:01     ` Akinobu Mita
2019-05-13 15:01       ` Akinobu Mita
2019-05-13 14:02   ` Christoph Hellwig
2019-05-13 14:02     ` Christoph Hellwig
2019-05-13 15:01     ` Akinobu Mita
2019-05-13 15:01       ` Akinobu Mita
2019-05-12 15:54 ` [PATCH v3 6/7] nvme-pci: trigger device coredump on command timeout Akinobu Mita
2019-05-12 15:54   ` Akinobu Mita
2019-05-13  7:41   ` Minwoo Im
2019-05-13  7:41     ` Minwoo Im
2019-05-13 14:59     ` Akinobu Mita
2019-05-13 14:59       ` Akinobu Mita
2019-05-13 13:52   ` Keith Busch
2019-05-13 13:52     ` Keith Busch
2019-05-12 15:54 ` Akinobu Mita [this message]
2019-05-12 15:54   ` [PATCH v3 7/7] nvme-pci: enable to trigger device coredump by hand Akinobu Mita

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=1557676457-4195-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.