Skip to contentSkip to conversation

IB/iser: Handle lack of memory management extentions correctly

PATCH In review Mike Marciniszyn 4 participants 11 messages Jun 22, 2017 – Jul 22, 2017 6 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 IB/iser: Handle lack of memory management extentions correctly

max_fast_reg_page_list_len is only valid when the memory management extentions are signaled by the underlying driver.

Fix by adjusting iser_calc_scsi_params() to use ISCSI_ISER_MAX_SG_TABLESIZE when the extentions are not indicated.

Fixes Commit df749cdc45d9 ("IB/iser: Support up to 8MB data transfer in a single command")
---
 drivers/infiniband/ulp/iser/iser_verbs.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/iser/iser_verbs.c +8 -2
index c538a38..26a004e 100644
@@ -708,8 +708,14 @@ static void iser_connect_error(struct rdma_cm_id *cma_id)
 	unsigned short sg_tablesize, sup_sg_tablesize;
 
 	sg_tablesize = DIV_ROUND_UP(max_sectors * 512, SIZE_4K);
-	sup_sg_tablesize = min_t(unsigned, ISCSI_ISER_MAX_SG_TABLESIZE,
-				 device->ib_device->attrs.max_fast_reg_page_list_len);
+	if (device->ib_device->attrs.device_cap_flags &
+			IB_DEVICE_MEM_MGT_EXTENSIONS)
+		sup_sg_tablesize =
+			min_t(
+			 uint, ISCSI_ISER_MAX_SG_TABLESIZE,
+			 device->ib_device->attrs.max_fast_reg_page_list_len);
+	else
+		sup_sg_tablesize = ISCSI_ISER_MAX_SG_TABLESIZE;
 
 	iser_conn->scsi_sg_tablesize = min(sg_tablesize, sup_sg_tablesize);
 }

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Acked-by
#2 lore raw
In reply to a message not in the archive

Hi Mike, for the patch itself, it addresses a bug so,

But,

As for not having any max pages for FMR it's really annoying.

What do you think about exposing max_fast_reg_page_list_len to limit also for FMRs? We can also rename it to max_reg_page_list_len to get rid of the FRWR association.

Thoughts?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
In reply to a message not in the archive

PiBIaSBNaWtlLCBmb3IgdGhlIHBhdGNoIGl0c2VsZiwgaXQgYWRkcmVzc2VzIGEgYnVnIHNvLA0K PiANCj4gQWNrZWQtYnk6IFNhZ2kgR3JpbWJlcmcgPHNhZ2lAZ3JpbWJlcmcubWU+DQo+IA0KPiBC dXQsDQo+IA0KPiBBcyBmb3Igbm90IGhhdmluZyBhbnkgbWF4IHBhZ2VzIGZvciBGTVIgaXQncyBy ZWFsbHkgYW5ub3lpbmcuDQo+IA0KPiBXaGF0IGRvIHlvdSB0aGluayBhYm91dCBleHBvc2luZyBt YXhfZmFzdF9yZWdfcGFnZV9saXN0X2xlbiB0bw0KPiBsaW1pdCBhbHNvIGZvciBGTVJzPyBXZSBj YW4gYWxzbyByZW5hbWUgaXQgdG8gbWF4X3JlZ19wYWdlX2xpc3RfbGVuDQo+IHRvIGdldCByaWQg b2YgdGhlIEZSV1IgYXNzb2NpYXRpb24uDQo+IA0KPiBUaG91Z2h0cz8NCg0KSSBoYXZlIG5vIGlz c3VlIHdpdGggeW91ciBwcm9wb3NhbCwgYnV0IEkgd291bGQgcmF0aGVyIGdldCB0aGlzIGZpeGVk IGFuZCBhZGp1c3QgdGhlIEFQSSB3aXRoIGFuIGFkZGl0aW9uYWwgZml4LiAgIEkgc3VzcGVjdCB3 ZSBwcm9iYWJseSB3YW50IHRvIG1hcmsgdGhpcyBmaXggc3RhYmxlLg0KDQpJIGRpZCBhdWRpdCB0 aGUga2VybmVsIFVMUHMgZm9yIEZNUiB2cy4gRlJNUiB1c2FnZSBhbmQgdGhlIG9ubHkgb25lIHRo YXQgbG9va2VkIGF0IG1heF9mYXN0X3JlZ19wYWdlX2xpc3RfbGVuIHVuY29uZGl0aW9uYWxseSB3 YXMgaXNlci4NCg0KVGhvbWFzLCBjYW4geW91IHZlcmlmeSB0aGlzIHBhdGNoIGFuZCByZXBseSB3 aXRoIGEgVGVzdGVkLWJ5Og0KDQpNZWFud2hpbGUsIEkgd2lsbCBhdWRpdCBrZXJuZWwgcHJvdmlk ZXJzIGZvciB3aGljaCBvbmVzIGJlc2lkZXMgcWliIGRvIG5vdCBzdXBwb3J0IHRoZSBleHRlbnNp b25zIGFuZCBGTVIuDQoNCk1pa2UNCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
In reply to a message not in the archive

Hi Mike,

will take a look at it tomorrow, on which kernel version is the patch based?

Thomas

Quoted 16 lines · Mike
Quoted 6 lines

Hi Mike, for the patch itself, it addresses a bug so,

But,

Quoted 7 lines

As for not having any max pages for FMR it's really annoying.

What do you think about exposing max_fast_reg_page_list_len to limit also for FMRs? We can also rename it to max_reg_page_list_len to get rid of the FRWR association.

Thoughts?

I have no issue with your proposal, but I would rather get this fixed and adjust the API with an additional fix. I suspect we probably want to mark this fix stable.

Quoted 7 lines

I did audit the kernel ULPs for FMR vs. FRMR usage and the only one that looked at max_fast_reg_page_list_len unconditionally was iser.

Thomas, can you verify this patch and reply with a Tested-by:

Meanwhile, I will audit kernel providers for which ones besides qib do not support the extensions and FMR.

Mike

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw
In reply to a message not in the archive
Quoted 2 lines

I have no issue with your proposal, but I would rather get this fixed and adjust the API with an additional fix. I suspect we probably want to mark this fix stable.

I agree, we should get it in and fix the API incrementally.

Quoted 1 line

I did audit the kernel ULPs for FMR vs. FRMR usage and the only one that looked at max_fast_reg_page_list_len unconditionally was iser.

Correct, but it doesn't mean that others get it right.

nfs uses a hard coded value without even knowing what the device is capable of, and srp calculates it from max_mr_size which is a user-space mr capability and has nothing to do with fmrs.

So no one got it right, which is not surprising as we don't have a cap for it.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw
In reply to a message not in the archive
Quoted 38 lines · Mike Marciniszyn

max_fast_reg_page_list_len is only valid when the memory management extentions are signaled by the underlying driver.

Fix by adjusting iser_calc_scsi_params() to use ISCSI_ISER_MAX_SG_TABLESIZE when the extentions are not indicated.

Fixes Commit df749cdc45d9 ("IB/iser: Support up to 8MB data transfer in a single command")
---
 drivers/infiniband/ulp/iser/iser_verbs.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/iser/iser_verbs.c +8 -2
index c538a38..26a004e 100644
@@ -708,8 +708,14 @@ static void iser_connect_error(struct rdma_cm_id 
 *cma_id)
 	unsigned short sg_tablesize, sup_sg_tablesize;
 
 	sg_tablesize = DIV_ROUND_UP(max_sectors * 512, SIZE_4K);
-	sup_sg_tablesize = min_t(unsigned, ISCSI_ISER_MAX_SG_TABLESIZE,
-				 device->ib_device->attrs.max_fast_reg_page_list_len);
+	if (device->ib_device->attrs.device_cap_flags &
+			IB_DEVICE_MEM_MGT_EXTENSIONS)
+		sup_sg_tablesize =
+			min_t(
+			 uint, ISCSI_ISER_MAX_SG_TABLESIZE,
+			 device->ib_device->attrs.max_fast_reg_page_list_len);
+	else
+		sup_sg_tablesize = ISCSI_ISER_MAX_SG_TABLESIZE;
 
 	iser_conn->scsi_sg_tablesize = min(sg_tablesize, sup_sg_tablesize);

}

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw
In reply to a message not in the archive
Quoted 9 lines
Quoted 8 lines

As for not having any max pages for FMR it's really annoying.

What do you think about exposing max_fast_reg_page_list_len to limit also for FMRs? We can also rename it to max_reg_page_list_len to get rid of the FRWR association.

Thoughts?

Quoted 7 lines

I have no issue with your proposal, but I would rather get this fixed and adjust the API with an additional fix. I suspect we probably want to mark this fix stable.

I did audit the kernel ULPs for FMR vs. FRMR usage and the only one that looked at max_fast_reg_page_list_len unconditionally was iser.

Thomas, can you verify this patch and reply with a Tested-by:

Meanwhile, I will audit kernel providers for which ones besides qib do not support the extensions and FMR.

So what is the page_list limitation for qib? I want to prepare some patches... --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw
In reply to a message not in the archive

PiBTdWJqZWN0OiBSZTogW1BBVENIXSBJQi9pc2VyOiBIYW5kbGUgbGFjayBvZiBtZW1vcnkgbWFu YWdlbWVudA0KPiBleHRlbnRpb25zIGNvcnJlY3RseQ0KPiANCj4gPiBTbyB3aGF0IGlzIHRoZSBw YWdlX2xpc3QgbGltaXRhdGlvbiBmb3IgcWliPyBJIHdhbnQgdG8gcHJlcGFyZSBzb21lDQo+ID4g cGF0Y2hlcy4uLg0KPiANCg0KU29ycnksIHN0aWxsIGNhdGNoaW5nIHVwIGFmdGVyIGEgZmV3IGRh eXMgb2ZmLg0KDQpJIHdvdWxkIHN1Z2dlc3QgVUlOVF9NQVggd2hpY2ggbWF0Y2hlcyBoZmkxIHJl Z2lzdHJhdGlvbiBmb3IgZmFzdCByZWcgbm93Lg0KDQpNaWtlDQoNCg0KDQoNCg0KDQo= --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw
In reply to a message not in the archive
Quoted 11 lines · Mike Marciniszyn

max_fast_reg_page_list_len is only valid when the memory management extentions are signaled by the underlying driver.

Fix by adjusting iser_calc_scsi_params() to use ISCSI_ISER_MAX_SG_TABLESIZE when the extentions are not indicated.

Fixes Commit df749cdc45d9 ("IB/iser: Support up to 8MB data transfer in a single command")

This was accepted in 4.13-rc, thanks.

Signature · 3 lines
Doug Ledford <[email protected]>
    GPG Key ID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD