Re: [PATCH for-rc] nvme-rdma/nvmet-rdma: Allocate sufficient RW ctxs to match hosts pgs len
From: Krishnamraju Eraparaju <hidden>
Date: 2020-03-02 07:33:19
Also in:
linux-nvme
Subsystem:
nvm express target driver, the rest · Maintainers:
Christoph Hellwig, Sagi Grimberg, Chaitanya Kulkarni, Linus Torvalds
Hi Sagi & Max Gurtovoy, Thanks for your pointers regarding mdts. Looks like fixing this issue through mdts is more natural than fixing through RDMA private data. Issue is not occuring after appling the below patch(inspired by Max's patch "nvmet-rdma: Implement set_mdts controller op"). So any consensus about merging the fix upstream, to fix this specific issue?
diff --git a/drivers/nvme/target/admin-cmd.cb/drivers/nvme/target/admin-cmd.c index 56c21b50..0d468ab 100644
--- a/drivers/nvme/target/admin-cmd.c
+++ b/drivers/nvme/target/admin-cmd.c@@ -346,8 +346,12 @@ static void nvmet_execute_identify_ctrl(structnvmet_req *req)
/* we support multiple ports, multiples hosts and ANA: */
id->cmic = (1 << 0) | (1 << 1) | (1 << 3);
- /* no limit on data transfer sizes for now */
- id->mdts = 0;
+ /* Limit MDTS according to transport capability */
+ if (ctrl->ops->set_mdts)
+ id->mdts = ctrl->ops->set_mdts(ctrl);
+ else
+ id->mdts = 0;
+
id->cntlid = cpu_to_le16(ctrl->cntlid);
id->ver = cpu_to_le32(ctrl->subsys->ver);
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 46df45e..851f8ed 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h@@ -279,6 +279,7 @@ struct nvmet_fabrics_ops { struct nvmet_port *port, char *traddr); u16 (*install_queue)(struct nvmet_sq *nvme_sq); void (*discovery_chg)(struct nvmet_port *port); + u8 (*set_mdts)(struct nvmet_ctrl *ctrl); }; #define NVMET_MAX_INLINE_BIOVEC 8
diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 37d262a..62363be 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c@@ -1602,6 +1602,17 @@ static void nvmet_rdma_disc_port_addr(structnvmet_req *req,
}
}
+static u8 nvmet_rdma_set_mdts(struct nvmet_ctrl *ctrl)
+{
+ struct nvmet_port *port = ctrl->port;
+ struct rdma_cm_id *cm_id = port->priv;
+ u32 max_pages;
+
+ max_pages = cm_id->device->attrs.max_fast_reg_page_list_len;
+ /* Assume mpsmin == device_page_size == 4KB */
+ return ilog2(max_pages);
+}
+
static const struct nvmet_fabrics_ops nvmet_rdma_ops = {
.owner = THIS_MODULE,
.type = NVMF_TRTYPE_RDMA,@@ -1612,6 +1623,7 @@ static void nvmet_rdma_disc_port_addr(structnvmet_req *req,
.queue_response = nvmet_rdma_queue_response,
.delete_ctrl = nvmet_rdma_delete_ctrl,
.disc_traddr = nvmet_rdma_disc_port_addr,
+ .set_mdts = nvmet_rdma_set_mdts,
};
static void nvmet_rdma_remove_one(struct ib_device *ib_device, void
*client_data)
Thanks,
Krishna.
On Sunday, March 03/01/20, 2020 at 16:05:53 +0200, Max Gurtovoy wrote:On 2/28/2020 1:14 AM, Sagi Grimberg wrote:quoted
quoted
quoted
The patch doesn't say if this is an actual bug you are seeing or theoretical.I've noticed this issue while running the below fio command: fio --rw=randwrite --name=random --norandommap --ioengine=libaio --size=16m --group_reporting --exitall --fsync_on_close=1 --invalidate=1 --direct=1 --filename=/dev/nvme2n1 --iodepth=32 --numjobs=16 --unit_base=1 --bs=4m --kb_base=1000 Note: here NVMe Host is on SIW & Target is on iw_cxgb4 and the max_pages_per_mr supported by SIW and iw_cxgb4 are 255 and 128 respectively.This needs to be documented in the change log.quoted
quoted
quoted
The proposed patch enables host to advertise the max_fr_pages(via nvme_rdma_cm_req) such that target can allocate that many number of RW ctxs(if host's max_fr_pages is higher than target's).As mentioned by Jason, this s a non-compatible change, if you want to introduce this you need to go through the standard and update the cm private_data layout (would mean that the fmt needs to increment as well to be backward compatible).Sure, will initiate a discussion at NVMe TWG about CM private_data format. Will update the response soon.quoted
As a stop-gap, nvmet needs to limit the controller mdts to how much it can allocate based on the HCA capabilities (max_fast_reg_page_list_len).Sounds good, please look at capping mdts in the mean time.guys, see my patches from adding MD support. I'm setting mdts per ctrl there. we can merge it meantime for this issue.