stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] IB/qib: Change lkey table allocation to support more MRs" failed to apply to 3.10-stable tree
@ 2015-09-26 17:51 gregkh
  2015-09-28 14:29 ` Marciniszyn, Mike
  0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2015-09-26 17:51 UTC (permalink / raw)
  To: mike.marciniszyn, dledford, vinit.abhay.agnihotri; +Cc: stable


The patch below does not apply to the 3.10-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From d6f1c17e162b2a11e708f28fa93f2f79c164b442 Mon Sep 17 00:00:00 2001
From: Mike Marciniszyn <mike.marciniszyn@intel.com>
Date: Tue, 21 Jul 2015 08:36:07 -0400
Subject: [PATCH] IB/qib: Change lkey table allocation to support more MRs

The lkey table is allocated with with a get_user_pages() with an
order based on a number of index bits from a module parameter.

The underlying kernel code cannot allocate that many contiguous pages.

There is no reason the underlying memory needs to be physically
contiguous.

This patch:
- switches the allocation/deallocation to vmalloc/vfree
- caps the number of bits to 23 to insure at least 1 generation bit
  o this matches the module parameter description

Cc: stable@vger.kernel.org
Reviewed-by: Vinit Agnihotri <vinit.abhay.agnihotri@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>

diff --git a/drivers/infiniband/hw/qib/qib_keys.c b/drivers/infiniband/hw/qib/qib_keys.c
index ad843c786e72..5afaa218508d 100644
--- a/drivers/infiniband/hw/qib/qib_keys.c
+++ b/drivers/infiniband/hw/qib/qib_keys.c
@@ -86,6 +86,10 @@ int qib_alloc_lkey(struct qib_mregion *mr, int dma_region)
 	 * unrestricted LKEY.
 	 */
 	rkt->gen++;
+	/*
+	 * bits are capped in qib_verbs.c to insure enough bits
+	 * for generation number
+	 */
 	mr->lkey = (r << (32 - ib_qib_lkey_table_size)) |
 		((((1 << (24 - ib_qib_lkey_table_size)) - 1) & rkt->gen)
 		 << 8);
diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c
index a05d1a372208..77e981abfce4 100644
--- a/drivers/infiniband/hw/qib/qib_verbs.c
+++ b/drivers/infiniband/hw/qib/qib_verbs.c
@@ -40,6 +40,7 @@
 #include <linux/rculist.h>
 #include <linux/mm.h>
 #include <linux/random.h>
+#include <linux/vmalloc.h>
 
 #include "qib.h"
 #include "qib_common.h"
@@ -2109,10 +2110,16 @@ int qib_register_ib_device(struct qib_devdata *dd)
 	 * the LKEY).  The remaining bits act as a generation number or tag.
 	 */
 	spin_lock_init(&dev->lk_table.lock);
+	/* insure generation is at least 4 bits see keys.c */
+	if (ib_qib_lkey_table_size > MAX_LKEY_TABLE_BITS) {
+		qib_dev_warn(dd, "lkey bits %u too large, reduced to %u\n",
+			ib_qib_lkey_table_size, MAX_LKEY_TABLE_BITS);
+		ib_qib_lkey_table_size = MAX_LKEY_TABLE_BITS;
+	}
 	dev->lk_table.max = 1 << ib_qib_lkey_table_size;
 	lk_tab_size = dev->lk_table.max * sizeof(*dev->lk_table.table);
 	dev->lk_table.table = (struct qib_mregion __rcu **)
-		__get_free_pages(GFP_KERNEL, get_order(lk_tab_size));
+		vmalloc(lk_tab_size);
 	if (dev->lk_table.table == NULL) {
 		ret = -ENOMEM;
 		goto err_lk;
@@ -2286,7 +2293,7 @@ err_tx:
 					sizeof(struct qib_pio_header),
 				  dev->pio_hdrs, dev->pio_hdrs_phys);
 err_hdrs:
-	free_pages((unsigned long) dev->lk_table.table, get_order(lk_tab_size));
+	vfree(dev->lk_table.table);
 err_lk:
 	kfree(dev->qp_table);
 err_qpt:
@@ -2340,8 +2347,7 @@ void qib_unregister_ib_device(struct qib_devdata *dd)
 					sizeof(struct qib_pio_header),
 				  dev->pio_hdrs, dev->pio_hdrs_phys);
 	lk_tab_size = dev->lk_table.max * sizeof(*dev->lk_table.table);
-	free_pages((unsigned long) dev->lk_table.table,
-		   get_order(lk_tab_size));
+	vfree(dev->lk_table.table);
 	kfree(dev->qp_table);
 }
 
diff --git a/drivers/infiniband/hw/qib/qib_verbs.h b/drivers/infiniband/hw/qib/qib_verbs.h
index 1635572752ce..bce0fa596b4d 100644
--- a/drivers/infiniband/hw/qib/qib_verbs.h
+++ b/drivers/infiniband/hw/qib/qib_verbs.h
@@ -647,6 +647,8 @@ struct qib_qpn_table {
 	struct qpn_map map[QPNMAP_ENTRIES];
 };
 
+#define MAX_LKEY_TABLE_BITS 23
+
 struct qib_lkey_table {
 	spinlock_t lock; /* protect changes in this struct */
 	u32 next;               /* next unused index (speeds search) */


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: FAILED: patch "[PATCH] IB/qib: Change lkey table allocation to support more MRs" failed to apply to 3.10-stable tree
  2015-09-26 17:51 FAILED: patch "[PATCH] IB/qib: Change lkey table allocation to support more MRs" failed to apply to 3.10-stable tree gregkh
@ 2015-09-28 14:29 ` Marciniszyn, Mike
  2015-09-28 14:31   ` gregkh
  0 siblings, 1 reply; 4+ messages in thread
From: Marciniszyn, Mike @ 2015-09-28 14:29 UTC (permalink / raw)
  To: gregkh@linuxfoundation.org
  Cc: stable@vger.kernel.org, dledford@redhat.com,
	Agnihotri, Vinit Abhay

> The patch below does not apply to the 3.10-stable tree.
> If someone wants it applied there, or to any other stable or longterm tree,
> then please email the backport, including the original git commit id to
> <stable@vger.kernel.org>.
> 
> thanks,
> 

Oddly, I was able to cherry-pick d6f1c17e162b cleanly to origin/linux-3.10.y.

3.4 and 3.2 DID fail.  I'm not going to bother with the 2.6.32.

I will submit a patch for these just to be sure.

Mike

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: FAILED: patch "[PATCH] IB/qib: Change lkey table allocation to support more MRs" failed to apply to 3.10-stable tree
  2015-09-28 14:29 ` Marciniszyn, Mike
@ 2015-09-28 14:31   ` gregkh
  2015-09-29 14:52     ` Marciniszyn, Mike
  0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2015-09-28 14:31 UTC (permalink / raw)
  To: Marciniszyn, Mike
  Cc: stable@vger.kernel.org, dledford@redhat.com,
	Agnihotri, Vinit Abhay

On Mon, Sep 28, 2015 at 02:29:19PM +0000, Marciniszyn, Mike wrote:
> > The patch below does not apply to the 3.10-stable tree.
> > If someone wants it applied there, or to any other stable or longterm tree,
> > then please email the backport, including the original git commit id to
> > <stable@vger.kernel.org>.
> > 
> > thanks,
> > 
> 
> Oddly, I was able to cherry-pick d6f1c17e162b cleanly to origin/linux-3.10.y.

Does it build properly?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: FAILED: patch "[PATCH] IB/qib: Change lkey table allocation to support more MRs" failed to apply to 3.10-stable tree
  2015-09-28 14:31   ` gregkh
@ 2015-09-29 14:52     ` Marciniszyn, Mike
  0 siblings, 0 replies; 4+ messages in thread
From: Marciniszyn, Mike @ 2015-09-29 14:52 UTC (permalink / raw)
  To: gregkh@linuxfoundation.org
  Cc: stable@vger.kernel.org, dledford@redhat.com,
	Agnihotri, Vinit Abhay

> > > The patch below does not apply to the 3.10-stable tree.
> > > If someone wants it applied there, or to any other stable or
> > > longterm tree, then please email the backport, including the
> > > original git commit id to <stable@vger.kernel.org>.
> > >
> > > thanks,
> > >
> >
> > Oddly, I was able to cherry-pick d6f1c17e162b cleanly to origin/linux-3.10.y.
> 
> Does it build properly?

I have submitted ported versions to 3.10, 3.4, and 3.2.

Mike



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-29 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-26 17:51 FAILED: patch "[PATCH] IB/qib: Change lkey table allocation to support more MRs" failed to apply to 3.10-stable tree gregkh
2015-09-28 14:29 ` Marciniszyn, Mike
2015-09-28 14:31   ` gregkh
2015-09-29 14:52     ` Marciniszyn, Mike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).