* [PATCH V3 2/3] nvmet-rdma: Implement get_mdts controller op
2020-03-08 10:55 [PATCH V3 1/3] nvmet: Add get_mdts op for controllers Max Gurtovoy
@ 2020-03-08 10:55 ` Max Gurtovoy
2020-03-10 16:50 ` Christoph Hellwig
2020-03-08 10:55 ` [PATCH 3/3] nvmet-rdma: allocate RW ctxs according to mdts Max Gurtovoy
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Max Gurtovoy @ 2020-03-08 10:55 UTC (permalink / raw)
To: jgg, linux-nvme, sagi, hch, kbusch
Cc: bvanassche, vladimirk, bharat, nirranjan, shlomin, krishna2,
Max Gurtovoy
Set the maximal data transfer size to be 1MB (currently mdts is
unlimited). This will allow calculating the amount of MR's that
one ctrl should allocate to fulfill it's capabilities.
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
---
changes from V2:
- move mdts explenation comment to define entry (Sagi)
changes from V1:
- renamed nvmet_rdma_set_mdts to nvmet_rdma_get_mdts
- align to get_mdts callback changes
---
drivers/nvme/target/rdma.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 37d262a..f47a79b 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -31,6 +31,9 @@
#define NVMET_RDMA_MAX_INLINE_SGE 4
#define NVMET_RDMA_MAX_INLINE_DATA_SIZE max_t(int, SZ_16K, PAGE_SIZE)
+/* Assume mpsmin == device_page_size == 4KB */
+#define NVMET_RDMA_MAX_MDTS 8
+
struct nvmet_rdma_cmd {
struct ib_sge sge[NVMET_RDMA_MAX_INLINE_SGE + 1];
struct ib_cqe cqe;
@@ -1602,6 +1605,11 @@ static void nvmet_rdma_disc_port_addr(struct nvmet_req *req,
}
}
+static u8 nvmet_rdma_get_mdts(const struct nvmet_ctrl *ctrl)
+{
+ return NVMET_RDMA_MAX_MDTS;
+}
+
static const struct nvmet_fabrics_ops nvmet_rdma_ops = {
.owner = THIS_MODULE,
.type = NVMF_TRTYPE_RDMA,
@@ -1612,6 +1620,7 @@ static void nvmet_rdma_disc_port_addr(struct nvmet_req *req,
.queue_response = nvmet_rdma_queue_response,
.delete_ctrl = nvmet_rdma_delete_ctrl,
.disc_traddr = nvmet_rdma_disc_port_addr,
+ .get_mdts = nvmet_rdma_get_mdts,
};
static void nvmet_rdma_remove_one(struct ib_device *ib_device, void *client_data)
--
1.8.3.1
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH V3 2/3] nvmet-rdma: Implement get_mdts controller op
2020-03-08 10:55 ` [PATCH V3 2/3] nvmet-rdma: Implement get_mdts controller op Max Gurtovoy
@ 2020-03-10 16:50 ` Christoph Hellwig
0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-03-10 16:50 UTC (permalink / raw)
To: Max Gurtovoy
Cc: sagi, vladimirk, bharat, nirranjan, linux-nvme, shlomin, jgg,
krishna2, kbusch, hch, bvanassche
On Sun, Mar 08, 2020 at 12:55:04PM +0200, Max Gurtovoy wrote:
> Set the maximal data transfer size to be 1MB (currently mdts is
> unlimited). This will allow calculating the amount of MR's that
> one ctrl should allocate to fulfill it's capabilities.
>
> Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] nvmet-rdma: allocate RW ctxs according to mdts
2020-03-08 10:55 [PATCH V3 1/3] nvmet: Add get_mdts op for controllers Max Gurtovoy
2020-03-08 10:55 ` [PATCH V3 2/3] nvmet-rdma: Implement get_mdts controller op Max Gurtovoy
@ 2020-03-08 10:55 ` Max Gurtovoy
2020-03-10 16:50 ` [PATCH V3 1/3] nvmet: Add get_mdts op for controllers Christoph Hellwig
2020-03-10 20:52 ` Keith Busch
3 siblings, 0 replies; 6+ messages in thread
From: Max Gurtovoy @ 2020-03-08 10:55 UTC (permalink / raw)
To: jgg, linux-nvme, sagi, hch, kbusch
Cc: bvanassche, vladimirk, bharat, nirranjan, shlomin, krishna2,
Max Gurtovoy
Current nvmet-rdma code allocates MR pool budget based on queue size,
assuming both host and target use the same "max_pages_per_mr" count.
After limiting the mdts value for RDMA controllers, we know the factor
of maximum MR's per IO operation. Thus, make sure MR pool will be
sufficient for the required IO depth and IO size.
That is, say host's SQ size is 100, then the MR pool budget allocated
currently at target will also be 100 MRs. But 100 IO WRITE Requests
with 256 sg_count(IO size above 1MB) require 200 MRs when target's
"max_pages_per_mr" is 128.
Reported-by: Krishnamraju Eraparaju <krishna2@chelsio.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
---
changes from V2:
- added "Reviewed-by" signature (Sagi)
changes from V1:
- added "Reviewed-by" signature (Christoph)
---
drivers/nvme/target/rdma.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index f47a79b..9e1b8c6 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -978,7 +978,7 @@ static int nvmet_rdma_create_queue_ib(struct nvmet_rdma_queue *queue)
{
struct ib_qp_init_attr qp_attr;
struct nvmet_rdma_device *ndev = queue->dev;
- int comp_vector, nr_cqe, ret, i;
+ int comp_vector, nr_cqe, ret, i, factor;
/*
* Spread the io queues across completion vectors,
@@ -1011,7 +1011,9 @@ static int nvmet_rdma_create_queue_ib(struct nvmet_rdma_queue *queue)
qp_attr.qp_type = IB_QPT_RC;
/* +1 for drain */
qp_attr.cap.max_send_wr = queue->send_queue_size + 1;
- qp_attr.cap.max_rdma_ctxs = queue->send_queue_size;
+ factor = rdma_rw_mr_factor(ndev->device, queue->cm_id->port_num,
+ 1 << NVMET_RDMA_MAX_MDTS);
+ qp_attr.cap.max_rdma_ctxs = queue->send_queue_size * factor;
qp_attr.cap.max_send_sge = max(ndev->device->attrs.max_sge_rd,
ndev->device->attrs.max_send_sge);
--
1.8.3.1
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH V3 1/3] nvmet: Add get_mdts op for controllers
2020-03-08 10:55 [PATCH V3 1/3] nvmet: Add get_mdts op for controllers Max Gurtovoy
2020-03-08 10:55 ` [PATCH V3 2/3] nvmet-rdma: Implement get_mdts controller op Max Gurtovoy
2020-03-08 10:55 ` [PATCH 3/3] nvmet-rdma: allocate RW ctxs according to mdts Max Gurtovoy
@ 2020-03-10 16:50 ` Christoph Hellwig
2020-03-10 20:52 ` Keith Busch
3 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2020-03-10 16:50 UTC (permalink / raw)
To: Max Gurtovoy
Cc: sagi, vladimirk, bharat, nirranjan, linux-nvme, shlomin, jgg,
krishna2, kbusch, hch, bvanassche
On Sun, Mar 08, 2020 at 12:55:03PM +0200, Max Gurtovoy wrote:
> Some transports, such as RDMA, would like to set the Maximum Data
> Transfer Size (MDTS) according to device/port/ctrl characteristics.
> This will enable the transport to set the optimal MDTS according to
> controller needs and device capabilities. Add a new nvmet transport
> op that is called during ctrl identification. This will not effect
> transports that don't implement this option. The return value of the new
> op is according to the NVMe spec definition for MDTS.
>
> Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
> Signed-off-by: Israel Rukshin <israelr@mellanox.com>
> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V3 1/3] nvmet: Add get_mdts op for controllers
2020-03-08 10:55 [PATCH V3 1/3] nvmet: Add get_mdts op for controllers Max Gurtovoy
` (2 preceding siblings ...)
2020-03-10 16:50 ` [PATCH V3 1/3] nvmet: Add get_mdts op for controllers Christoph Hellwig
@ 2020-03-10 20:52 ` Keith Busch
3 siblings, 0 replies; 6+ messages in thread
From: Keith Busch @ 2020-03-10 20:52 UTC (permalink / raw)
To: Max Gurtovoy
Cc: sagi, vladimirk, bharat, nirranjan, linux-nvme, shlomin, jgg,
krishna2, hch, bvanassche
On Sun, Mar 08, 2020 at 12:55:03PM +0200, Max Gurtovoy wrote:
> Some transports, such as RDMA, would like to set the Maximum Data
> Transfer Size (MDTS) according to device/port/ctrl characteristics.
> This will enable the transport to set the optimal MDTS according to
> controller needs and device capabilities. Add a new nvmet transport
> op that is called during ctrl identification. This will not effect
> transports that don't implement this option. The return value of the new
> op is according to the NVMe spec definition for MDTS.
>
> Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
> Signed-off-by: Israel Rukshin <israelr@mellanox.com>
> Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Series queued up for 5.7.
_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 6+ messages in thread