linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* general preparation for NVMe over Fabrics support
@ 2016-06-06 21:20 Christoph Hellwig
  2016-06-06 21:20 ` [PATCH 01/10] nvme.h: add RTD3R, RTD3E and OAES fields Christoph Hellwig
                   ` (10 more replies)
  0 siblings, 11 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-06 21:20 UTC (permalink / raw)
  To: axboe, keith.busch; +Cc: linux-nvme, linux-block, linux-kernel

This patch set adds some needed preparations for the upcoming NVMe over
Fabrics support.

Contains:
- Allow transfer size limitations for NVMe transports
- Add the get_log_page command definition required by the NVMe target
- more helpers in core code that can be used by various transports
- add some missing constants and identify attributes

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 01/10] nvme.h: add RTD3R, RTD3E and OAES fields
  2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
@ 2016-06-06 21:20 ` Christoph Hellwig
  2016-06-07  8:10   ` Johannes Thumshirn
  2016-06-06 21:20 ` [PATCH 02/10] nvme.h: Add get_log_page command strucure Christoph Hellwig
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-06 21:20 UTC (permalink / raw)
  To: axboe, keith.busch; +Cc: linux-nvme, linux-block, linux-kernel

These have been added in NVMe 1.2 and we'll need at least oaes for the
NVMe target driver.

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Jay Freyensee <james.p.freyensee@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/nvme.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 7d51b29..ff5ebc3 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -107,7 +107,10 @@ struct nvme_id_ctrl {
 	__u8			mdts;
 	__le16			cntlid;
 	__le32			ver;
-	__u8			rsvd84[172];
+	__le32			rtd3r;
+	__le32			rtd3e;
+	__le32			oaes;
+	__u8			rsvd96[160];
 	__le16			oacs;
 	__u8			acl;
 	__u8			aerl;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 02/10] nvme.h: Add get_log_page command strucure
  2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
  2016-06-06 21:20 ` [PATCH 01/10] nvme.h: add RTD3R, RTD3E and OAES fields Christoph Hellwig
@ 2016-06-06 21:20 ` Christoph Hellwig
  2016-06-06 21:20 ` [PATCH 03/10] nvme.h: add NVM command set SQE/CQE size defines Christoph Hellwig
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-06 21:20 UTC (permalink / raw)
  To: axboe, keith.busch; +Cc: linux-nvme, linux-block, linux-kernel, Armen Baloyan

From: Armen Baloyan <armenx.baloyan@intel.com>

Add get_log_page command structure and a corresponding entry in
nvme_command union

Signed-off-by: Armen Baloyan <armenx.baloyan@intel.com>
Reviewed-by: Jay Freyensee <james.p.freyensee@intel.com>
Reviewed--by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/nvme.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index ff5ebc3..9925b85 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -519,6 +519,24 @@ struct nvme_format_cmd {
 	__u32			rsvd11[5];
 };
 
+struct nvme_get_log_page_command {
+	__u8			opcode;
+	__u8			flags;
+	__u16			command_id;
+	__le32			nsid;
+	__u64			rsvd2[2];
+	__le64			prp1;
+	__le64			prp2;
+	__u8			lid;
+	__u8			rsvd10;
+	__le16			numdl;
+	__le16			numdu;
+	__u16			rsvd11;
+	__le32			lpol;
+	__le32			lpou;
+	__u32			rsvd14[2];
+};
+
 struct nvme_command {
 	union {
 		struct nvme_common_command common;
@@ -532,6 +550,7 @@ struct nvme_command {
 		struct nvme_format_cmd format;
 		struct nvme_dsm_cmd dsm;
 		struct nvme_abort_cmd abort;
+		struct nvme_get_log_page_command get_log_page;
 	};
 };
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 03/10] nvme.h: add NVM command set SQE/CQE size defines
  2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
  2016-06-06 21:20 ` [PATCH 01/10] nvme.h: add RTD3R, RTD3E and OAES fields Christoph Hellwig
  2016-06-06 21:20 ` [PATCH 02/10] nvme.h: Add get_log_page command strucure Christoph Hellwig
@ 2016-06-06 21:20 ` Christoph Hellwig
  2016-06-06 21:20 ` [PATCH 04/10] nvme.h: add AER constants Christoph Hellwig
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-06 21:20 UTC (permalink / raw)
  To: axboe, keith.busch; +Cc: linux-nvme, linux-block, linux-kernel

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/nvme.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 9925b85..9807d98 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -50,6 +50,13 @@ enum {
 #define NVME_CMB_CQS(cmbsz)	((cmbsz) & 0x2)
 #define NVME_CMB_SQS(cmbsz)	((cmbsz) & 0x1)
 
+/*
+ * Submission and Completion Queue Entry Sizes for the NVM command set.
+ * (In bytes and specified as a power of two (2^n)).
+ */
+#define NVME_NVM_IOSQES		6
+#define NVME_NVM_IOCQES		4
+
 enum {
 	NVME_CC_ENABLE		= 1 << 0,
 	NVME_CC_CSS_NVM		= 0 << 4,
@@ -61,8 +68,8 @@ enum {
 	NVME_CC_SHN_NORMAL	= 1 << 14,
 	NVME_CC_SHN_ABRUPT	= 2 << 14,
 	NVME_CC_SHN_MASK	= 3 << 14,
-	NVME_CC_IOSQES		= 6 << 16,
-	NVME_CC_IOCQES		= 4 << 20,
+	NVME_CC_IOSQES		= NVME_NVM_IOSQES << 16,
+	NVME_CC_IOCQES		= NVME_NVM_IOCQES << 20,
 	NVME_CSTS_RDY		= 1 << 0,
 	NVME_CSTS_CFS		= 1 << 1,
 	NVME_CSTS_NSSRO		= 1 << 4,
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 04/10] nvme.h: add AER constants
  2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
                   ` (2 preceding siblings ...)
  2016-06-06 21:20 ` [PATCH 03/10] nvme.h: add NVM command set SQE/CQE size defines Christoph Hellwig
@ 2016-06-06 21:20 ` Christoph Hellwig
  2016-06-06 21:20 ` [PATCH 05/10] nvme.h: add constants for PSDT and FUSE values Christoph Hellwig
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-06 21:20 UTC (permalink / raw)
  To: axboe, keith.busch; +Cc: linux-nvme, linux-block, linux-kernel

Reviewed-by: Jay Freyensee <james.p.freyensee@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Ming Lin <ming.l@ssi.samsung.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/nvme.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 9807d98..a9b8c7b 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -284,6 +284,12 @@ struct nvme_reservation_status {
 	} regctl_ds[];
 };
 
+enum nvme_async_event_type {
+	NVME_AER_TYPE_ERROR	= 0,
+	NVME_AER_TYPE_SMART	= 1,
+	NVME_AER_TYPE_NOTICE	= 2,
+};
+
 /* I/O commands */
 
 enum nvme_opcode {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 05/10] nvme.h: add constants for PSDT and FUSE values
  2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
                   ` (3 preceding siblings ...)
  2016-06-06 21:20 ` [PATCH 04/10] nvme.h: add AER constants Christoph Hellwig
@ 2016-06-06 21:20 ` Christoph Hellwig
  2016-06-06 21:20 ` [PATCH 06/10] nvme: allow for size limitations from transport drivers Christoph Hellwig
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-06 21:20 UTC (permalink / raw)
  To: axboe, keith.busch; +Cc: linux-nvme, linux-block, linux-kernel, James Smart

From: James Smart <james.smart@broadcom.com>

Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/nvme.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index a9b8c7b..2b82f05 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -306,6 +306,29 @@ enum nvme_opcode {
 	nvme_cmd_resv_release	= 0x15,
 };
 
+/*
+ * Lowest two bits of our flags field (FUSE field in the spec):
+ *
+ * @NVME_CMD_FUSE_FIRST:   Fused Operation, first command
+ * @NVME_CMD_FUSE_SECOND:  Fused Operation, second command
+ *
+ * Highest two bits in our flags field (PSDT field in the spec):
+ *
+ * @NVME_CMD_PSDT_SGL_METABUF:	Use SGLS for this transfer,
+ *	If used, MPTR contains addr of single physical buffer (byte aligned).
+ * @NVME_CMD_PSDT_SGL_METASEG:	Use SGLS for this transfer,
+ *	If used, MPTR contains an address of an SGL segment containing
+ *	exactly 1 SGL descriptor (qword aligned).
+ */
+enum {
+	NVME_CMD_FUSE_FIRST	= (1 << 0),
+	NVME_CMD_FUSE_SECOND	= (1 << 1),
+
+	NVME_CMD_SGL_METABUF	= (1 << 6),
+	NVME_CMD_SGL_METASEG	= (1 << 7),
+	NVME_CMD_SGL_ALL	= NVME_CMD_SGL_METABUF | NVME_CMD_SGL_METASEG,
+};
+
 struct nvme_common_command {
 	__u8			opcode;
 	__u8			flags;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 06/10] nvme: allow for size limitations from transport drivers
  2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
                   ` (4 preceding siblings ...)
  2016-06-06 21:20 ` [PATCH 05/10] nvme.h: add constants for PSDT and FUSE values Christoph Hellwig
@ 2016-06-06 21:20 ` Christoph Hellwig
  2016-06-06 21:20 ` [PATCH 07/10] nvme: factor out a add nvme_is_write helper Christoph Hellwig
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-06 21:20 UTC (permalink / raw)
  To: axboe, keith.busch; +Cc: linux-nvme, linux-block, linux-kernel

Some transport drivers may have a lower transfer size than
the controller. So allow the transport to set it in the
controller max_hw_sectors.

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 1a51584..b582c11 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1088,6 +1088,7 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
 	struct nvme_id_ctrl *id;
 	u64 cap;
 	int ret, page_shift;
+	u32 max_hw_sectors;
 
 	ret = ctrl->ops->reg_read32(ctrl, NVME_REG_VS, &ctrl->vs);
 	if (ret) {
@@ -1120,9 +1121,11 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
 	memcpy(ctrl->model, id->mn, sizeof(id->mn));
 	memcpy(ctrl->firmware_rev, id->fr, sizeof(id->fr));
 	if (id->mdts)
-		ctrl->max_hw_sectors = 1 << (id->mdts + page_shift - 9);
+		max_hw_sectors = 1 << (id->mdts + page_shift - 9);
 	else
-		ctrl->max_hw_sectors = UINT_MAX;
+		max_hw_sectors = UINT_MAX;
+	ctrl->max_hw_sectors =
+		min_not_zero(ctrl->max_hw_sectors, max_hw_sectors);
 
 	if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) && id->vs[3]) {
 		unsigned int max_hw_sectors;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 07/10] nvme: factor out a add nvme_is_write helper
  2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
                   ` (5 preceding siblings ...)
  2016-06-06 21:20 ` [PATCH 06/10] nvme: allow for size limitations from transport drivers Christoph Hellwig
@ 2016-06-06 21:20 ` Christoph Hellwig
  2016-06-06 21:20 ` [PATCH 08/10] nvme: move the workaround for I/O queue-less controllers from PCIe to core Christoph Hellwig
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-06 21:20 UTC (permalink / raw)
  To: axboe, keith.busch; +Cc: linux-nvme, linux-block, linux-kernel

Centralize the check if a given NVMe command reads or writes data.

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Jay Freyensee <james.p.freyensee@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 5 ++---
 include/linux/nvme.h     | 5 +++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index b582c11..ffd9910 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -176,10 +176,9 @@ EXPORT_SYMBOL_GPL(nvme_requeue_req);
 struct request *nvme_alloc_request(struct request_queue *q,
 		struct nvme_command *cmd, unsigned int flags)
 {
-	bool write = cmd->common.opcode & 1;
 	struct request *req;
 
-	req = blk_mq_alloc_request(q, write, flags);
+	req = blk_mq_alloc_request(q, nvme_is_write(cmd), flags);
 	if (IS_ERR(req))
 		return req;
 
@@ -344,7 +343,7 @@ int __nvme_submit_user_cmd(struct request_queue *q, struct nvme_command *cmd,
 		void __user *meta_buffer, unsigned meta_len, u32 meta_seed,
 		u32 *result, unsigned timeout)
 {
-	bool write = cmd->common.opcode & 1;
+	bool write = nvme_is_write(cmd);
 	struct nvme_completion cqe;
 	struct nvme_ns *ns = q->queuedata;
 	struct gendisk *disk = ns ? ns->disk : NULL;
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 2b82f05..dc815cc 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -590,6 +590,11 @@ struct nvme_command {
 	};
 };
 
+static inline bool nvme_is_write(struct nvme_command *cmd)
+{
+	return cmd->common.opcode & 1;
+}
+
 enum {
 	NVME_SC_SUCCESS			= 0x0,
 	NVME_SC_INVALID_OPCODE		= 0x1,
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 08/10] nvme: move the workaround for I/O queue-less controllers from PCIe to core
  2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
                   ` (6 preceding siblings ...)
  2016-06-06 21:20 ` [PATCH 07/10] nvme: factor out a add nvme_is_write helper Christoph Hellwig
@ 2016-06-06 21:20 ` Christoph Hellwig
  2016-06-06 21:20 ` [PATCH 09/10] nvme: update nvme_cancel_io() a bit Christoph Hellwig
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-06 21:20 UTC (permalink / raw)
  To: axboe, keith.busch; +Cc: linux-nvme, linux-block, linux-kernel

We want to apply this to Fabrics drivers as well, so move it to common
code.

Reviewed-by: Jay Freyensee <james.p.freyensee@intel.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Tested-by: Ming Lin <ming.l@ssi.samsung.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 17 ++++++++++++++---
 drivers/nvme/host/pci.c  | 10 +---------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ffd9910..972029a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -557,11 +557,22 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count)
 
 	status = nvme_set_features(ctrl, NVME_FEAT_NUM_QUEUES, q_count, 0,
 			&result);
-	if (status)
+	if (status < 0)
 		return status;
 
-	nr_io_queues = min(result & 0xffff, result >> 16) + 1;
-	*count = min(*count, nr_io_queues);
+	/*
+	 * Degraded controllers might return an error when setting the queue
+	 * count.  We still want to be able to bring them online and offer
+	 * access to the admin queue, as that might be only way to fix them up.
+	 */
+	if (status > 0) {
+		dev_err(ctrl->dev, "Could not set queue count (%d)\n", status);
+		*count = 0;
+	} else {
+		nr_io_queues = min(result & 0xffff, result >> 16) + 1;
+		*count = min(*count, nr_io_queues);
+	}
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(nvme_set_queue_count);
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 78dca31..cf7ea73 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1399,16 +1399,8 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
 	if (result < 0)
 		return result;
 
-	/*
-	 * Degraded controllers might return an error when setting the queue
-	 * count.  We still want to be able to bring them online and offer
-	 * access to the admin queue, as that might be only way to fix them up.
-	 */
-	if (result > 0) {
-		dev_err(dev->ctrl.device,
-			"Could not set queue count (%d)\n", result);
+	if (nr_io_queues == 0)
 		return 0;
-	}
 
 	if (dev->cmb && NVME_CMB_SQS(dev->cmbsz)) {
 		result = nvme_cmb_qdepth(dev, nr_io_queues,
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 09/10] nvme: update nvme_cancel_io() a bit
  2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
                   ` (7 preceding siblings ...)
  2016-06-06 21:20 ` [PATCH 08/10] nvme: move the workaround for I/O queue-less controllers from PCIe to core Christoph Hellwig
@ 2016-06-06 21:20 ` Christoph Hellwig
  2016-06-06 21:20 ` [PATCH 10/10] nvme: move nvme_cancel_request() to core.c Christoph Hellwig
  2016-06-09 16:38 ` general preparation for NVMe over Fabrics support Keith Busch
  10 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-06 21:20 UTC (permalink / raw)
  To: axboe, keith.busch
  Cc: linux-nvme, linux-block, linux-kernel, Ming Lin, Sagi Grimberg

From: Ming Lin <ming.l@samsung.com>

Pass in nvme_ctrl, so it can be used by the fabrics drivers also.
Also update to upstream version and rename it to nvme_cancel_request.

Signed-off-by: Ming Lin <ming.l@samsung.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/pci.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index cf7ea73..5ae5804 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -919,14 +919,14 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 	return BLK_EH_RESET_TIMER;
 }
 
-static void nvme_cancel_io(struct request *req, void *data, bool reserved)
+static void nvme_cancel_request(struct request *req, void *data, bool reserved)
 {
 	int status;
 
 	if (!blk_mq_request_started(req))
 		return;
 
-	dev_dbg_ratelimited(((struct nvme_dev *) data)->ctrl.device,
+	dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device,
 				"Cancelling I/O %d", req->tag);
 
 	status = NVME_SC_ABORT_REQ;
@@ -1714,8 +1714,9 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
 	}
 	nvme_pci_disable(dev);
 
-	blk_mq_tagset_busy_iter(&dev->tagset, nvme_cancel_io, dev);
-	blk_mq_tagset_busy_iter(&dev->admin_tagset, nvme_cancel_io, dev);
+	blk_mq_tagset_busy_iter(&dev->tagset, nvme_cancel_request, &dev->ctrl);
+	blk_mq_tagset_busy_iter(&dev->admin_tagset,
+				nvme_cancel_request, &dev->ctrl);
 	mutex_unlock(&dev->shutdown_lock);
 }
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 10/10] nvme: move nvme_cancel_request() to core.c
  2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
                   ` (8 preceding siblings ...)
  2016-06-06 21:20 ` [PATCH 09/10] nvme: update nvme_cancel_io() a bit Christoph Hellwig
@ 2016-06-06 21:20 ` Christoph Hellwig
  2016-06-09 16:38 ` general preparation for NVMe over Fabrics support Keith Busch
  10 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-06 21:20 UTC (permalink / raw)
  To: axboe, keith.busch; +Cc: linux-nvme, linux-block, linux-kernel, Ming Lin

From: Ming Lin <ming.l@samsung.com>

So it can be used by fabrics driver as well.

Signed-off-by: Ming Lin <ming.l@samsung.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 17 +++++++++++++++++
 drivers/nvme/host/nvme.h |  1 +
 drivers/nvme/host/pci.c  | 16 ----------------
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 972029a..27cce17 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -58,6 +58,23 @@ static DEFINE_SPINLOCK(dev_list_lock);
 
 static struct class *nvme_class;
 
+void nvme_cancel_request(struct request *req, void *data, bool reserved)
+{
+	int status;
+
+	if (!blk_mq_request_started(req))
+		return;
+
+	dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device,
+				"Cancelling I/O %d", req->tag);
+
+	status = NVME_SC_ABORT_REQ;
+	if (blk_queue_dying(req->q))
+		status |= NVME_SC_DNR;
+	blk_mq_complete_request(req, status);
+}
+EXPORT_SYMBOL_GPL(nvme_cancel_request);
+
 bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
 		enum nvme_ctrl_state new_state)
 {
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 1daa048..bb7f001 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -207,6 +207,7 @@ static inline bool nvme_req_needs_retry(struct request *req, u16 status)
 		(jiffies - req->start_time) < req->timeout;
 }
 
+void nvme_cancel_request(struct request *req, void *data, bool reserved);
 bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
 		enum nvme_ctrl_state new_state);
 int nvme_disable_ctrl(struct nvme_ctrl *ctrl, u64 cap);
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 5ae5804..2c3019a 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -919,22 +919,6 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
 	return BLK_EH_RESET_TIMER;
 }
 
-static void nvme_cancel_request(struct request *req, void *data, bool reserved)
-{
-	int status;
-
-	if (!blk_mq_request_started(req))
-		return;
-
-	dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device,
-				"Cancelling I/O %d", req->tag);
-
-	status = NVME_SC_ABORT_REQ;
-	if (blk_queue_dying(req->q))
-		status |= NVME_SC_DNR;
-	blk_mq_complete_request(req, status);
-}
-
 static void nvme_free_queue(struct nvme_queue *nvmeq)
 {
 	dma_free_coherent(nvmeq->q_dmadev, CQ_SIZE(nvmeq->q_depth),
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 01/10] nvme.h: add RTD3R, RTD3E and OAES fields
  2016-06-06 21:20 ` [PATCH 01/10] nvme.h: add RTD3R, RTD3E and OAES fields Christoph Hellwig
@ 2016-06-07  8:10   ` Johannes Thumshirn
  2016-06-07  8:38     ` Johannes Thumshirn
  2016-06-07 10:49     ` Christoph Hellwig
  0 siblings, 2 replies; 18+ messages in thread
From: Johannes Thumshirn @ 2016-06-07  8:10 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: axboe, keith.busch, linux-block, linux-kernel, linux-nvme

On Mon, Jun 06, 2016 at 11:20:43PM +0200, Christoph Hellwig wrote:
> These have been added in NVMe 1.2 and we'll need at least oaes for the
> NVMe target driver.
> 
> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
> Reviewed-by: Jay Freyensee <james.p.freyensee@intel.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  include/linux/nvme.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/nvme.h b/include/linux/nvme.h
> index 7d51b29..ff5ebc3 100644
> --- a/include/linux/nvme.h
> +++ b/include/linux/nvme.h
> @@ -107,7 +107,10 @@ struct nvme_id_ctrl {
>  	__u8			mdts;
>  	__le16			cntlid;
>  	__le32			ver;
> -	__u8			rsvd84[172];
> +	__le32			rtd3r;
> +	__le32			rtd3e;
> +	__le32			oaes;

Just out of curiosity, why not CTRATT as well?

> +	__u8			rsvd96[160];
>  	__le16			oacs;
>  	__u8			acl;
>  	__u8			aerl;
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 01/10] nvme.h: add RTD3R, RTD3E and OAES fields
  2016-06-07  8:10   ` Johannes Thumshirn
@ 2016-06-07  8:38     ` Johannes Thumshirn
  2016-06-07 10:49     ` Christoph Hellwig
  1 sibling, 0 replies; 18+ messages in thread
From: Johannes Thumshirn @ 2016-06-07  8:38 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: axboe, keith.busch, linux-block, linux-kernel, linux-nvme

On Tue, Jun 07, 2016 at 10:10:09AM +0200, Johannes Thumshirn wrote:
> On Mon, Jun 06, 2016 at 11:20:43PM +0200, Christoph Hellwig wrote:
> > These have been added in NVMe 1.2 and we'll need at least oaes for the
> > NVMe target driver.
> > 
> > Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
> > Reviewed-by: Jay Freyensee <james.p.freyensee@intel.com>
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  include/linux/nvme.h | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/include/linux/nvme.h b/include/linux/nvme.h
> > index 7d51b29..ff5ebc3 100644
> > --- a/include/linux/nvme.h
> > +++ b/include/linux/nvme.h
> > @@ -107,7 +107,10 @@ struct nvme_id_ctrl {
> >  	__u8			mdts;
> >  	__le16			cntlid;
> >  	__le32			ver;
> > -	__u8			rsvd84[172];
> > +	__le32			rtd3r;
> > +	__le32			rtd3e;
> > +	__le32			oaes;
> 
> Just out of curiosity, why not CTRATT as well?

OK found the patch adding it myself.

Sorry,
	Johannes
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 01/10] nvme.h: add RTD3R, RTD3E and OAES fields
  2016-06-07  8:10   ` Johannes Thumshirn
  2016-06-07  8:38     ` Johannes Thumshirn
@ 2016-06-07 10:49     ` Christoph Hellwig
  1 sibling, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-07 10:49 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: axboe, keith.busch, linux-block, linux-kernel, linux-nvme

On Tue, Jun 07, 2016 at 10:10:09AM +0200, Johannes Thumshirn wrote:
> Just out of curiosity, why not CTRATT as well?

ctratt is part of the fabrics spec and not the NVMe 1.2 spec, and we tried
to keep those separate.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: general preparation for NVMe over Fabrics support
  2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
                   ` (9 preceding siblings ...)
  2016-06-06 21:20 ` [PATCH 10/10] nvme: move nvme_cancel_request() to core.c Christoph Hellwig
@ 2016-06-09 16:38 ` Keith Busch
  2016-06-09 17:12   ` Christoph Hellwig
  2016-06-12 13:33   ` Jens Axboe
  10 siblings, 2 replies; 18+ messages in thread
From: Keith Busch @ 2016-06-09 16:38 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: axboe, linux-nvme, linux-block, linux-kernel

On Mon, Jun 06, 2016 at 11:20:42PM +0200, Christoph Hellwig wrote:
> This patch set adds some needed preparations for the upcoming NVMe over
> Fabrics support.
> 
> Contains:
> - Allow transfer size limitations for NVMe transports
> - Add the get_log_page command definition required by the NVMe target
> - more helpers in core code that can be used by various transports
> - add some missing constants and identify attributes

This series looks good.

Reviewed-by: Keith Busch <keith.busch@inte.com>

For patch ordering, I had thought there were no issues with these
I submitted:

  http://lists.infradead.org/pipermail/linux-nvme/2016-May/004704.html
  http://lists.infradead.org/pipermail/linux-nvme/2016-May/004709.html

It's the ones adding the SCHED_RESET state to fixup synchronizing
continuous user initiated resets, and think it should still go in for 4.7.
There will be a minor conflict with 10/10 in this set it does go first.

Anyway, moving on to the Fabrics library support set!

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: general preparation for NVMe over Fabrics support
  2016-06-09 16:38 ` general preparation for NVMe over Fabrics support Keith Busch
@ 2016-06-09 17:12   ` Christoph Hellwig
  2016-06-12 13:33   ` Jens Axboe
  1 sibling, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-09 17:12 UTC (permalink / raw)
  To: Keith Busch
  Cc: Christoph Hellwig, axboe, linux-nvme, linux-block, linux-kernel

On Thu, Jun 09, 2016 at 12:38:55PM -0400, Keith Busch wrote:
> For patch ordering, I had thought there were no issues with these
> I submitted:
> 
>   http://lists.infradead.org/pipermail/linux-nvme/2016-May/004704.html
>   http://lists.infradead.org/pipermail/linux-nvme/2016-May/004709.html
> 
> It's the ones adding the SCHED_RESET state to fixup synchronizing
> continuous user initiated resets, and think it should still go in for 4.7.
> There will be a minor conflict with 10/10 in this set it does go first.

The 4.8 tree has forked already. I'm fine with adding these to 4.7,
but we'll also need them in 4.8 going forward.

Jens: are you fine with merging them for 4.7 for now, and merging them
for 4.8 separately once I've finished the fabrics bits?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: general preparation for NVMe over Fabrics support
  2016-06-09 16:38 ` general preparation for NVMe over Fabrics support Keith Busch
  2016-06-09 17:12   ` Christoph Hellwig
@ 2016-06-12 13:33   ` Jens Axboe
  2016-06-13  8:03     ` Christoph Hellwig
  1 sibling, 1 reply; 18+ messages in thread
From: Jens Axboe @ 2016-06-12 13:33 UTC (permalink / raw)
  To: Keith Busch; +Cc: Christoph Hellwig, linux-nvme, linux-block, linux-kernel

On Thu, Jun 09 2016, Keith Busch wrote:
> On Mon, Jun 06, 2016 at 11:20:42PM +0200, Christoph Hellwig wrote:
> > This patch set adds some needed preparations for the upcoming NVMe over
> > Fabrics support.
> > 
> > Contains:
> > - Allow transfer size limitations for NVMe transports
> > - Add the get_log_page command definition required by the NVMe target
> > - more helpers in core code that can be used by various transports
> > - add some missing constants and identify attributes
> 
> This series looks good.
> 
> Reviewed-by: Keith Busch <keith.busch@inte.com>

Added 1-8, 9/10 throws a lot of rejects and it's pre-coffee here. What
is this against?

I corrected your email, unless you joined a hot new startup called Inte.

> For patch ordering, I had thought there were no issues with these
> I submitted:
> 
>   http://lists.infradead.org/pipermail/linux-nvme/2016-May/004704.html

This looks fine for 4.7.

>   http://lists.infradead.org/pipermail/linux-nvme/2016-May/004709.html

This one is a bit involved...

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: general preparation for NVMe over Fabrics support
  2016-06-12 13:33   ` Jens Axboe
@ 2016-06-13  8:03     ` Christoph Hellwig
  0 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2016-06-13  8:03 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Keith Busch, Christoph Hellwig, linux-nvme, linux-block, linux-kernel

On Sun, Jun 12, 2016 at 07:33:18AM -0600, Jens Axboe wrote:
> Added 1-8, 9/10 throws a lot of rejects and it's pre-coffee here. What
> is this against?

This was against 4.7-rc2 I think.  But you already merged 9 and 10 in
slightly different versions, so we should be fine.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2016-06-13  8:03 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06 21:20 general preparation for NVMe over Fabrics support Christoph Hellwig
2016-06-06 21:20 ` [PATCH 01/10] nvme.h: add RTD3R, RTD3E and OAES fields Christoph Hellwig
2016-06-07  8:10   ` Johannes Thumshirn
2016-06-07  8:38     ` Johannes Thumshirn
2016-06-07 10:49     ` Christoph Hellwig
2016-06-06 21:20 ` [PATCH 02/10] nvme.h: Add get_log_page command strucure Christoph Hellwig
2016-06-06 21:20 ` [PATCH 03/10] nvme.h: add NVM command set SQE/CQE size defines Christoph Hellwig
2016-06-06 21:20 ` [PATCH 04/10] nvme.h: add AER constants Christoph Hellwig
2016-06-06 21:20 ` [PATCH 05/10] nvme.h: add constants for PSDT and FUSE values Christoph Hellwig
2016-06-06 21:20 ` [PATCH 06/10] nvme: allow for size limitations from transport drivers Christoph Hellwig
2016-06-06 21:20 ` [PATCH 07/10] nvme: factor out a add nvme_is_write helper Christoph Hellwig
2016-06-06 21:20 ` [PATCH 08/10] nvme: move the workaround for I/O queue-less controllers from PCIe to core Christoph Hellwig
2016-06-06 21:20 ` [PATCH 09/10] nvme: update nvme_cancel_io() a bit Christoph Hellwig
2016-06-06 21:20 ` [PATCH 10/10] nvme: move nvme_cancel_request() to core.c Christoph Hellwig
2016-06-09 16:38 ` general preparation for NVMe over Fabrics support Keith Busch
2016-06-09 17:12   ` Christoph Hellwig
2016-06-12 13:33   ` Jens Axboe
2016-06-13  8:03     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).