Skip to contentSkip to conversation

infiniband: few MTRR fixes and conversions

PATCH Superseded Luis R. Rodriguez 4 participants 9 messages Apr 21, 2015

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover infiniband: few MTRR fixes and conversions

From: "Luis R. Rodriguez" <[email protected]>

Infiniband has a few MTRR uses which from the looks of it was first written on the ipath driver, later copied and pasted on the qib driver. The behaviour of not counting is matched on both drivers but with no good reason, since we want to generalize use of MTRR in order to actually phase it, fix the driver to use accounting as all other kernel users and also convert the qib driver to arch_phys_wc_add().

The ipath driver is left without conversion to arch_phys_wc_add().

Luis R. Rodriguez (3):
IB/qib: add acounting for MTRR
IB/qib: use arch_phys_wc_add()
IB/ipath: add counting for MTRR

 drivers/infiniband/hw/ipath/ipath_wc_x86_64.c |  2 +-
 drivers/infiniband/hw/qib/qib_wc_x86_64.c     | 31 ++++-----------------------
 2 files changed, 5 insertions(+), 28 deletions(-)
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#1 lore raw

PATCH v3 1/3 IB/qib: add acounting for MTRR

From: "Luis R. Rodriguez" <[email protected]>

There is no good reason not to, we eventually delete it as well.

Cc Toshi Kani <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc Mike Marciniszyn <[email protected]>
Cc Roland Dreier <[email protected]>
Cc Sean Hefty <[email protected]>
Cc Hal Rosenstock <[email protected]>
Cc linux-rdma at vger.kernel.org
Cc linux-fbdev at vger.kernel.org
Cc linux-kernel at vger.kernel.org
---
 drivers/infiniband/hw/qib/qib_wc_x86_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/qib/qib_wc_x86_64.c +1 -1
index 81b225f..fe0850a 100644
@@ -118,7 +118,7 @@ int qib_enable_wc(struct qib_devdata *dd)
 	if (!ret) {
 		int cookie;
 
-		cookie = mtrr_add(pioaddr, piolen, MTRR_TYPE_WRCOMB, 0);
+		cookie = mtrr_add(pioaddr, piolen, MTRR_TYPE_WRCOMB, 1);
 		if (cookie < 0) {
 			{
 				qib_devinfo(dd->pcidev,
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#2 lore raw

PATCH v3 2/3 IB/qib: use arch_phys_wc_add()

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This driver already makes use of ioremap_wc() on PIO buffers, so convert it to use arch_phys_wc_add().

Cc Toshi Kani <[email protected]>
Cc Rickard Strandqvist <[email protected]>
Cc Mike Marciniszyn <[email protected]>
Cc Roland Dreier <[email protected]>
Cc Sean Hefty <[email protected]>
Cc Hal Rosenstock <[email protected]>
Cc Dennis Dalessandro <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Stefan Bader <[email protected]>
Cc konrad.wilk at oracle.com
Cc ville.syrjala at linux.intel.com
Cc david.vrabel at citrix.com
Cc jbeulich at suse.com
Cc Roger Pau Monn? <[email protected]>
Cc infinipath at intel.com
Cc linux-rdma at vger.kernel.org
Cc linux-fbdev at vger.kernel.org
Cc linux-kernel at vger.kernel.org
Cc xen-devel at lists.xensource.com
---
 drivers/infiniband/hw/qib/qib_wc_x86_64.c | 31 ++++---------------------------
 1 file changed, 4 insertions(+), 27 deletions(-)
drivers/infiniband/hw/qib/qib_wc_x86_64.c +4 -27
index fe0850a..6d61ef9 100644
@@ -116,21 +116,9 @@ int qib_enable_wc(struct qib_devdata *dd)
 	}
 
 	if (!ret) {
-		int cookie;
-
-		cookie = mtrr_add(pioaddr, piolen, MTRR_TYPE_WRCOMB, 1);
-		if (cookie < 0) {
-			{
-				qib_devinfo(dd->pcidev,
-					 "mtrr_add()  WC for PIO bufs failed (%d)\n",
-					 cookie);
-				ret = -EINVAL;
-			}
-		} else {
-			dd->wc_cookie = cookie;
-			dd->wc_base = (unsigned long) pioaddr;
-			dd->wc_len = (unsigned long) piolen;
-		}
+		dd->wc_cookie = arch_phys_wc_add(pioaddr, piolen);
+		if (dd->wc_cookie < 0)
+			ret = -EINVAL;
 	}
 
 	return ret;
@@ -142,18 +130,7 @@ int qib_enable_wc(struct qib_devdata *dd)
  */
 void qib_disable_wc(struct qib_devdata *dd)
 {
-	if (dd->wc_cookie) {
-		int r;
-
-		r = mtrr_del(dd->wc_cookie, dd->wc_base,
-			     dd->wc_len);
-		if (r < 0)
-			qib_devinfo(dd->pcidev,
-				 "mtrr_del(%lx, %lx, %lx) failed: %d\n",
-				 dd->wc_cookie, dd->wc_base,
-				 dd->wc_len, r);
-		dd->wc_cookie = 0; /* even on failure */
-	}
+	arch_phys_wc_del(dd->wc_cookie);
 }
 
 /**
Signature · 1 line
2.3.2.209.gd67f9d5.dirty
#3 lore raw

Re: [PATCH v3 2/3] IB/qib: use arch_phys_wc_add()

Quoted 4 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This driver already makes use of ioremap_wc() on PIO buffers, so convert it to use arch_phys_wc_add().

This is probably OK, but I think you should also remove the qib_wc_pat module parameter.

Jason

#4 lore raw

RE: [PATCH v3 2/3] IB/qib: use arch_phys_wc_add()

Quoted 7 lines
Quoted 2 lines

This driver already makes use of ioremap_wc() on PIO buffers, so convert it to use arch_phys_wc_add().

This is probably OK, but I think you should also remove the qib_wc_pat module parameter.

Jason

Revise based on Jason's request and I will do some testing.

Mike

#5 lore raw

Re: [PATCH v3 2/3] IB/qib: use arch_phys_wc_add()

Quoted 9 lines · Mike
Quoted 7 lines
Quoted 2 lines

This driver already makes use of ioremap_wc() on PIO buffers, so convert it to use arch_phys_wc_add().

This is probably OK, but I think you should also remove the qib_wc_pat module parameter.

Jason

Revise based on Jason's request and I will do some testing.

I did thiink about this -- but removal of module parameters can often times break users of the module parameter, I figured its best to leave it to you guys to decide what to do with that, so this leaves it as a no-op. Can this series be applied and then you can decide what to do to not affect your users on top of this?

Luis

#6 lore raw

Re: [PATCH v3 2/3] IB/qib: use arch_phys_wc_add()

Quoted 10 lines · Luis R. Rodriguez
Quoted 8 lines · Mike
Quoted 7 lines
Quoted 2 lines

This driver already makes use of ioremap_wc() on PIO buffers, so convert it to use arch_phys_wc_add().

This is probably OK, but I think you should also remove the qib_wc_pat module parameter.

Jason

Quoted 7 lines
Quoted 1 line

Revise based on Jason's request and I will do some testing.

I did thiink about this -- but removal of module parameters can often times break users of the module parameter, I figured its best to leave it to you guys to decide what to do with that, so this leaves it as a no-op. Can this series be applied and then you can decide what to do to not affect your users on top of this?

As of a few kernel versions ago, unrecognized module parameters no longer cause the module to refuse to load.

--Andy

Quoted 2 lines

Luis

Signature · 2 lines
Andy Lutomirski
AMA Capital Management, LLC
#7 lore raw

Re: [PATCH v3 2/3] IB/qib: use arch_phys_wc_add()

Quoted 14 lines · Andy Lutomirski
Quoted 12 lines · Luis R. Rodriguez
Quoted 9 lines · Mike
Quoted 7 lines
Quoted 2 lines

This driver already makes use of ioremap_wc() on PIO buffers, so convert it to use arch_phys_wc_add().

This is probably OK, but I think you should also remove the qib_wc_pat module parameter.

Jason

Revise based on Jason's request and I will do some testing.

Quoted 8 lines
Quoted 5 lines

I did thiink about this -- but removal of module parameters can often times break users of the module parameter, I figured its best to leave it to you guys to decide what to do with that, so this leaves it as a no-op. Can this series be applied and then you can decide what to do to not affect your users on top of this?

As of a few kernel versions ago, unrecognized module parameters no longer cause the module to refuse to load.

Sexy, I'll respin the changes only to the qib driver. Can the changes to ipath still be applied?

Luis

#8 lore raw

PATCH v3 3/3 IB/ipath: add counting for MTRR

In reply to Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

There is no good reason not to, we eventually delete it as well.

Cc Toshi Kani <[email protected]>
Cc Roland Dreier <[email protected]>
Cc Sean Hefty <[email protected]>
Cc Hal Rosenstock <[email protected]>
Cc Suresh Siddha <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Antonino Daplas <[email protected]>
Cc Jean-Christophe Plagniol-Villard <[email protected]>
Cc Tomi Valkeinen <[email protected]>
Cc infinipath at intel.com
Cc linux-rdma at vger.kernel.org
Cc linux-fbdev at vger.kernel.org
Cc linux-kernel at vger.kernel.org
---
 drivers/infiniband/hw/ipath/ipath_wc_x86_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/ipath/ipath_wc_x86_64.c +1 -1
index 4ad0b93..70c1f3a 100644
@@ -127,7 +127,7 @@ int ipath_enable_wc(struct ipath_devdata *dd)
 			   "(addr %llx, len=0x%llx)\n",
 			   (unsigned long long) pioaddr,
 			   (unsigned long long) piolen);
-		cookie = mtrr_add(pioaddr, piolen, MTRR_TYPE_WRCOMB, 0);
+		cookie = mtrr_add(pioaddr, piolen, MTRR_TYPE_WRCOMB, 1);
 		if (cookie < 0) {
 			{
 				dev_info(&dd->pcidev->dev,
Signature · 1 line
2.3.2.209.gd67f9d5.dirty