mbox series

[v1,00/10] Allow dissociation after destroy for the ioctl methods

Message ID 20180810021444.14014-1-jgg@ziepe.ca (mailing list archive)
Headers show
Series Allow dissociation after destroy for the ioctl methods | expand

Message

Jason Gunthorpe Aug. 10, 2018, 2:14 a.m. UTC
From: Jason Gunthorpe <jgg@mellanox.com>

The previous series fixed this for the write methods, but the ioctl
methods had an additional problem where the ioctl parser relies on
datastructures stored in the driver's rodata.

This series solves this by revising how the parsing tree is stored in
memory. A new datastructure called 'uverbs_api' is introduced that builds
the rodata description into a proper kernel radix tree with an optimized
small value 'bkey' for attributes.

The new datastructure is designed to allow a driver to disassociate from
the runtime api description so that non-driver methods like destroy can
continue to work.

The major rework in datastructures and parsing of ioctl provides a nice
code simplification, source code size reduction and I measure
approximately a 6% reduction in ioctl syscall time overhead.

The downside is that this uses a bit more memory in the radix tree, but
that is likely negligible for RDMA.

This data structure design is intended to support future series that will
rework how the rodata description is stored to add more features, reduce
its size, and reduce the complexity required to build the rodata.

v1:
- For loop bug fig from Leon
- Missing check in lookup_get_fd_uobject from Leon
- Use rcu_assign_pointer when setting handler for sparse, from Leon
- Dead code from Michael
- Various comment and commit message edits

More testing has shown that the prior series introduced a bug related to
module unload of drivers when working with the mlx5 driver specific
objects. This series is needed to fix that bug, so I would like to apply it on
Friday.

Jason Gunthorpe (10):
  IB/uverbs: Have the core code create the uverbs_root_spec
  IB/uverbs: Build the specs into a radix tree at runtime
  IB/uverbs: Use uverbs_api to manage the object type inside the uobject
  IB/uverbs: Provide implementation private memory for the
    uverbs_attr_bundle
  IB/uverbs: Remove the ib_uverbs_attr pointer from each attr
  IB/uverbs: Add a simple allocator to uverbs_attr_bundle
  IB/uverbs: Use uverbs_alloc for allocations
  IB/uverbs: Use uverbs_api to unmarshal ioctl commands
  IB/uverbs: Remove struct uverbs_root_spec and all supporting code
  IB/uverbs: Do not check for device disassociation during ioctl

 drivers/infiniband/core/Makefile              |   5 +-
 drivers/infiniband/core/rdma_core.c           | 145 ++--
 drivers/infiniband/core/rdma_core.h           |  60 +-
 drivers/infiniband/core/uverbs.h              |   2 +-
 drivers/infiniband/core/uverbs_ioctl.c        | 675 ++++++++++--------
 drivers/infiniband/core/uverbs_ioctl_merge.c  | 664 -----------------
 drivers/infiniband/core/uverbs_main.c         |  40 +-
 drivers/infiniband/core/uverbs_std_types.c    |  33 -
 .../core/uverbs_std_types_counters.c          |  20 +-
 drivers/infiniband/core/uverbs_uapi.c         | 346 +++++++++
 drivers/infiniband/hw/mlx5/devx.c             |  83 +--
 drivers/infiniband/hw/mlx5/main.c             |  45 +-
 drivers/infiniband/hw/mlx5/mlx5_ib.h          |   1 +
 include/rdma/ib_verbs.h                       |   4 +-
 include/rdma/uverbs_ioctl.h                   | 301 ++++----
 include/rdma/uverbs_std_types.h               |  30 +-
 include/rdma/uverbs_types.h                   |   9 +-
 17 files changed, 1083 insertions(+), 1380 deletions(-)
 delete mode 100644 drivers/infiniband/core/uverbs_ioctl_merge.c
 create mode 100644 drivers/infiniband/core/uverbs_uapi.c

Comments

Jason Gunthorpe Aug. 10, 2018, 10:09 p.m. UTC | #1
On Thu, Aug 09, 2018 at 08:14:34PM -0600, Jason Gunthorpe wrote:
> From: Jason Gunthorpe <jgg@mellanox.com>
> 
> The previous series fixed this for the write methods, but the ioctl
> methods had an additional problem where the ioctl parser relies on
> datastructures stored in the driver's rodata.
> 
> This series solves this by revising how the parsing tree is stored in
> memory. A new datastructure called 'uverbs_api' is introduced that builds
> the rodata description into a proper kernel radix tree with an optimized
> small value 'bkey' for attributes.
> 
> The new datastructure is designed to allow a driver to disassociate from
> the runtime api description so that non-driver methods like destroy can
> continue to work.
> 
> The major rework in datastructures and parsing of ioctl provides a nice
> code simplification, source code size reduction and I measure
> approximately a 6% reduction in ioctl syscall time overhead.
> 
> The downside is that this uses a bit more memory in the radix tree, but
> that is likely negligible for RDMA.
> 
> This data structure design is intended to support future series that will
> rework how the rodata description is stored to add more features, reduce
> its size, and reduce the complexity required to build the rodata.
> 
> v1:
> - For loop bug fig from Leon
> - Missing check in lookup_get_fd_uobject from Leon
> - Use rcu_assign_pointer when setting handler for sparse, from Leon
> - Dead code from Michael
> - Various comment and commit message edits
> 
> More testing has shown that the prior series introduced a bug related to
> module unload of drivers when working with the mlx5 driver specific
> objects. This series is needed to fix that bug, so I would like to apply it on
> Friday.
> 
> Jason Gunthorpe (10):
>   IB/uverbs: Have the core code create the uverbs_root_spec
>   IB/uverbs: Build the specs into a radix tree at runtime
>   IB/uverbs: Use uverbs_api to manage the object type inside the uobject
>   IB/uverbs: Provide implementation private memory for the
>     uverbs_attr_bundle
>   IB/uverbs: Remove the ib_uverbs_attr pointer from each attr
>   IB/uverbs: Add a simple allocator to uverbs_attr_bundle
>   IB/uverbs: Use uverbs_alloc for allocations
>   IB/uverbs: Use uverbs_api to unmarshal ioctl commands
>   IB/uverbs: Remove struct uverbs_root_spec and all supporting code
>   IB/uverbs: Do not check for device disassociation during ioctl

applied to for-next

Jason