Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1249662
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3.10 43/54] IB/qib: Change lkey table allocation to support more MRs |
| Date | 2015-10-18 05:00 +0200 |
| Message-ID | <qkMmv-i6-29@gated-at.bofh.it> (permalink) |
| References | <qkMmu-i6-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Marciniszyn <mike.marciniszyn@intel.com>
commit d6f1c17e162b2a11e708f28fa93f2f79c164b442 upstream.
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
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/infiniband/hw/qib/qib.h | 27 +++++++++++----------------
drivers/infiniband/hw/qib/qib_keys.c | 4 ++++
drivers/infiniband/hw/qib/qib_verbs.c | 14 ++++++++++----
drivers/infiniband/hw/qib/qib_verbs.h | 2 ++
4 files changed, 27 insertions(+), 20 deletions(-)
--- a/drivers/infiniband/hw/qib/qib.h
+++ b/drivers/infiniband/hw/qib/qib.h
@@ -1467,27 +1467,22 @@ extern struct mutex qib_mutex;
* first to avoid possible serial port delays from printk.
*/
#define qib_early_err(dev, fmt, ...) \
- do { \
- dev_err(dev, fmt, ##__VA_ARGS__); \
- } while (0)
+ dev_err(dev, fmt, ##__VA_ARGS__)
#define qib_dev_err(dd, fmt, ...) \
- do { \
- dev_err(&(dd)->pcidev->dev, "%s: " fmt, \
- qib_get_unit_name((dd)->unit), ##__VA_ARGS__); \
- } while (0)
+ dev_err(&(dd)->pcidev->dev, "%s: " fmt, \
+ qib_get_unit_name((dd)->unit), ##__VA_ARGS__)
-#define qib_dev_porterr(dd, port, fmt, ...) \
- do { \
- dev_err(&(dd)->pcidev->dev, "%s: IB%u:%u " fmt, \
- qib_get_unit_name((dd)->unit), (dd)->unit, (port), \
- ##__VA_ARGS__); \
- } while (0)
+#define qib_dev_warn(dd, fmt, ...) \
+ dev_warn(&(dd)->pcidev->dev, "%s: " fmt, \
+ qib_get_unit_name((dd)->unit), ##__VA_ARGS__)
+#define qib_dev_porterr(dd, port, fmt, ...) \
+ dev_err(&(dd)->pcidev->dev, "%s: IB%u:%u " fmt, \
+ qib_get_unit_name((dd)->unit), (dd)->unit, (port), \
+ ##__VA_ARGS__)
#define qib_devinfo(pcidev, fmt, ...) \
- do { \
- dev_info(&(pcidev)->dev, fmt, ##__VA_ARGS__); \
- } while (0)
+ dev_info(&(pcidev)->dev, fmt, ##__VA_ARGS__)
/*
* this is used for formatting hw error messages...
--- 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 *m
* 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);
--- 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"
@@ -2084,10 +2085,16 @@ int qib_register_ib_device(struct qib_de
* 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;
@@ -2260,7 +2267,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:
@@ -2314,8 +2321,7 @@ void qib_unregister_ib_device(struct qib
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);
}
--- a/drivers/infiniband/hw/qib/qib_verbs.h
+++ b/drivers/infiniband/hw/qib/qib_verbs.h
@@ -645,6 +645,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) */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3.10 00/54] 3.10.91-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 43/54] IB/qib: Change lkey table allocation to support more MRs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 18/54] dm btree: add ref counting ops for the leaves of top level btrees Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 27/54] usb: xhci: Add support for URB_ZERO_PACKET to bulk/sg transfers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 20/54] dm raid: fix round up of default region size Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 40/54] powerpc/MSI: Fix race condition in tearing down MSI interrupts Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 33/54] regmap: debugfs: Dont bother actually printing when calculating max length Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 30/54] ipvs: fix crash with sync protocol v0 and FTP Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 38/54] MIPS: dma-default: Fix 32-bit fall back to GFP_DMA Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 48/54] bonding: correct the MAC address for "follow" fail_over_mac policy Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 36/54] usb: Add device quirk for Logitech PTZ cameras Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 31/54] udf: Check length of extended attributes and allocation descriptors Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 19/54] USB: option: add ZTE PIDs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 05/54] x86/apic: Serialize LVTT and TSC_DEADLINE writes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:00 +0200
[PATCH 3.10 06/54] x86/platform: Fix Geode LX timekeeping in the generic x86 build Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:10 +0200
[PATCH 3.10 09/54] x86/xen: Support kexec/kdump in HVM guests by doing a soft reset Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:10 +0200
[PATCH 3.10 07/54] Use WARN_ON_ONCE for missing X86_FEATURE_NRIPS Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:10 +0200
[PATCH 3.10 08/54] x86/mm: Set NX on gap between __ex_table and rodata Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:10 +0200
[PATCH 3.10 24/54] USB: whiteheat: fix potential null-deref at probe Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:30 +0200
[PATCH 3.10 21/54] netfilter: nf_conntrack: Support expectations in different zones Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:30 +0200
[PATCH 3.10 26/54] xhci: change xhci 1.0 only restrictions to support xhci 1.1 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:30 +0200
[PATCH 3.10 25/54] usb: xhci: Clear XHCI_STATE_DYING on start Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:30 +0200
[PATCH 3.10 50/54] genirq: Fix race in register_irq_proc() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:30 +0200
[PATCH 3.10 17/54] staging: comedi: adl_pci7x3x: fix digital output on PCI-7230 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:30 +0200
[PATCH 3.10 22/54] disabling oplocks/leases via module parm enable_oplocks broken for SMB3 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:30 +0200
[PATCH 3.10 23/54] drm: Reject DRI1 hw lock ioctl functions for kms drivers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:30 +0200
[PATCH 3.10 52/54] dm cache: fix NULL pointer when switching from cleaner policy Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:30 +0200
[PATCH 3.10 53/54] staging: speakup: fix speakup-r regression Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:30 +0200
[PATCH 3.10 51/54] x86: Add 1/2/4/8 byte optimization to 64bit __copy_{from,to}_user_inatomic Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:30 +0200
[PATCH 3.10 02/54] perf header: Fixup reading of HEADER_NRCPUS feature Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:40 +0200
[PATCH 3.10 01/54] scsi: fix scsi_error_handler vs. scsi_host_dev_release race Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:40 +0200
[PATCH 3.10 03/54] ARM: 8429/1: disable GCC SRA optimization Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:40 +0200
[PATCH 3.10 16/54] btrfs: skip waiting on ordered range for special files Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:40 +0200
[PATCH 3.10 10/54] spi: Fix documentation of spi_alloc_master() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:40 +0200
[PATCH 3.10 14/54] ASoC: fix broken pxa SoC support Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:40 +0200
[PATCH 3.10 13/54] ALSA: synth: Fix conflicting OSS device registration on AWE32 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:40 +0200
[PATCH 3.10 15/54] ASoC: dwc: correct irq clear method Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:40 +0200
[PATCH 3.10 04/54] windfarm: decrement client count when unregistering Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:40 +0200
[PATCH 3.10 11/54] spi: spi-pxa2xx: Check status register to determine if SSSR_TINT is disabled Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 05:50 +0200
Re: [PATCH 3.10 00/54] 3.10.91-stable review Willy Tarreau <w@1wt.eu> - 2015-10-18 09:10 +0200
Re: [PATCH 3.10 00/54] 3.10.91-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 18:10 +0200
Re: [PATCH 3.10 00/54] 3.10.91-stable review Willy Tarreau <w@1wt.eu> - 2015-10-18 21:20 +0200
Re: [PATCH 3.10 00/54] 3.10.91-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-18 21:40 +0200
Re: [PATCH 3.10 00/54] 3.10.91-stable review Guenter Roeck <linux@roeck-us.net> - 2015-10-19 06:10 +0200
Re: [PATCH 3.10 00/54] 3.10.91-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-19 17:20 +0200
Re: [PATCH 3.10 00/54] 3.10.91-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2015-10-19 17:20 +0200
Re: [PATCH 3.10 00/54] 3.10.91-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-22 23:40 +0200
csiph-web