Skip to content

Reorganize sysfs file creation for struct ib_devices

Leon Romanovsky linux-rdma lkml 2 versions – Applied

Status from this message: Applied to for-next, thanks everyone

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest15 patches 4 repliesApplied
  2. v115 patches 23 repliesSuperseded

Changes in v2 from the cover letter

* Make port_attributes visible in init_net namespace.
* Fixed hfi1 compilation warning.
v1: https://lore.kernel.org/lkml/[email protected]
* Added two new patches to the series
RDMA/core: Allow port_groups to be used with namespaces
RDMA: Remove rdma_set_device_sysfs_group()
* Fixed missing ops definition in device.c
* Passed proper internal validation and review
* changed EXPORT_SYMBOL to be EXPORT_SYMBOL_GPL for the ib_port_sysfs_create_groups
* qib was converted to use .is_visible() callback together with static attribute_group declaration.
v0: https://lore.kernel.org/linux-rdma/[email protected]/

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/15RDMA: Split the alloc_hw_stats() ops to port and device variantsdrivers/infiniband/core/counters.c drivers/infiniband/core/device.c drivers/infiniband/core/nldev.c +16 more+142 -1060 replies
2/15RDMA/core: Replace the ib_port_data hw_stats pointers with a ib_port pointerdrivers/infiniband/core/core_priv.h drivers/infiniband/core/nldev.c drivers/infiniband/core/sysfs.c +1 more+16 -100 replies
3/15RDMA/core: Split port and device counter sysfs attributesdrivers/infiniband/core/sysfs.c include/rdma/ib_verbs.h+292 -1700 replies
4/15RDMA/core: Split gid_attrs related sysfs from add_port()drivers/infiniband/core/sysfs.c+89 -710 replies
5/15RDMA/core: Simplify how the gid_attrs sysfs is createddrivers/infiniband/core/sysfs.c+89 -810 replies
6/15RDMA/core: Simplify how the port sysfs is createddrivers/infiniband/core/sysfs.c+103 -2190 replies
7/15RDMA/core: Create the device hw_counters through the normal groups mechanismdrivers/infiniband/core/core_priv.h drivers/infiniband/core/device.c drivers/infiniband/core/sysfs.c +1 more+32 -580 replies
8/15RDMA/core: Remove the kobject_uevent() NOPdrivers/infiniband/core/sysfs.c+0 -20 replies
9/15RDMA/core: Expose the ib port sysfs attribute machinerydrivers/infiniband/core/sysfs.c include/rdma/ib_sysfs.h+158 -1000 replies
10/15RDMA/cm: Use an attribute_group on the ib_port_attribute intead of kobj'sdrivers/infiniband/core/cm.c drivers/infiniband/core/core_priv.h drivers/infiniband/core/sysfs.c+119 -1660 replies
11/15RDMA/qib: Use attributes for the port sysfsdrivers/infiniband/hw/qib/qib.h drivers/infiniband/hw/qib/qib_sysfs.c+254 -3560 replies
12/15RDMA/hfi1: Use attributes for the port sysfsdrivers/infiniband/hw/hfi1/hfi.h drivers/infiniband/hw/hfi1/sysfs.c+194 -3400 replies
13/15RDMA: Change ops->init_port to ops->port_groupsdrivers/infiniband/core/device.c drivers/infiniband/core/sysfs.c drivers/infiniband/hw/hfi1/hfi.h +8 more+25 -780 replies
14/15RDMA/core: Allow port_groups to be used with namespacesdrivers/infiniband/core/device.c+4 -60 replies
15/15RDMA: Remove rdma_set_device_sysfs_group()drivers/infiniband/core/device.c drivers/infiniband/hw/bnxt_re/main.c drivers/infiniband/hw/cxgb4/provider.c +11 more+22 -390 replies

Reviews trailers per patch

None of the 15 patches has a Reviewed-by or Acked-by.

PatchGal PressmanMike MarciniszynNathan Chancellor
SeriesT-b T-b
1/15T-b
2/15
3/15
4/15
5/15
6/15
7/15
8/15
9/15
10/15
11/15
12/15
13/15
14/15
15/15

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH rdma-next v2 00/15] Reorganize sysfs file creation for struct ib_devices

From: Leon Romanovsky <[email protected]>

Changelog:
v2:
* Make port_attributes visible in init_net namespace.
* Fixed hfi1 compilation warning.
v1: https://lore.kernel.org/lkml/[email protected]
* Added two new patches to the series
RDMA/core: Allow port_groups to be used with namespaces
RDMA: Remove rdma_set_device_sysfs_group()
* Fixed missing ops definition in device.c
* Passed proper internal validation and review
* changed EXPORT_SYMBOL to be EXPORT_SYMBOL_GPL for the ib_port_sysfs_create_groups
* qib was converted to use .is_visible() callback together with static attribute_group declaration.
v0: https://lore.kernel.org/linux-rdma/[email protected]/

-------------------------------------------------------------------------------
From Jason,

IB has a complex sysfs with a deep nesting of attributes. Nathan and Kees recently noticed this was not even slightly sane with how it was handling attributes and a deeper inspection shows the whole thing is a pretty "ick" coding style.

Further review shows the ick extends outward from the ib_port sysfs and basically everything is pretty crazy.

Simplify all of it:

- Organize the ib_port and gid_attr's kobj's to have clear setup/destroy function pairings that work only on their own kobjs.

- All memory allocated in service of a kobject's attributes is freed as part of the kobj release function. Thus all the error handling defers the memory frees to a put.

- Build up lists of groups for every kobject and add the entire group list as a one-shot operation as the last thing in setup function.

- Remove essentially all the error cleanup. The final kobject_put() will always free any memory allocated or do an internal kobject_del() if required. The new ordering eliminates all the other cleanup cases.

- Make all attributes use proper typing for the kobj they are attached to. Split device and port hw_stats handling.

- Create a ib_port_attribute type and change hfi1, qib and the CM code to work with attribute lists of ib_port_attribute type instead of building their own kobject madness

Thanks

Jason Gunthorpe (15):
RDMA: Split the alloc_hw_stats() ops to port and device variants RDMA/core: Replace the ib_port_data hw_stats pointers with a ib_port
pointer
RDMA/core: Split port and device counter sysfs attributes RDMA/core: Split gid_attrs related sysfs from add_port() RDMA/core: Simplify how the gid_attrs sysfs is created RDMA/core: Simplify how the port sysfs is created RDMA/core: Create the device hw_counters through the normal groups
mechanism
RDMA/core: Remove the kobject_uevent() NOP
RDMA/core: Expose the ib port sysfs attribute machinery RDMA/cm: Use an attribute_group on the ib_port_attribute intead of
kobj's
RDMA/qib: Use attributes for the port sysfs
RDMA/hfi1: Use attributes for the port sysfs
RDMA: Change ops->init_port to ops->port_groups RDMA/core: Allow port_groups to be used with namespaces
RDMA: Remove rdma_set_device_sysfs_group()

 drivers/infiniband/core/cm.c                  |  227 ++--
 drivers/infiniband/core/core_priv.h           |   13 +-
 drivers/infiniband/core/counters.c            |    4 +-
 drivers/infiniband/core/device.c              |   30 +-
 drivers/infiniband/core/nldev.c               |   10 +-
 drivers/infiniband/core/sysfs.c               | 1100 ++++++++---------
 drivers/infiniband/hw/bnxt_re/hw_counters.c   |    7 +-
 drivers/infiniband/hw/bnxt_re/hw_counters.h   |    4 +-
 drivers/infiniband/hw/bnxt_re/main.c          |    4 +-
 drivers/infiniband/hw/cxgb4/provider.c        |   11 +-
 drivers/infiniband/hw/efa/efa.h               |    3 +-
 drivers/infiniband/hw/efa/efa_main.c          |    3 +-
 drivers/infiniband/hw/efa/efa_verbs.c         |   11 +-
 drivers/infiniband/hw/hfi1/hfi.h              |    7 +-
 drivers/infiniband/hw/hfi1/sysfs.c            |  530 +++-----
 drivers/infiniband/hw/hfi1/verbs.c            |   92 +-
 drivers/infiniband/hw/irdma/verbs.c           |   11 +-
 drivers/infiniband/hw/mlx4/main.c             |   27 +-
 drivers/infiniband/hw/mlx5/counters.c         |   42 +-
 drivers/infiniband/hw/mlx5/main.c             |    2 +-
 drivers/infiniband/hw/mthca/mthca_provider.c  |    2 +-
 drivers/infiniband/hw/ocrdma/ocrdma_main.c    |    2 +-
 drivers/infiniband/hw/qedr/main.c             |    2 +-
 drivers/infiniband/hw/qib/qib.h               |    8 +-
 drivers/infiniband/hw/qib/qib_sysfs.c         |  616 ++++-----
 drivers/infiniband/hw/qib/qib_verbs.c         |    6 +-
 drivers/infiniband/hw/usnic/usnic_ib_main.c   |    3 +-
 .../infiniband/hw/vmw_pvrdma/pvrdma_main.c    |    2 +-
 drivers/infiniband/sw/rdmavt/vt.c             |    2 +-
 drivers/infiniband/sw/rxe/rxe_hw_counters.c   |    7 +-
 drivers/infiniband/sw/rxe/rxe_hw_counters.h   |    4 +-
 drivers/infiniband/sw/rxe/rxe_verbs.c         |    4 +-
 include/rdma/ib_sysfs.h                       |   37 +
 include/rdma/ib_verbs.h                       |   68 +-
 34 files changed, 1319 insertions(+), 1582 deletions(-)
 create mode 100644 include/rdma/ib_sysfs.h
Signature · 1 line
2.31.1