Skip to contentSkip to conversation

RDMA/cxgb3: fail get_dma_mr if the memory footprint can exceed 32b

PATCH In review Steve Wise 2 participants 6 messages Jul 22, 2015 – Jul 24, 2015 3 messages not in the archive InfiniBand

lore
Share & tools
lore

Steve Wise

author
#0 lore raw

PATCH 1/1 RDMA/cxgb3: fail get_dma_mr if the memory footprint can exceed 32b

T3 HW only supports MRs of length < 4GB. If the system can have more than that we need to fail dma mr allocation so we con't create a MR that cannot span the entire possible memory space.

---

 drivers/infiniband/hw/cxgb3/iwch_provider.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/infiniband/hw/cxgb3/iwch_provider.c +4 -0
index b1b7323..bbbe018 100644
@@ -736,6 +736,10 @@ static struct ib_mr *iwch_get_dma_mr(struct ib_pd *pd, int acc)
 	/*
 	 * T3 only supports 32 bits of size.
 	 */
+	if (sizeof(phys_addr_t) > 4) {
+		pr_warn_once(MOD "Cannot support dma_mrs on this platform.\n");
+		return ERR_PTR(-ENOTSUPP);
+	}
 	bl.size = 0xffffffff;
 	bl.addr = 0;
 	kva = 0;

--
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

#2 lore raw
In reply to a message not in the archive
Quoted 15 lines · Steve Wise

T3 HW only supports MRs of length < 4GB. If the system can have more than that we need to fail dma mr allocation so we con't create a MR that cannot span the entire possible memory space.

---

 drivers/infiniband/hw/cxgb3/iwch_provider.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/infiniband/hw/cxgb3/iwch_provider.c +0 -0
index b1b7323..bbbe018 100644

drivers/infiniband/hw/cxgb3/iwch_provider.c static struct ib_mr *iwch_get_dma_mr(struct ib_pd *pd, int acc) · line 745

Quoted 10 lines
drivers/infiniband/hw/cxgb3/iwch_provider.c +4 -0
@@ -736,6 +736,10 @@ static struct ib_mr *iwch_get_dma_mr(struct ib_pd *pd, int acc)
 	/*
 	 * T3 only supports 32 bits of size.
 	 */
+	if (sizeof(phys_addr_t) > 4) {
+		pr_warn_once(MOD "Cannot support dma_mrs on this platform.\n");
+		return ERR_PTR(-ENOTSUPP);
+	}
 	bl.size = 0xffffffff;
 	bl.addr = 0;
 	kva = 0;

Should this be a static check of the pointer size versus installed memory? Would it be possible to have this work for machines with less than 4GB of physical memory even if they have 64bit pointers, or are you concerned that hotplug memory could take us over the limit after registration and cause problems?

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD
author
#4 lore raw
In reply to a message not in the archive
Quoted 33 lines

-----Original Message-----
From: Doug Ledford [mailto:[email protected]]
Sent: Thursday, July 23, 2015 4:33 PM
To: Steve Wise
Cc: [email protected]
Subject: Re: [PATCH] RDMA/cxgb3: fail get_dma_mr if the memory footprint can exceed 32b

Quoted 23 lines · Steve Wise

T3 HW only supports MRs of length < 4GB. If the system can have more than that we need to fail dma mr allocation so we con't create a MR that cannot span the entire possible memory space.

---

 drivers/infiniband/hw/cxgb3/iwch_provider.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/infiniband/hw/cxgb3/iwch_provider.c +4 -0
index b1b7323..bbbe018 100644
@@ -736,6 +736,10 @@ static struct ib_mr *iwch_get_dma_mr(struct ib_pd *pd, int acc)
 	/*
 	 * T3 only supports 32 bits of size.
 	 */
+	if (sizeof(phys_addr_t) > 4) {
+		pr_warn_once(MOD "Cannot support dma_mrs on this platform.\n");
+		return ERR_PTR(-ENOTSUPP);
+	}
 	bl.size = 0xffffffff;
Quoted 8 lines

drivers/infiniband/hw/cxgb3/iwch_provider.c static struct ib_mr *iwch_get_dma_mr(struct ib_pd *pd, int acc) · line 745

Quoted 2 lines
drivers/infiniband/hw/cxgb3/iwch_provider.c +0 -0
 	bl.addr = 0;
 	kva = 0;

Should this be a static check of the pointer size versus installed memory? Would it be possible to have this work for machines with less than 4GB of physical memory even if they have 64bit pointers, or are you concerned that hotplug memory could take us over the limit after registration and cause problems?

NFSRDMA doesn't need dma-mrs for T3 since it has FRMR + local dma lkey support. And since the deficiency really can cause problems on 64b systems if the memory grows > 4GB after dma-mr allocation, I decided to just not allow them for potential large memory systems.

Steve

--
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

#5 lore raw
Quoted 11 lines · Steve Wise
Quoted 6 lines

-----Original Message----- From: Doug Ledford
Should this be a static check of the pointer size versus installed memory? Would it be possible to have this work for machines with less than 4GB of physical memory even if they have 64bit pointers, or are you concerned that hotplug memory could take us over the limit after registration and cause problems?

NFSRDMA doesn't need dma-mrs for T3 since it has FRMR + local dma lkey support. And since the deficiency really can cause problems on 64b systems if the memory grows > 4GB after dma-mr allocation, I decided to just not allow them for potential large memory systems.

Ok. I've pulled this for 4.2-rc then.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD
author
#7 lore raw
In reply to a message not in the archive
Quoted 17 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Doug Ledford
Sent: Friday, July 24, 2015 9:45 AM
To: Steve Wise
Cc: [email protected]
Subject: Re: [PATCH] RDMA/cxgb3: fail get_dma_mr if the memory footprint can exceed 32b

Quoted 7 lines · Steve Wise
Quoted 6 lines

-----Original Message----- From: Doug Ledford
Should this be a static check of the pointer size versus installed memory? Would it be possible to have this work for machines with less than 4GB of physical memory even if they have 64bit pointers, or are you concerned that hotplug memory could take us over the limit after registration and cause problems?

Quoted 7 lines
Quoted 4 lines

NFSRDMA doesn't need dma-mrs for T3 since it has FRMR + local dma lkey support. And since the deficiency really can cause problems on 64b systems if the memory grows > 4GB after dma-mr allocation, I decided to just not allow them for potential large memory systems.

Ok. I've pulled this for 4.2-rc then.

The problem has been there since day one, so it doesn't represent a regression. It is your call, but I think 4.3 is fine.

Thanks,

Steve.

--
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

#8 lore raw
Quoted 22 lines · Steve Wise
Quoted 22 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Doug Ledford
Sent: Friday, July 24, 2015 9:45 AM
To: Steve Wise
Cc: [email protected]
Subject: Re: [PATCH] RDMA/cxgb3: fail get_dma_mr if the memory footprint can exceed 32b

Quoted 11 lines · Steve Wise
Quoted 6 lines

-----Original Message----- From: Doug Ledford
Should this be a static check of the pointer size versus installed memory? Would it be possible to have this work for machines with less than 4GB of physical memory even if they have 64bit pointers, or are you concerned that hotplug memory could take us over the limit after registration and cause problems?

NFSRDMA doesn't need dma-mrs for T3 since it has FRMR + local dma lkey support. And since the deficiency really can cause problems on 64b systems if the memory grows > 4GB after dma-mr allocation, I decided to just not allow them for potential large memory systems.

Quoted 4 lines
Quoted 2 lines

Ok. I've pulled this for 4.2-rc then.

The problem has been there since day one, so it doesn't represent a regression. It is your call, but I think 4.3 is fine.

It's a long standing problem, but it's a potential memory wrap issue, so might as well fix it (especially given the simple nature of the fix). I've got a few other things heading in for 4.2-rc, so no biggie.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD