Skip to content

Commit a1e16bc

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma updates from Jason Gunthorpe: "A usual cycle for RDMA with a typical mix of driver and core subsystem updates: - Driver minor changes and bug fixes for mlx5, efa, rxe, vmw_pvrdma, hns, usnic, qib, qedr, cxgb4, hns, bnxt_re - Various rtrs fixes and updates - Bug fix for mlx4 CM emulation for virtualization scenarios where MRA wasn't working right - Use tracepoints instead of pr_debug in the CM code - Scrub the locking in ucma and cma to close more syzkaller bugs - Use tasklet_setup in the subsystem - Revert the idea that 'destroy' operations are not allowed to fail at the driver level. This proved unworkable from a HW perspective. - Revise how the umem API works so drivers make fewer mistakes using it - XRC support for qedr - Convert uverbs objects RWQ and MW to new the allocation scheme - Large queue entry sizes for hns - Use hmm_range_fault() for mlx5 On Demand Paging - uverbs APIs to inspect the GID table instead of sysfs - Move some of the RDMA code for building large page SGLs into lib/scatterlist" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (191 commits) RDMA/ucma: Fix use after free in destroy id flow RDMA/rxe: Handle skb_clone() failure in rxe_recv.c RDMA/rxe: Move the definitions for rxe_av.network_type to uAPI RDMA: Explicitly pass in the dma_device to ib_register_device lib/scatterlist: Do not limit max_segment to PAGE_ALIGNED values IB/mlx4: Convert rej_tmout radix-tree to XArray RDMA/rxe: Fix bug rejecting all multicast packets RDMA/rxe: Fix skb lifetime in rxe_rcv_mcast_pkt() RDMA/rxe: Remove duplicate entries in struct rxe_mr IB/hfi,rdmavt,qib,opa_vnic: Update MAINTAINERS IB/rdmavt: Fix sizeof mismatch MAINTAINERS: CISCO VIC LOW LATENCY NIC DRIVER RDMA/bnxt_re: Fix sizeof mismatch for allocation of pbl_tbl. RDMA/bnxt_re: Use rdma_umem_for_each_dma_block() RDMA/umem: Move to allocate SG table from pages lib/scatterlist: Add support in dynamic allocation of SG table from pages tools/testing/scatterlist: Show errors in human readable form tools/testing/scatterlist: Rejuvenate bit-rotten test RDMA/ipoib: Set rtnl_link_ops for ipoib interfaces RDMA/uverbs: Expose the new GID query API to user space ...
2 parents 2a934b3 + c7a198c commit a1e16bc

File tree

224 files changed

+5213
-4703
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+5213
-4703
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ ForEachMacros:
429429
- 'rbtree_postorder_for_each_entry_safe'
430430
- 'rdma_for_each_block'
431431
- 'rdma_for_each_port'
432+
- 'rdma_umem_for_each_dma_block'
432433
- 'resource_list_for_each_entry'
433434
- 'resource_list_for_each_entry_safe'
434435
- 'rhl_for_each_entry_rcu'

Documentation/ABI/stable/sysfs-class-infiniband

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -258,23 +258,6 @@ Description:
258258
userspace ABI compatibility of umad & issm devices.
259259

260260

261-
What: /sys/class/infiniband_cm/ucmN/ibdev
262-
Date: Oct, 2005
263-
KernelVersion: v2.6.14
264-
265-
Description:
266-
(RO) Display Infiniband (IB) device name
267-
268-
269-
What: /sys/class/infiniband_cm/abi_version
270-
Date: Oct, 2005
271-
KernelVersion: v2.6.14
272-
273-
Description:
274-
(RO) Value is incremented if any changes are made that break
275-
userspace ABI compatibility of ucm devices.
276-
277-
278261
What: /sys/class/infiniband_verbs/uverbsN/ibdev
279262
What: /sys/class/infiniband_verbs/uverbsN/abi_version
280263
Date: Sept, 2005

MAINTAINERS

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4256,7 +4256,6 @@ F: drivers/net/ethernet/cisco/enic/
42564256
CISCO VIC LOW LATENCY NIC DRIVER
42574257
M: Christian Benvenuti <[email protected]>
42584258
M: Nelson Escobar <[email protected]>
4259-
M: Parvi Kaustubhi <[email protected]>
42604259
S: Supported
42614260
F: drivers/infiniband/hw/usnic/
42624261

@@ -7793,8 +7792,8 @@ F: include/linux/cciss*.h
77937792
F: include/uapi/linux/cciss*.h
77947793

77957794
HFI1 DRIVER
7796-
M: Mike Marciniszyn <mike.marciniszyn@intel.com>
7797-
M: Dennis Dalessandro <dennis.dalessandro@intel.com>
7795+
M: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
7796+
M: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
77987797
77997798
S: Supported
78007799
F: drivers/infiniband/hw/hfi1
@@ -12999,8 +12998,8 @@ S: Maintained
1299912998
F: drivers/char/hw_random/optee-rng.c
1300012999

1300113000
OPA-VNIC DRIVER
13002-
M: Dennis Dalessandro <dennis.dalessandro@intel.com>
13003-
M: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
13001+
M: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
13002+
M: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
1300413003
1300513004
S: Supported
1300613005
F: drivers/infiniband/ulp/opa_vnic
@@ -14301,8 +14300,8 @@ F: drivers/firmware/qemu_fw_cfg.c
1430114300
F: include/uapi/linux/qemu_fw_cfg.h
1430214301

1430314302
QIB DRIVER
14304-
M: Dennis Dalessandro <dennis.dalessandro@intel.com>
14305-
M: Mike Marciniszyn <mike.marciniszyn@intel.com>
14303+
M: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
14304+
M: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
1430614305
1430714306
S: Supported
1430814307
F: drivers/infiniband/hw/qib/
@@ -14727,8 +14726,8 @@ S: Maintained
1472714726
F: drivers/net/ethernet/rdc/r6040.c
1472814727

1472914728
RDMAVT - RDMA verbs software
14730-
M: Dennis Dalessandro <dennis.dalessandro@intel.com>
14731-
M: Mike Marciniszyn <mike.marciniszyn@intel.com>
14729+
M: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
14730+
M: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
1473214731
1473314732
S: Supported
1473414733
F: drivers/infiniband/sw/rdmavt

drivers/gpu/drm/drm_prime.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -806,30 +806,27 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = {
806806
struct sg_table *drm_prime_pages_to_sg(struct drm_device *dev,
807807
struct page **pages, unsigned int nr_pages)
808808
{
809-
struct sg_table *sg = NULL;
809+
struct sg_table *sg;
810+
struct scatterlist *sge;
810811
size_t max_segment = 0;
811-
int ret;
812812

813813
sg = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
814-
if (!sg) {
815-
ret = -ENOMEM;
816-
goto out;
817-
}
814+
if (!sg)
815+
return ERR_PTR(-ENOMEM);
818816

819817
if (dev)
820818
max_segment = dma_max_mapping_size(dev->dev);
821819
if (max_segment == 0 || max_segment > SCATTERLIST_MAX_SEGMENT)
822820
max_segment = SCATTERLIST_MAX_SEGMENT;
823-
ret = __sg_alloc_table_from_pages(sg, pages, nr_pages, 0,
821+
sge = __sg_alloc_table_from_pages(sg, pages, nr_pages, 0,
824822
nr_pages << PAGE_SHIFT,
825-
max_segment, GFP_KERNEL);
826-
if (ret)
827-
goto out;
828-
823+
max_segment,
824+
NULL, 0, GFP_KERNEL);
825+
if (IS_ERR(sge)) {
826+
kfree(sg);
827+
sg = ERR_CAST(sge);
828+
}
829829
return sg;
830-
out:
831-
kfree(sg);
832-
return ERR_PTR(ret);
833830
}
834831
EXPORT_SYMBOL(drm_prime_pages_to_sg);
835832

drivers/gpu/drm/i915/gem/i915_gem_userptr.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,20 +403,20 @@ __i915_gem_userptr_alloc_pages(struct drm_i915_gem_object *obj,
403403
unsigned int max_segment = i915_sg_segment_size();
404404
struct sg_table *st;
405405
unsigned int sg_page_sizes;
406+
struct scatterlist *sg;
406407
int ret;
407408

408409
st = kmalloc(sizeof(*st), GFP_KERNEL);
409410
if (!st)
410411
return ERR_PTR(-ENOMEM);
411412

412413
alloc_table:
413-
ret = __sg_alloc_table_from_pages(st, pvec, num_pages,
414-
0, num_pages << PAGE_SHIFT,
415-
max_segment,
416-
GFP_KERNEL);
417-
if (ret) {
414+
sg = __sg_alloc_table_from_pages(st, pvec, num_pages, 0,
415+
num_pages << PAGE_SHIFT, max_segment,
416+
NULL, 0, GFP_KERNEL);
417+
if (IS_ERR(sg)) {
418418
kfree(st);
419-
return ERR_PTR(ret);
419+
return ERR_CAST(sg);
420420
}
421421

422422
ret = i915_gem_gtt_prepare_pages(obj, st);

drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ static int vmw_ttm_map_dma(struct vmw_ttm_tt *vmw_tt)
432432
int ret = 0;
433433
static size_t sgl_size;
434434
static size_t sgt_size;
435+
struct scatterlist *sg;
435436

436437
if (vmw_tt->mapped)
437438
return 0;
@@ -454,13 +455,15 @@ static int vmw_ttm_map_dma(struct vmw_ttm_tt *vmw_tt)
454455
if (unlikely(ret != 0))
455456
return ret;
456457

457-
ret = __sg_alloc_table_from_pages
458-
(&vmw_tt->sgt, vsgt->pages, vsgt->num_pages, 0,
459-
(unsigned long) vsgt->num_pages << PAGE_SHIFT,
460-
dma_get_max_seg_size(dev_priv->dev->dev),
461-
GFP_KERNEL);
462-
if (unlikely(ret != 0))
458+
sg = __sg_alloc_table_from_pages(&vmw_tt->sgt, vsgt->pages,
459+
vsgt->num_pages, 0,
460+
(unsigned long) vsgt->num_pages << PAGE_SHIFT,
461+
dma_get_max_seg_size(dev_priv->dev->dev),
462+
NULL, 0, GFP_KERNEL);
463+
if (IS_ERR(sg)) {
464+
ret = PTR_ERR(sg);
463465
goto out_sg_alloc_fail;
466+
}
464467

465468
if (vsgt->num_pages > vmw_tt->sgt.orig_nents) {
466469
uint64_t over_alloc =

drivers/infiniband/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ config INFINIBAND_ON_DEMAND_PAGING
4848
depends on INFINIBAND_USER_MEM
4949
select MMU_NOTIFIER
5050
select INTERVAL_TREE
51+
select HMM_MIRROR
5152
default y
5253
help
5354
On demand paging support for the InfiniBand subsystem.

drivers/infiniband/core/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ib_core-y := packer.o ud_header.o verbs.o cq.o rw.o sysfs.o \
1717
ib_core-$(CONFIG_SECURITY_INFINIBAND) += security.o
1818
ib_core-$(CONFIG_CGROUP_RDMA) += cgroup.o
1919

20-
ib_cm-y := cm.o
20+
ib_cm-y := cm.o cm_trace.o
2121

2222
iw_cm-y := iwcm.o iwpm_util.o iwpm_msg.o
2323

drivers/infiniband/core/addr.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -647,13 +647,12 @@ static void process_one_req(struct work_struct *_work)
647647
req->callback = NULL;
648648

649649
spin_lock_bh(&lock);
650+
/*
651+
* Although the work will normally have been canceled by the workqueue,
652+
* it can still be requeued as long as it is on the req_list.
653+
*/
654+
cancel_delayed_work(&req->work);
650655
if (!list_empty(&req->list)) {
651-
/*
652-
* Although the work will normally have been canceled by the
653-
* workqueue, it can still be requeued as long as it is on the
654-
* req_list.
655-
*/
656-
cancel_delayed_work(&req->work);
657656
list_del_init(&req->list);
658657
kfree(req);
659658
}

drivers/infiniband/core/cache.c

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ static void dispatch_gid_change_event(struct ib_device *ib_dev, u8 port)
133133
}
134134

135135
static const char * const gid_type_str[] = {
136+
/* IB/RoCE v1 value is set for IB_GID_TYPE_IB and IB_GID_TYPE_ROCE for
137+
* user space compatibility reasons.
138+
*/
136139
[IB_GID_TYPE_IB] = "IB/RoCE v1",
140+
[IB_GID_TYPE_ROCE] = "IB/RoCE v1",
137141
[IB_GID_TYPE_ROCE_UDP_ENCAP] = "RoCE v2",
138142
};
139143

@@ -1220,7 +1224,7 @@ EXPORT_SYMBOL(ib_get_cached_port_state);
12201224
const struct ib_gid_attr *
12211225
rdma_get_gid_attr(struct ib_device *device, u8 port_num, int index)
12221226
{
1223-
const struct ib_gid_attr *attr = ERR_PTR(-EINVAL);
1227+
const struct ib_gid_attr *attr = ERR_PTR(-ENODATA);
12241228
struct ib_gid_table *table;
12251229
unsigned long flags;
12261230

@@ -1243,6 +1247,67 @@ rdma_get_gid_attr(struct ib_device *device, u8 port_num, int index)
12431247
}
12441248
EXPORT_SYMBOL(rdma_get_gid_attr);
12451249

1250+
/**
1251+
* rdma_query_gid_table - Reads GID table entries of all the ports of a device up to max_entries.
1252+
* @device: The device to query.
1253+
* @entries: Entries where GID entries are returned.
1254+
* @max_entries: Maximum number of entries that can be returned.
1255+
* Entries array must be allocated to hold max_entries number of entries.
1256+
* @num_entries: Updated to the number of entries that were successfully read.
1257+
*
1258+
* Returns number of entries on success or appropriate error code.
1259+
*/
1260+
ssize_t rdma_query_gid_table(struct ib_device *device,
1261+
struct ib_uverbs_gid_entry *entries,
1262+
size_t max_entries)
1263+
{
1264+
const struct ib_gid_attr *gid_attr;
1265+
ssize_t num_entries = 0, ret;
1266+
struct ib_gid_table *table;
1267+
unsigned int port_num, i;
1268+
struct net_device *ndev;
1269+
unsigned long flags;
1270+
1271+
rdma_for_each_port(device, port_num) {
1272+
if (!rdma_ib_or_roce(device, port_num))
1273+
continue;
1274+
1275+
table = rdma_gid_table(device, port_num);
1276+
read_lock_irqsave(&table->rwlock, flags);
1277+
for (i = 0; i < table->sz; i++) {
1278+
if (!is_gid_entry_valid(table->data_vec[i]))
1279+
continue;
1280+
if (num_entries >= max_entries) {
1281+
ret = -EINVAL;
1282+
goto err;
1283+
}
1284+
1285+
gid_attr = &table->data_vec[i]->attr;
1286+
1287+
memcpy(&entries->gid, &gid_attr->gid,
1288+
sizeof(gid_attr->gid));
1289+
entries->gid_index = gid_attr->index;
1290+
entries->port_num = gid_attr->port_num;
1291+
entries->gid_type = gid_attr->gid_type;
1292+
ndev = rcu_dereference_protected(
1293+
gid_attr->ndev,
1294+
lockdep_is_held(&table->rwlock));
1295+
if (ndev)
1296+
entries->netdev_ifindex = ndev->ifindex;
1297+
1298+
num_entries++;
1299+
entries++;
1300+
}
1301+
read_unlock_irqrestore(&table->rwlock, flags);
1302+
}
1303+
1304+
return num_entries;
1305+
err:
1306+
read_unlock_irqrestore(&table->rwlock, flags);
1307+
return ret;
1308+
}
1309+
EXPORT_SYMBOL(rdma_query_gid_table);
1310+
12461311
/**
12471312
* rdma_put_gid_attr - Release reference to the GID attribute
12481313
* @attr: Pointer to the GID attribute whose reference
@@ -1299,7 +1364,7 @@ struct net_device *rdma_read_gid_attr_ndev_rcu(const struct ib_gid_attr *attr)
12991364
struct ib_gid_table_entry *entry =
13001365
container_of(attr, struct ib_gid_table_entry, attr);
13011366
struct ib_device *device = entry->attr.device;
1302-
struct net_device *ndev = ERR_PTR(-ENODEV);
1367+
struct net_device *ndev = ERR_PTR(-EINVAL);
13031368
u8 port_num = entry->attr.port_num;
13041369
struct ib_gid_table *table;
13051370
unsigned long flags;
@@ -1311,8 +1376,7 @@ struct net_device *rdma_read_gid_attr_ndev_rcu(const struct ib_gid_attr *attr)
13111376
valid = is_gid_entry_valid(table->data_vec[attr->index]);
13121377
if (valid) {
13131378
ndev = rcu_dereference(attr->ndev);
1314-
if (!ndev ||
1315-
(ndev && ((READ_ONCE(ndev->flags) & IFF_UP) == 0)))
1379+
if (!ndev)
13161380
ndev = ERR_PTR(-ENODEV);
13171381
}
13181382
read_unlock_irqrestore(&table->rwlock, flags);

0 commit comments

Comments
 (0)