All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC ABI V2 0/8] SG-based RDMA ABI Proposal
@ 2016-07-19 15:23 Matan Barak
       [not found] ` <1468941812-32286-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 50+ messages in thread
From: Matan Barak @ 2016-07-19 15:23 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Doug Ledford, Jason Gunthorpe, Sean Hefty, Liran Liss,
	Haggai Eran, Tal Alon, Majd Dibbiny, Christoph Lameter,
	Leon Romanovsky, Matan Barak

The following patch set comes to enrich security model as a follow up
to commit e6bd18f57aad ('IB/security: Restrict use of the write() interface').

DISCLAIMER:
These patches are far from being completed. They present working init_ucontext
and query_device (both regular and extended version). In addition, they are
given as a basis of discussions.

COMMENTS GIVEN ON V1 AREN'T HANDLED IN THIS SERIES, BUT WILL BE HANDLED IN
THE NEXT ONE.

The ideas presented here are based on our V1 series in addition to some ideas
presented in OFVWG and Sean's series.

This patch series add ioctl() interface to the existing write() interface and
provide an easy route to backport this change to legacy supported systems.
Analyzing the current uverbs role in dispatching and parsing commands, we find
that:
(a) uverbs validates the basic properties of the command
(b) uverbs is responsible of doing all the IDR and uobject management and
    locking.
(c) uverbs transforms the user<-->kernel ABI to kernel API.

(a) and (b) are valid for every kABI. Although the nature of commands could
change, they still have to be validated and transform to kernel pointers.
In order to avoid duplications between the various drivers, we would like to
keep (a) and (b) as shared code.

In addition, this is a good time to expand the ABI to be more scalable, so we
added a few goals:
(1) Command's attributes shall be extensible in an easy one. Either by allowing
    drivers to have their own extensible set of attributes or core code
    extensible attributes. Moreover, driver's specific attributes could some
    day become core's standard attributes. We would like to still support
    old user-space while avoid duplicating the code in kernel.
(2) Each driver may have specific type system (i.e QP, CQ, ....). It may
    or may not even implement the standard type system. It could extend this
    type system in the future.
(3) Do not change or recompile driver libraries and don't copy their data.
(4) Efficient dispatching.

Thus, in order to allow this flexibility, we decide giving (a) and (b) as a
common infrastructure, but use per-driver guidelines in order to do that
parsing and uobject management. Handlers are also set by the drivers
themselves (though they can point to either shared common code) or
driver specific code.

Since types are no longer enforced by the common infrastructure, there is no
point of pre-allocating common IDR types in the common code. Instead, we
provide an API for driver to add new types. We use one IDR per driver
for all its types. The driver should add all its usable types before
any application runs. The order of which the driver adds its types (and the
common types it uses) dictates the process release order. After that,
all uboject, reference counts and types are handled automatically for the
driver by the infrastructure.

Scatter gather was chosen in order to allow us not to recompile user space
drivers. By using pointers to driver specific data, we could just use it
without introduce copying data and without changing the user-space driver at
all.

We chose to go with non blocking lock user objects. When exclusive
(WRITE or DESTROY) access is required, we dispatch the action if and only if
no other action needs this object as well. Otherwise, -EBUSY is returned to
the user-space. Device removal is synced with SRCU as of today.
If we were using locks, we would have need to sort the given user-space handles.
Otherwise, a user-space application may result in causing a deadlock.
Moving to a non blocking lock based behaviour, the dispatching in kernel
becomes more efficient.

Further uverbs related subsystem (such as RDMA-CM) may use other fds or use
other ioctl codes.

Regards,
Liran, Haggai, Leon and Matan

TODO:
1. Address Jason's comments

Changes from V1:
1. Refined locking system
	a. try_read_lock and write lock to sync exclusive access
	b. SRCU to sync device removal from commands execution
	c. Future rwsem to sync close context from commands execution
2. Added temporary udata usage for vendor's data
3. Add query_device and init_ucontext command with mlx5 implementation
4. Fixed bugs in ioctl dispatching
5. Change callbacks to get ib_uverbs_file instead of ucontext
6. Add general types initialization and cleanups

Haggai Eran (1):
  RDMA/core: Add support for custom types

Leon Romanovsky (2):
  RDMA/core: Export RDMA IOCTL declarations
  RDMA/core: Refactor IDR to be per-device

Matan Barak (5):
  RDMA/core: Introduce add/remove uobj from types
  RDMA/core: Add new ioctl interface
  RDMA/core: Add initialize and cleanup of common types
  RDMA/core: Add common code for querying device and init context
  RDMA/mlx5: Add mlx5 initial support of the new infrastructure

 drivers/infiniband/core/Makefile           |   3 +-
 drivers/infiniband/core/device.c           |  18 ++
 drivers/infiniband/core/rdma_core.c        | 378 ++++++++++++++++++++++++++
 drivers/infiniband/core/rdma_core.h        |  90 +++++++
 drivers/infiniband/core/user_mad.c         |   2 +-
 drivers/infiniband/core/uverbs.h           |  29 +-
 drivers/infiniband/core/uverbs_cmd.c       | 157 ++++++-----
 drivers/infiniband/core/uverbs_ioctl.c     | 279 ++++++++++++++++++++
 drivers/infiniband/core/uverbs_ioctl_cmd.c | 410 +++++++++++++++++++++++++++++
 drivers/infiniband/core/uverbs_main.c      | 125 +--------
 drivers/infiniband/hw/mlx5/Makefile        |   3 +-
 drivers/infiniband/hw/mlx5/main.c          |  12 +-
 drivers/infiniband/hw/mlx5/mlx5_user_cmd.c |  69 +++++
 drivers/infiniband/hw/mlx5/user.h          |   3 +
 include/rdma/ib_verbs.h                    |  27 +-
 include/rdma/rdma_ioctl.h                  |  38 +++
 include/rdma/uverbs_ioctl.h                | 234 ++++++++++++++++
 include/rdma/uverbs_ioctl_cmd.h            | 134 ++++++++++
 include/uapi/rdma/Kbuild                   |   1 +
 include/uapi/rdma/ib_user_mad.h            |  12 -
 include/uapi/rdma/rdma_user_ioctl.h        |  82 ++++++
 21 files changed, 1877 insertions(+), 229 deletions(-)
 create mode 100644 drivers/infiniband/core/rdma_core.c
 create mode 100644 drivers/infiniband/core/rdma_core.h
 create mode 100644 drivers/infiniband/core/uverbs_ioctl.c
 create mode 100644 drivers/infiniband/core/uverbs_ioctl_cmd.c
 create mode 100644 drivers/infiniband/hw/mlx5/mlx5_user_cmd.c
 create mode 100644 include/rdma/rdma_ioctl.h
 create mode 100644 include/rdma/uverbs_ioctl.h
 create mode 100644 include/rdma/uverbs_ioctl_cmd.h
 create mode 100644 include/uapi/rdma/rdma_user_ioctl.h

-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-07-27 18:58 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-19 15:23 [RFC ABI V2 0/8] SG-based RDMA ABI Proposal Matan Barak
     [not found] ` <1468941812-32286-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-07-19 15:23   ` [RFC ABI V2 1/8] RDMA/core: Export RDMA IOCTL declarations Matan Barak
     [not found]     ` <1468941812-32286-2-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-07-20  1:06       ` Christoph Lameter
     [not found]         ` <alpine.DEB.2.20.1607192004510.5828-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-07-20  3:15           ` Leon Romanovsky
2016-07-21  8:07       ` Christoph Hellwig
     [not found]         ` <20160721080719.GB21060-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-07-21 10:49           ` Leon Romanovsky
2016-07-19 15:23   ` [RFC ABI V2 2/8] RDMA/core: Refactor IDR to be per-device Matan Barak
     [not found]     ` <1468941812-32286-3-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-07-20  1:15       ` Christoph Lameter
     [not found]         ` <alpine.DEB.2.20.1607192014010.5828-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-07-20  3:20           ` Leon Romanovsky
     [not found]             ` <20160720032037.GR20674-2ukJVAZIZ/Y@public.gmane.org>
2016-07-20 17:08               ` Jason Gunthorpe
2016-07-20 17:41       ` Jason Gunthorpe
     [not found]         ` <20160720174122.GJ21460-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-21 11:52           ` Matan Barak
     [not found]             ` <13309138-dd3f-7411-d750-4ff370d55daa-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-07-21 16:51               ` Jason Gunthorpe
2016-07-19 15:23   ` [RFC ABI V2 3/8] RDMA/core: Add support for custom types Matan Barak
2016-07-19 15:23   ` [RFC ABI V2 4/8] RDMA/core: Introduce add/remove uobj from types Matan Barak
2016-07-19 15:23   ` [RFC ABI V2 5/8] RDMA/core: Add new ioctl interface Matan Barak
     [not found]     ` <1468941812-32286-6-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-07-20  1:25       ` Christoph Lameter
     [not found]         ` <alpine.DEB.2.20.1607192021500.5828-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-07-20  8:11           ` Matan Barak
     [not found]             ` <53dd8337-0779-341e-49f5-ad675269bfe6-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-07-20 10:03               ` Christoph Lameter
     [not found]                 ` <alpine.DEB.2.20.1607200448370.12616-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-07-20 11:56                   ` Matan Barak
     [not found]                     ` <0fc727fd-bc35-b2bd-f4a7-04efd937d4c3-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-07-21  0:38                       ` Christoph Lameter
2016-07-20 17:21                   ` Jason Gunthorpe
     [not found]                     ` <20160720172143.GG21460-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-21  0:57                       ` Christoph Lameter
     [not found]                         ` <alpine.DEB.2.20.1607201950160.24804-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-07-21  1:56                           ` Jason Gunthorpe
     [not found]                             ` <20160721015613.GB8279-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-21  2:41                               ` Christoph Lameter
     [not found]                                 ` <alpine.DEB.2.20.1607202132080.26260-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-07-21  3:28                                   ` Jason Gunthorpe
     [not found]                                     ` <20160721032803.GA12093-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-21  5:00                                       ` Christoph Lameter
     [not found]                                         ` <alpine.DEB.2.20.1607202340280.26638-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-07-21  5:44                                           ` Jason Gunthorpe
     [not found]                                             ` <20160721054439.GA19329-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-21  7:11                                               ` Christoph Lameter
     [not found]                                                 ` <alpine.DEB.2.20.1607210202400.29415-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-07-21 16:41                                                   ` Jason Gunthorpe
     [not found]                                                     ` <20160721164133.GD19849-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-25 16:30                                                       ` Christoph Lameter
     [not found]                                                         ` <alpine.DEB.2.20.1607251104370.23039-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-07-25 18:01                                                           ` Jason Gunthorpe
     [not found]                                                             ` <20160725180119.GB18773-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-27 15:03                                                               ` Christoph Lameter
     [not found]                                                                 ` <alpine.DEB.2.20.1607270954150.25436-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-07-27 17:28                                                                   ` Parav Pandit
     [not found]                                                                     ` <CAG53R5XZ9RVg-2yGFbr-7To1SMbRoGG3xiZHf-vNnGM4K+R4pw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-27 18:03                                                                       ` Christoph Lameter
     [not found]                                                                         ` <alpine.DEB.2.20.1607271300150.27032-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-07-27 18:56                                                                           ` Parav Pandit
     [not found]                                                                             ` <CAG53R5V07Q-O8cmm3Ad23qsH3oDQiw9nL87yG2=ki=Rgg9LQAA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-27 18:58                                                                               ` Christoph Lameter
2016-07-21  8:04                                               ` Christoph Hellwig
     [not found]                                                 ` <20160721080433.GA21060-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-07-21 16:20                                                   ` Jason Gunthorpe
     [not found]                                                     ` <20160721162033.GB19849-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-25 16:32                                                       ` Christoph Lameter
     [not found]                                                         ` <alpine.DEB.2.20.1607251131000.23039-wcBtFHqTun5QOdAKl3ChDw@public.gmane.org>
2016-07-25 17:39                                                           ` Jason Gunthorpe
2016-07-19 15:23   ` [RFC ABI V2 6/8] RDMA/core: Add initialize and cleanup of common types Matan Barak
     [not found]     ` <1468941812-32286-7-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-07-20 17:40       ` Jason Gunthorpe
     [not found]         ` <20160720174052.GI21460-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-21 11:40           ` Matan Barak
2016-07-19 15:23   ` [RFC ABI V2 7/8] RDMA/core: Add common code for querying device and init context Matan Barak
2016-07-19 15:23   ` [RFC ABI V2 8/8] RDMA/mlx5: Add mlx5 initial support of the new infrastructure Matan Barak
     [not found]     ` <1468941812-32286-9-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-07-20 17:39       ` Jason Gunthorpe
     [not found]         ` <20160720173927.GH21460-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-21 11:38           ` Matan Barak
     [not found]             ` <8ffd0f92-2564-cc39-10ab-5db287399e82-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-07-21 16:49               ` Jason Gunthorpe
     [not found]                 ` <20160721164952.GE19849-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-24  6:18                   ` Matan Barak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.