Commit 311aa683 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull rdma updates from Jason Gunthorpe:
 "Usual smallish cycle. The NFS biovec work to push it down into RDMA
  instead of indirecting through a scatterlist is pretty nice to see,
  been talked about for a long time now.

   - Various code improvements in irdma, rtrs, qedr, ocrdma, irdma, rxe

   - Small driver improvements and minor bug fixes to hns, mlx5, rxe,
     mana, mlx5, irdma

   - Robusness improvements in completion processing for EFA

   - New query_port_speed() verb to move past limited IBA defined speed
     steps

   - Support for SG_GAPS in rts and many other small improvements

   - Rare list corruption fix in iwcm

   - Better support different page sizes in rxe

   - Device memory support for mana

   - Direct bio vec to kernel MR for use by NFS-RDMA

   - QP rate limiting for bnxt_re

   - Remote triggerable NULL pointer crash in siw

   - DMA-buf exporter support for RDMA mmaps like doorbells"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (66 commits)
  RDMA/mlx5: Implement DMABUF export ops
  RDMA/uverbs: Add DMABUF object type and operations
  RDMA/uverbs: Support external FD uobjects
  RDMA/siw: Fix potential NULL pointer dereference in header processing
  RDMA/umad: Reject negative data_len in ib_umad_write
  IB/core: Extend rate limit support for RC QPs
  RDMA/mlx5: Support rate limit only for Raw Packet QP
  RDMA/bnxt_re: Report QP rate limit in debugfs
  RDMA/bnxt_re: Report packet pacing capabilities when querying device
  RDMA/bnxt_re: Add support for QP rate limiting
  MAINTAINERS: Drop RDMA files from Hyper-V section
  RDMA/uverbs: Add __GFP_NOWARN to ib_uverbs_unmarshall_recv() kmalloc
  svcrdma: use bvec-based RDMA read/write API
  RDMA/core: add rdma_rw_max_sge() helper for SQ sizing
  RDMA/core: add MR support for bvec-based RDMA operations
  RDMA/core: use IOVA-based DMA mapping for bvec RDMA operations
  RDMA/core: add bio_vec based RDMA read/write API
  RDMA/irdma: Use kvzalloc for paged memory DMA address array
  RDMA/rxe: Fix race condition in QP timer handlers
  RDMA/mana_ib: Add device‑memory support
  ...
parents e812928b d6c58f4e
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -11842,7 +11842,6 @@ F: arch/x86/kernel/cpu/mshyperv.c
F:	drivers/clocksource/hyperv_timer.c
F:	drivers/hid/hid-hyperv.c
F:	drivers/hv/
F:	drivers/infiniband/hw/mana/
F:	drivers/input/serio/hyperv-keyboard.c
F:	drivers/iommu/hyperv-iommu.c
F:	drivers/net/ethernet/microsoft/
@@ -11861,7 +11860,6 @@ F: include/hyperv/hvhdk_mini.h
F:	include/linux/hyperv.h
F:	include/net/mana
F:	include/uapi/linux/hyperv.h
F:	include/uapi/rdma/mana-abi.h
F:	net/vmw_vsock/hyperv_transport.c
F:	tools/hv/
@@ -17468,6 +17466,7 @@ MICROSOFT MANA RDMA DRIVER
M:	Long Li <longli@microsoft.com>
M:	Konstantin Taranov <kotaranov@microsoft.com>
L:	linux-rdma@vger.kernel.org
L:	linux-hyperv@vger.kernel.org
S:	Supported
F:	drivers/infiniband/hw/mana/
F:	include/net/mana
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ ib_umad-y := user_mad.o
ib_uverbs-y :=			uverbs_main.o uverbs_cmd.o uverbs_marshall.o \
				rdma_core.o uverbs_std_types.o uverbs_ioctl.o \
				uverbs_std_types_cq.o \
				uverbs_std_types_dmabuf.o \
				uverbs_std_types_dmah.o \
				uverbs_std_types_flow_action.o uverbs_std_types_dm.o \
				uverbs_std_types_mr.o uverbs_std_types_counters.o \
+2 −1
Original line number Diff line number Diff line
@@ -1537,7 +1537,8 @@ static void ib_cache_event_task(struct work_struct *_work)
	 * the cache.
	 */
	ret = ib_cache_update(work->event.device, work->event.element.port_num,
			      work->event.event == IB_EVENT_GID_CHANGE,
			      work->event.event == IB_EVENT_GID_CHANGE ||
			      work->event.event == IB_EVENT_CLIENT_REREGISTER,
			      work->event.event == IB_EVENT_PKEY_CHANGE,
			      work->enforce_security);

+3 −30
Original line number Diff line number Diff line
@@ -361,34 +361,6 @@ static struct ib_device *__ib_device_get_by_name(const char *name)
	return NULL;
}

/**
 * ib_device_get_by_name - Find an IB device by name
 * @name: The name to look for
 * @driver_id: The driver ID that must match (RDMA_DRIVER_UNKNOWN matches all)
 *
 * Find and hold an ib_device by its name. The caller must call
 * ib_device_put() on the returned pointer.
 */
struct ib_device *ib_device_get_by_name(const char *name,
					enum rdma_driver_id driver_id)
{
	struct ib_device *device;

	down_read(&devices_rwsem);
	device = __ib_device_get_by_name(name);
	if (device && driver_id != RDMA_DRIVER_UNKNOWN &&
	    device->ops.driver_id != driver_id)
		device = NULL;

	if (device) {
		if (!ib_device_try_get(device))
			device = NULL;
	}
	up_read(&devices_rwsem);
	return device;
}
EXPORT_SYMBOL(ib_device_get_by_name);

static int rename_compat_devs(struct ib_device *device)
{
	struct ib_core_device *cdev;
@@ -2793,6 +2765,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
	SET_DEVICE_OP(dev_ops, map_mr_sg);
	SET_DEVICE_OP(dev_ops, map_mr_sg_pi);
	SET_DEVICE_OP(dev_ops, mmap);
	SET_DEVICE_OP(dev_ops, mmap_get_pfns);
	SET_DEVICE_OP(dev_ops, mmap_free);
	SET_DEVICE_OP(dev_ops, modify_ah);
	SET_DEVICE_OP(dev_ops, modify_cq);
@@ -2803,6 +2776,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
	SET_DEVICE_OP(dev_ops, modify_srq);
	SET_DEVICE_OP(dev_ops, modify_wq);
	SET_DEVICE_OP(dev_ops, peek_cq);
	SET_DEVICE_OP(dev_ops, pgoff_to_mmap_entry);
	SET_DEVICE_OP(dev_ops, pre_destroy_cq);
	SET_DEVICE_OP(dev_ops, poll_cq);
	SET_DEVICE_OP(dev_ops, port_groups);
@@ -2816,6 +2790,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
	SET_DEVICE_OP(dev_ops, query_gid);
	SET_DEVICE_OP(dev_ops, query_pkey);
	SET_DEVICE_OP(dev_ops, query_port);
	SET_DEVICE_OP(dev_ops, query_port_speed);
	SET_DEVICE_OP(dev_ops, query_qp);
	SET_DEVICE_OP(dev_ops, query_srq);
	SET_DEVICE_OP(dev_ops, query_ucontext);
@@ -2875,7 +2850,6 @@ int ib_add_sub_device(struct ib_device *parent,

	return ret;
}
EXPORT_SYMBOL(ib_add_sub_device);

int ib_del_sub_device_and_put(struct ib_device *sub)
{
@@ -2896,7 +2870,6 @@ int ib_del_sub_device_and_put(struct ib_device *sub)

	return 0;
}
EXPORT_SYMBOL(ib_del_sub_device_and_put);

#ifdef CONFIG_INFINIBAND_VIRT_DMA
int ib_dma_virt_map_sg(struct ib_device *dev, struct scatterlist *sg, int nents)
+24 −0
Original line number Diff line number Diff line
@@ -5,9 +5,13 @@
 * Copyright 2019 Marvell. All rights reserved.
 */
#include <linux/xarray.h>
#include <linux/dma-buf.h>
#include <linux/dma-resv.h>
#include "uverbs.h"
#include "core_priv.h"

MODULE_IMPORT_NS("DMA_BUF");

/**
 * rdma_umap_priv_init() - Initialize the private data of a vma
 *
@@ -229,12 +233,29 @@ EXPORT_SYMBOL(rdma_user_mmap_entry_put);
 */
void rdma_user_mmap_entry_remove(struct rdma_user_mmap_entry *entry)
{
	struct ib_uverbs_dmabuf_file *uverbs_dmabuf, *tmp;

	if (!entry)
		return;

	mutex_lock(&entry->dmabufs_lock);
	xa_lock(&entry->ucontext->mmap_xa);
	entry->driver_removed = true;
	xa_unlock(&entry->ucontext->mmap_xa);
	list_for_each_entry_safe(uverbs_dmabuf, tmp, &entry->dmabufs, dmabufs_elm) {
		dma_resv_lock(uverbs_dmabuf->dmabuf->resv, NULL);
		list_del(&uverbs_dmabuf->dmabufs_elm);
		uverbs_dmabuf->revoked = true;
		dma_buf_move_notify(uverbs_dmabuf->dmabuf);
		dma_resv_wait_timeout(uverbs_dmabuf->dmabuf->resv,
				      DMA_RESV_USAGE_BOOKKEEP, false,
				      MAX_SCHEDULE_TIMEOUT);
		dma_resv_unlock(uverbs_dmabuf->dmabuf->resv);
		kref_put(&uverbs_dmabuf->kref, ib_uverbs_dmabuf_done);
		wait_for_completion(&uverbs_dmabuf->comp);
	}
	mutex_unlock(&entry->dmabufs_lock);

	kref_put(&entry->ref, rdma_user_mmap_entry_free);
}
EXPORT_SYMBOL(rdma_user_mmap_entry_remove);
@@ -274,6 +295,9 @@ int rdma_user_mmap_entry_insert_range(struct ib_ucontext *ucontext,
		return -EINVAL;

	kref_init(&entry->ref);
	INIT_LIST_HEAD(&entry->dmabufs);
	mutex_init(&entry->dmabufs_lock);

	entry->ucontext = ucontext;

	/*
Loading