nvme : add Scatter-Gather List (SGL) support in NVMe driver.
Hi,
Following patch adds the SGL support in the NVMe driver. We observed approximately 5% performance improvement in the IOPs, bandwidth, and latency as block size gets larger ( >= 32k).
In the current implementation, we add "sgl_threshold" module parameter to decide whether to use SGL or PRP for IO requests, we set the default value for sgl_threshold to 32k. This value is exported and configurable via sysfs.
Regards,
-Chaitanya
[PATCH] nvme : add Scatter-Gather List (SGL) support in NVMe driver.
PATCH 1/1 nvme : add Scatter-Gather List (SGL) support in NVMe driver.
This adds SGL support for NVMe PCIe driver which is reimplementation of the initial version provided by Rajiv Shanmugam Madeswaran(smrajiv15 at gmail.com):- "block: nvme-core: Scatter gather list support in the NVMe Block Driver".
In order to enable SGL mode for the driver, the user can set the sgl_threshold module parameter. This parameter can be used in the two modes:-
1. Allow all IOs to use SGL mode. (set sgl_threshold to 1).
2. Set up the IO size threshold to determine whether to use SGLs or PRPs for each IO. (set sgl_threshold to 4096 to use SGL only for IOs which are >= 4096 in the size).
--- drivers/nvme/host/pci.c | 232 ++++++++++++++++++++++++++++++++++++++++++++---- include/linux/nvme.h | 2 + 2 files changed, 217 insertions(+), 17 deletions(-)
drivers/nvme/host/pci.c +215 -17
@@ -26,6 +26,7 @@#include <linux/mutex.h> #include <linux/pci.h> #include <linux/poison.h> +#include <linux/scatterlist.h> #include <linux/t10-pi.h> #include <linux/timer.h> #include <linux/types.h>
@@ -56,6 +57,10 @@ module_param(max_host_mem_size_mb, uint, 0444);MODULE_PARM_DESC (max_host_mem_size_mb,"Maximum Host Memory Buffer (HMB) size per controller (in MiB)" ); +static unsigned int sgl_threshold =32 *1024 ; +module_param (sgl_threshold, uint,0644 ); +MODULE_PARM_DESC (sgl_threshold,"use SGL for I/O SQes" ); +static int io_queue_depth_set (const char *val,const struct kernel_param *kp);static const struct kernel_param_ops io_queue_depth_ops = { .set = io_queue_depth_set,
@@ -113,6 +118,15 @@ struct nvme_dev {void **host_mem_desc_bufs; }; +/* move this to right place */ +static inline void put_unaligned_le24 (u32 val,u8 *p) +{ + *p++ = val; + *p++ = val >>8 ; + *p++ = val >>16 ; +} + +static int io_queue_depth_set (const char *val,const struct kernel_param *kp) {int n =0 , ret;
@@ -176,6 +190,7 @@ struct nvme_queue {struct nvme_iod {struct nvme_request req;struct nvme_queue *nvmeq; +int sgl_threshold;int aborted;int npages;/* In the PRP list. 0 means small pool in use */ int nents;/* Used in scatterlist */
@@ -329,17 +344,32 @@ static int nvme_npages(unsigned size, struct nvme_dev *dev)return DIV_ROUND_UP (8 * nprps,PAGE_SIZE -8 ); } +/* calculates the number of pages needed for framing the +* SGL segments. for ex: 4k page can accommodate 256 SGL descriptors +*/ +static int nvme_npages_sgl (unsigned int num_seg) +{ +return DIV_ROUND_UP (num_seg *16 ,PAGE_SIZE ); +} +static unsigned int nvme_iod_alloc_size (struct nvme_dev *dev, -unsigned int size,unsigned int nseg) +unsigned int size,unsigned int nseg,bool sgl_threshold) { -return sizeof (__le64 *) *nvme_npages (size, dev) + -sizeof (struct scatterlist ) * nseg; +size_t alloc_size; + +if (sgl_threshold) + alloc_size =sizeof (__le64 *) *nvme_npages_sgl (nseg); +else + alloc_size =sizeof (__le64 *) *nvme_npages (size, dev); + +return alloc_size +sizeof (struct scatterlist ) * nseg; } -static unsigned int nvme_cmd_size (struct nvme_dev *dev) +static unsigned int nvme_cmd_size (struct nvme_dev *dev,bool sgl_threshold) {return sizeof (struct nvme_iod ) + -nvme_iod_alloc_size (dev,NVME_INT_BYTES (dev),NVME_INT_PAGES ); +nvme_iod_alloc_size (dev,NVME_INT_BYTES (dev),NVME_INT_PAGES , + sgl_threshold); } static int nvme_admin_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
@@ -436,9 +466,11 @@ static blk_status_t nvme_init_iod(struct request *rq, struct nvme_dev *dev)unsigned int size =blk_rq_payload_bytes (rq);if (nseg >NVME_INT_PAGES || size >NVME_INT_BYTES (dev)) { - iod->sg =kmalloc (nvme_iod_alloc_size (dev, size, nseg),GFP_ATOMIC ); -if (!iod->sg) -return BLK_STS_RESOURCE ; +size_t alloc_size; + + alloc_size =nvme_iod_alloc_size (dev, size, nseg, + iod->sgl_threshold); + iod->sg =kmalloc (alloc_size,GFP_ATOMIC ); }else { iod->sg = iod->inline_sg; }
@@ -451,6 +483,32 @@ static blk_status_t nvme_init_iod(struct request *rq, struct nvme_dev *dev)return BLK_STS_OK ; } +static void nvme_free_iod_sgl (struct nvme_dev *dev,struct request *req) +{ +int i; +int last_entry; +__le64 **list =iod_list (req); +dma_addr_t sgl_dma, next_sgl_dma; +struct nvme_iod *iod =blk_mq_rq_to_pdu (req); + + sgl_dma = iod->first_dma; +if (iod->npages ==0 ) +dma_pool_free (dev->prp_small_pool, list[0 ], sgl_dma); + + last_entry =PAGE_SIZE /16 -1 ; +for (i =0 ; i < iod->npages; i++) { +struct nvme_sgl_desc *sg_list = (struct nvme_sgl_desc *)list[i]; + + next_sgl_dma =le64_to_cpu ((sg_list[last_entry]).addr); +dma_pool_free (dev->prp_page_pool, sg_list, sgl_dma); + sgl_dma = next_sgl_dma; + } + +if (iod->sg != iod->inline_sg) +kfree (iod->sg); +} + +static void nvme_free_iod (struct nvme_dev *dev,struct request *req) {struct nvme_iod *iod =blk_mq_rq_to_pdu (req);
@@ -459,6 +517,11 @@ static void nvme_free_iod(struct nvme_dev *dev, struct request *req)__le64 **list =iod_list (req);dma_addr_t prp_dma = iod->first_dma; +if (iod->sgl_threshold) { +nvme_free_iod_sgl (dev, req); +return ; + } +if (iod->npages ==0 )dma_pool_free (dev->prp_small_pool, list[0 ], prp_dma);for (i =0 ; i < iod->npages; i++) {
@@ -539,7 +602,8 @@ static void nvme_dif_complete(u32 p, u32 v, struct t10_pi_tuple *pi) }#endif -static bool nvme_setup_prps (struct nvme_dev *dev,struct request *req) +static bool nvme_setup_prps (struct nvme_dev *dev,struct request *req, +int total_len,struct nvme_rw_command *cmnd) {struct nvme_iod *iod =blk_mq_rq_to_pdu (req);struct dma_pool *pool;
@@ -554,9 +618,12 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req)dma_addr_t prp_dma;int nprps, i; +/* check if pre-zeroed, then not needed */ + iod->sgl_threshold = false; + length -= (page_size - offset);if (length <=0 ) -return true; + goto out; dma_len -= (page_size - offset);if (dma_len) {
@@ -569,7 +636,7 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req)if (length <= page_size) { iod->first_dma = dma_addr; -return true; + goto out; } nprps =DIV_ROUND_UP (length, page_size);
@@ -615,6 +682,128 @@ static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req) dma_len =sg_dma_len (sg); } +out: + cmnd->dptr.prp1 =cpu_to_le64 (sg_dma_address (iod->sg)); + cmnd->dptr.prp2 =cpu_to_le64 (iod->first_dma); + +return true; +} + +/* frames NVMe specific SGL's for data transfer */ +static bool nvme_setup_sgls (struct nvme_dev *dev,struct request *req, +int total_len,struct nvme_rw_command *cmd) +{ +struct nvme_iod *iod =blk_mq_rq_to_pdu (req); +struct dma_pool *pool; +struct nvme_sgl_desc *sg_list; +dma_addr_t sgl_dma; +int i; +int length = total_len; +struct scatterlist *sg = iod->sg; +__le64 **list =iod_list (req); +int num_entries = iod->nents; +int entry = (PAGE_SIZE /16 ) -1 ; +struct nvme_sgl_desc *sg_seg; + + iod->sgl_threshold = true; + + cmd->flags =1 <<6 ;/* setting the transfer type as SGL */ + +if (total_len ==sg_dma_len (sg)) { + cmd->dptr.sgl.addr =cpu_to_le64 (sg_dma_address (sg)); + cmd->dptr.sgl.type |=NVME_SGL_FMT_DATA_DESC <<4 ; + cmd->dptr.sgl.length =cpu_to_le32 (sg_dma_len (sg)); +return true; + } + +if (num_entries <= (256 /16 )) { + pool = dev->prp_small_pool; + iod->npages =0 ; + }else { + pool = dev->prp_page_pool; + iod->npages =1 ; + } + + sg_list = (struct nvme_sgl_desc *) +dma_pool_alloc (pool,GFP_ATOMIC , &sgl_dma); + +if (!sg_list) { + cmd->dptr.sgl.addr =cpu_to_le64 (sg_dma_address (sg)); + cmd->dptr.sgl.type |=NVME_SGL_FMT_DATA_DESC <<4 ; + cmd->dptr.sgl.length =cpu_to_le32 (sg_dma_len (sg)); + length -=sg_dma_len (sg); +return false; + } + + list[0 ] = (__le64 *)sg_list; + iod->first_dma = sgl_dma; + +if (num_entries <= (PAGE_SIZE /16 )) { + cmd->dptr.sgl.addr =cpu_to_le64 (sgl_dma); + cmd->dptr.sgl.length =cpu_to_le32 (num_entries *16 ); + cmd->dptr.sgl.type |=NVME_SGL_FMT_LAST_SEG_DESC <<4 ; +for (i =0 ; i < num_entries; i++) { + sg_list[i].addr =cpu_to_le64 (sg_dma_address (sg)); + sg_list[i].length =cpu_to_le32 (sg_dma_len (sg)); + sg_list[i].type |=NVME_SGL_FMT_DATA_DESC <<4 ; + length -=sg_dma_len (sg); + sg =sg_next (sg); + } + +WARN_ON (length >0 ); +return true; + } + cmd->dptr.sgl.addr =cpu_to_le64 (sgl_dma); + cmd->dptr.sgl.length =cpu_to_le32 (PAGE_SIZE ); + cmd->dptr.sgl.type |=NVME_SGL_FMT_SEG_DESC <<4 ; + i =0 ; +for (;;) { +if (i ==PAGE_SIZE /16 ) { +struct nvme_sgl_desc *old_sg_desc = sg_list; + + sg_list =dma_pool_alloc (pool,GFP_ATOMIC , &sgl_dma); +if (!sg_list) { +if (iod->npages ==1 ) { + cmd->dptr.sgl.type |= +NVME_SGL_FMT_LAST_SEG_DESC <<4 ; + }else { +int page = iod->npages -2 ; + + sg_seg = (struct nvme_sgl_desc *) + list[page]; + sg_seg[entry].type |= +NVME_SGL_FMT_LAST_SEG_DESC <<4 ; + } +return false; + } + list[iod->npages++] = (__le64 *)sg_list; + sg_list[0 ] = old_sg_desc[i -1 ]; + old_sg_desc[i -1 ].addr =cpu_to_le64 (sgl_dma); + +if (num_entries < (PAGE_SIZE /16 )) { + old_sg_desc[i -1 ].length = +cpu_to_le32 (num_entries *16 ); + old_sg_desc[i -1 ].type |= +NVME_SGL_FMT_LAST_SEG_DESC <<4 ; + }else { + old_sg_desc[i -1 ].length = +cpu_to_le32 (PAGE_SIZE ); + old_sg_desc[i -1 ].type |= +NVME_SGL_FMT_SEG_DESC <<4 ; + } + i =1 ; + } + + sg_list[i].addr =cpu_to_le64 (sg_dma_address (sg)); + sg_list[i].length =cpu_to_le32 (sg_dma_len (sg)); + sg_list[i++].type |=NVME_SGL_FMT_DATA_DESC <<4 ; + length -=sg_dma_len (sg); + sg =sg_next (sg); + num_entries--; +if (length <=0 ) +break ; + } +WARN_ON (num_entries >0 );return true; }
@@ -626,6 +815,7 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,enum dma_data_direction dma_dir =rq_data_dir (req) ?DMA_TO_DEVICE :DMA_FROM_DEVICE ;blk_status_t ret =BLK_STS_IOERR ; +unsigned int size =blk_rq_bytes (req);sg_init_table (iod->sg,blk_rq_nr_phys_segments (req)); iod->nents =blk_rq_map_sg (q, req, iod->sg);
@@ -637,8 +827,14 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req, DMA_ATTR_NO_WARN)) goto out; -if (!nvme_setup_prps (dev, req)) - goto out_unmap; +if (sgl_threshold && size >= sgl_threshold && +NVME_CTRL_SUPP_SGL (dev->ctrl.sgls) && iod->nvmeq->qid) { +if (!nvme_setup_sgls (dev, req, size, &cmnd->rw)) + goto out_unmap; + }else { +if (!nvme_setup_prps (dev, req, size, &cmnd->rw)) + goto out_unmap; + } ret =BLK_STS_IOERR ;if (blk_integrity_rq (req)) {
@@ -656,8 +852,6 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req, goto out_unmap; } - cmnd->rw.dptr.prp1 =cpu_to_le64 (sg_dma_address (iod->sg)); - cmnd->rw.dptr.prp2 =cpu_to_le64 (iod->first_dma);if (blk_integrity_rq (req)) cmnd->rw.metadata =cpu_to_le64 (sg_dma_address (&iod->meta_sg));return BLK_STS_OK ;
@@ -1354,7 +1548,7 @@ static int nvme_alloc_admin_tags(struct nvme_dev *dev) dev->admin_tagset.queue_depth =NVME_AQ_BLKMQ_DEPTH -1 ; dev->admin_tagset.timeout =ADMIN_TIMEOUT ; dev->admin_tagset.numa_node =dev_to_node (dev->dev); - dev->admin_tagset.cmd_size =nvme_cmd_size (dev); + dev->admin_tagset.cmd_size =nvme_cmd_size (dev, false); dev->admin_tagset.flags =BLK_MQ_F_NO_SCHED ; dev->admin_tagset.driver_data = dev;
@@ -1863,7 +2057,11 @@ static int nvme_dev_add(struct nvme_dev *dev) dev->tagset.numa_node =dev_to_node (dev->dev); dev->tagset.queue_depth =min_t (int, dev->q_depth,BLK_MQ_MAX_DEPTH ) -1 ; - dev->tagset.cmd_size =nvme_cmd_size (dev); + dev->tagset.cmd_size =nvme_cmd_size (dev, false); +if (sgl_threshold &&NVME_CTRL_SUPP_SGL (dev->ctrl.sgls)) { + dev->tagset.cmd_size =max (dev->tagset.cmd_size, +nvme_cmd_size (dev, true)); + } dev->tagset.flags =BLK_MQ_F_SHOULD_MERGE ; dev->tagset.driver_data = dev;
include/linux/nvme.h +2 -0
@@ -446,6 +446,8 @@ enum nvme_opcode { nvme_cmd_resv_release = 0x15, }; +#define NVME_CTRL_SUPP_SGL (sgls) (sgls & 1) +/* * Descriptor subtype - lower 4 bits of nvme_(keyed_)sgl_desc identifier *
Signature · 1 line
2.7.4
PATCH 1/1 nvme : add Scatter-Gather List (SGL) support in NVMe driver.
Quoted 6 lines · Chaitanya Kulkarni
This adds SGL support for NVMe PCIe driver which is reimplementation of the initial version provided by Rajiv Shanmugam Madeswaran(smrajiv15 at gmail.com):- "block: nvme-core: Scatter gather list support in the NVMe Block Driver".
Quoted 8 lines
In order to enable SGL mode for the driver, the user can set the
sgl_thresholdmodule parameter. This parameter can be used in the two modes:-1. Allow all IOs to use SGL mode. (set
sgl_thresholdto 1).
2. Set up the IO size threshold to determine whether to use SGLs or PRPs for each IO. (setsgl_thresholdto 4096 to use SGL only for IOs which are >= 4096 in the size).
For this to really make a difference, you should clear blk_queue_virt_boundary for SGL capable devices.
PATCH 1/1 nvme : add Scatter-Gather List (SGL) support in NVMe driver.
Thanks for the feedback Keith, I'll look into this.
I posted the new version today, please let me know if you have any other comments on the new code.
Regards,
-Chaitanya
Quoted 23 lines · Keith Busch
Quoted 6 lines · Chaitanya Kulkarni
This adds SGL support for NVMe PCIe driver which is reimplementation of the initial version provided by Rajiv Shanmugam Madeswaran(smrajiv15 at gmail.com):- "block: nvme-core: Scatter gather list support in the NVMe Block Driver".
Quoted 8 lines
In order to enable SGL mode for the driver, the user can set the
sgl_thresholdmodule parameter. This parameter can be used in the two modes:-1. Allow all IOs to use SGL mode. (set
sgl_thresholdto 1).
2. Set up the IO size threshold to determine whether to use SGLs or PRPs for each IO. (setsgl_thresholdto 4096 to use SGL only for IOs which are >= 4096 in the size).For this to really make a difference, you should clear
blk_queue_virt_boundaryfor SGL capable devices._______________________________________________
Linux-nvme mailing list
Linux-nvme at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
PATCH 1/1 nvme : add Scatter-Gather List (SGL) support in NVMe driver.
In reply to Keith BuschQuoted 6 lines · Keith Busch
Quoted 3 lines
2. Set up the IO size threshold to determine whether to use SGLs or PRPs for each IO. (set
sgl_thresholdto 4096 to use SGL only for IOs which are >= 4096 in the size).For this to really make a difference, you should clear
blk_queue_virt_boundaryfor SGL capable devices.
SGLs make sense for bigger I/O alone. But not having to set the blk_queue_virt_boundary would be another benefit, Although you'll probably need a 64k page size system for that to matter in practice.
I remember Max had a patch for fabrics to support the Mellanox arbitrary SGL registrations, which should share some core code with allowing that for PCIe with SGLs.
Max, what happened to that?
PATCH 1/1 nvme : add Scatter-Gather List (SGL) support in NVMe driver.
Quoted 12 lines · Christoph Hellwig
Quoted 6 lines · Keith Busch
Quoted 3 lines
2. Set up the IO size threshold to determine whether to use SGLs or PRPs for each IO. (set
sgl_thresholdto 4096 to use SGL only for IOs which are >= 4096 in the size).For this to really make a difference, you should clear
blk_queue_virt_boundaryfor SGL capable devices.SGLs make sense for bigger I/O alone. But not having to set the
blk_queue_virt_boundarywould be another benefit, Although you'll probably need a 64k page size system for that to matter in practice.
Quoted 6 lines
I remember Max had a patch for fabrics to support the Mellanox arbitrary SGL registrations, which should share some core code with allowing that for PCIe with SGLs.
Max, what happened to that?
Actually this series was reviwed but because of a bug that was repro with sg_gaps MR type we decided to put this on hold until we figure this out. I couldn't repro the SRP issue in my lab and only Laurence did it with his setup but we couldn't find the root cause yet. We are using this mr type in upstream iser and also in our SRP driver in MLNX_OFED without issues so we can think of re-submiting it.
Regarding the core code, I guess I can send a patch for Chaitanya to embed in his patchset for the SGL support, agreed ?
PATCH 1/1 nvme : add Scatter-Gather List (SGL) support in NVMe driver.
Hi Max,
Is this the correct patch you mentioned in earlier email :- https://www.spinics.net/lists/linux-rdma/msg48612.html ?
In case if not can you please send the core code patch?
I'll give it a try, so it will be easy if we decide to have it integrated with current SGL patch.
-Regards,
Chaitanya
-----Original Message-----
From: Max Gurtovoy [mailto:[email protected]]
Sent: Sunday, July 16, 2017 5:01 PM
To: Christoph Hellwig <hch at infradead.org>; Keith Busch <keith.busch at intel.com>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni at wdc.com>; linux-nvme at lists.infradead.org
Subject: Re: [PATCH] nvme : add Scatter-Gather List (SGL) support in NVMe driver.
Quoted 12 lines · Christoph Hellwig
Quoted 6 lines · Keith Busch
Quoted 3 lines
2. Set up the IO size threshold to determine whether to use SGLs or PRPs for each IO. (set
sgl_thresholdto 4096 to use SGL only for IOs which are >= 4096 in the size).For this to really make a difference, you should clear
blk_queue_virt_boundaryfor SGL capable devices.SGLs make sense for bigger I/O alone. But not having to set the
blk_queue_virt_boundarywould be another benefit, Although you'll probably need a 64k page size system for that to matter in practice.
Quoted 6 lines
I remember Max had a patch for fabrics to support the Mellanox arbitrary SGL registrations, which should share some core code with allowing that for PCIe with SGLs.
Max, what happened to that?
Actually this series was reviwed but because of a bug that was repro with sg_gaps MR type we decided to put this on hold until we figure this out. I couldn't repro the SRP issue in my lab and only Laurence did it with his setup but we couldn't find the root cause yet. We are using this mr type in upstream iser and also in our SRP driver in MLNX_OFED without issues so we can think of re-submiting it. Regarding the core code, I guess I can send a patch for Chaitanya to embed in his patchset for the SGL support, agreed ?
PATCH 1/1 nvme : add Scatter-Gather List (SGL) support in NVMe driver.
Hi Chaitanya,
Quoted 5 lines · Chaitanya Kulkarni
Hi Max,
Is this the correct patch you mentioned in earlier email :- https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.spinics.net%2Flists%2Flinux-rdma%2Fmsg48612.html&data=02%7C01%7Cmaxg%40mellanox.com%7C40a4add8efd44d99194008d4cd56b5e8%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636359219705908501&sdata=%2B7W6wsCDUtkz2JlcKXphVZjQBsy9WnlwlRQvctkGqJI%3D&reserved=0 ?
In case if not can you please send the core code patch?
Yes, this is the patch I'm talking about.
See Sagi's comment regarding the virt_boundary.
Would you like me to send you an updated version for the core with ctrl->virt_boundary instead of ctrl->sg_gaps_support ?
Quoted 39 lines
I'll give it a try, so it will be easy if we decide to have it integrated with current SGL patch.
-Regards,
Chaitanya-----Original Message-----
From: Max Gurtovoy [mailto:maxg at mellanox.com]
Sent: Sunday, July 16, 2017 5:01 PM
To: Christoph Hellwig <hch at infradead.org>; Keith Busch <keith.busch at intel.com>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni at wdc.com>; linux-nvme at lists.infradead.org
Subject: Re: [PATCH] nvme : add Scatter-Gather List (SGL) support in NVMe driver.Quoted 12 lines · Christoph Hellwig
Quoted 6 lines · Keith Busch
Quoted 3 lines
2. Set up the IO size threshold to determine whether to use SGLs or PRPs for each IO. (set
sgl_thresholdto 4096 to use SGL only for IOs which are >= 4096 in the size).For this to really make a difference, you should clear
blk_queue_virt_boundaryfor SGL capable devices.SGLs make sense for bigger I/O alone. But not having to set the
blk_queue_virt_boundarywould be another benefit, Although you'll probably need a 64k page size system for that to matter in practice.Quoted 6 lines
I remember Max had a patch for fabrics to support the Mellanox arbitrary SGL registrations, which should share some core code with allowing that for PCIe with SGLs.
Max, what happened to that?
Actually this series was reviwed but because of a bug that was repro with
sg_gapsMR type we decided to put this on hold until we figure this out. I couldn't repro the SRP issue in my lab and only Laurence did it with his setup but we couldn't find the root cause yet. We are using this mr type in upstream iser and also in our SRP driver inMLNX_OFEDwithout issues so we can think of re-submiting it. Regarding the core code, I guess I can send a patch for Chaitanya to embed in his patchset for the SGL support, agreed ?
PATCH 1/1 nvme : add Scatter-Gather List (SGL) support in NVMe driver.
In reply to Chaitanya KulkarniHi Chaitanya,
Quoted 5 lines · Chaitanya Kulkarni
Hi Max,
Is this the correct patch you mentioned in earlier email :- https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.spinics.net%2Flists%2Flinux-rdma%2Fmsg48612.html&data=02%7C01%7Cmaxg%40mellanox.com%7C40a4add8efd44d99194008d4cd56b5e8%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636359219705908501&sdata=%2B7W6wsCDUtkz2JlcKXphVZjQBsy9WnlwlRQvctkGqJI%3D&reserved=0 ?
In case if not can you please send the core code patch?
Yes, this is the patch I'm talking about.
See Sagi's comment regarding the virt_boundary.
Would you like me to send you an updated version for the core with ctrl->virt_boundary instead of ctrl->sg_gaps_support ?
Quoted 39 lines
I'll give it a try, so it will be easy if we decide to have it integrated with current SGL patch.
-Regards,
Chaitanya-----Original Message-----
From: Max Gurtovoy [mailto:maxg at mellanox.com]
Sent: Sunday, July 16, 2017 5:01 PM
To: Christoph Hellwig <hch at infradead.org>; Keith Busch <keith.busch at intel.com>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni at wdc.com>; linux-nvme at lists.infradead.org
Subject: Re: [PATCH] nvme : add Scatter-Gather List (SGL) support in NVMe driver.Quoted 12 lines · Christoph Hellwig
Quoted 6 lines · Keith Busch
Quoted 3 lines
2. Set up the IO size threshold to determine whether to use SGLs or PRPs for each IO. (set
sgl_thresholdto 4096 to use SGL only for IOs which are >= 4096 in the size).For this to really make a difference, you should clear
blk_queue_virt_boundaryfor SGL capable devices.SGLs make sense for bigger I/O alone. But not having to set the
blk_queue_virt_boundarywould be another benefit, Although you'll probably need a 64k page size system for that to matter in practice.Quoted 6 lines
I remember Max had a patch for fabrics to support the Mellanox arbitrary SGL registrations, which should share some core code with allowing that for PCIe with SGLs.
Max, what happened to that?
Actually this series was reviwed but because of a bug that was repro with
sg_gapsMR type we decided to put this on hold until we figure this out. I couldn't repro the SRP issue in my lab and only Laurence did it with his setup but we couldn't find the root cause yet. We are using this mr type in upstream iser and also in our SRP driver inMLNX_OFEDwithout issues so we can think of re-submiting it. Regarding the core code, I guess I can send a patch for Chaitanya to embed in his patchset for the SGL support, agreed ?