Skip to content

RDMA: Make device names unique per net namespace

Jiri Pirko cgroups linux-kselftest linux-rdma linux-s390 netdev sashiko-reviews 3 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest14 patches 12 repliesApplied
  2. v214 patches 4 repliesSuperseded
  3. v113 patches 14 repliesSuperseded

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/14RDMA/core: Pass the net namespace to the device name lookupsdrivers/infiniband/core/device.c+18 -80 replies
2/14RDMA/core: Handle device name conflicts when changing net namespacedrivers/infiniband/core/device.c drivers/infiniband/core/nldev.c+137 -211 reply
3/14RDMA/core: Support renaming a device when changing its net namespacedrivers/infiniband/core/core_priv.h drivers/infiniband/core/device.c drivers/infiniband/core/nldev.c+35 -171 reply
4/14RDMA/nldev: Report net namespace move errors through extackdrivers/infiniband/core/core_priv.h drivers/infiniband/core/device.c drivers/infiniband/core/nldev.c+26 -71 reply
5/14RDMA/nldev: Allow setting the device name while changing net namespacedrivers/infiniband/core/device.c drivers/infiniband/core/nldev.c include/uapi/rdma/rdma_netlink.h+28 -100 replies
6/14net/smc: Look up the pnetid ib device within the net namespacenet/smc/smc_pnet.c+14 -61 reply
7/14RDMA/srp: Make the SRP sysfs class net namespace awaredrivers/infiniband/ulp/srp/ib_srp.c+15 -11 reply
8/14RDMA/cgroup: Disambiguate devices across net namespacesDocumentation/admin-guide/cgroup-v1/rdma.rst Documentation/admin-guide/cgroup-v2.rst drivers/infiniband/core/cgroup.c +2 more+83 -131 reply
9/14RDMA/cma: Document that CM configfs cannot be net namespace scopedDocumentation/ABI/testing/configfs-rdma_cm drivers/infiniband/core/cma_configfs.c+8 -00 replies
10/14RDMA/core: Document the SELinux ibendport net namespace limitationdrivers/infiniband/core/security.c+6 -00 replies
11/14RDMA/core: Make device names unique per net namespacedrivers/infiniband/core/device.c+15 -70 replies
12/14RDMA/rxe: Allow queue VMAs to outlive ucontextsdrivers/infiniband/sw/rxe/rxe_mmap.c+2 -330 replies
13/14RDMA/rxe: Implement disassociate_ucontext callbackdrivers/infiniband/sw/rxe/rxe_verbs.c+5 -00 replies
14/14RDMA/selftests: Add rxe_netns_names testtools/testing/selftests/rdma/Makefile tools/testing/selftests/rdma/config tools/testing/selftests/rdma/rxe_netns_names.sh+338 -12 replies

Reviews trailers per patch

1 of 14 patches has a Reviewed-by or Acked-by.

PatchBart Van Assche
1/14
2/14
3/14
4/14
5/14
6/14
7/14R-b
8/14
9/14
10/14
11/14
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH rdma-next v3 00/14] RDMA: Make device names unique per net namespace

From: Jiri Pirko <[email protected]>

RDMA device names are unique system-wide today:
__ib_device_get_by_name() checks a requested name against every registered device regardless of the network namespace it lives in. A device in one network namespace therefore cannot use a name already taken in another, even in exclusive netns mode (netns_mode=0) where the two are otherwise isolated. Net devices have no such restriction - their names only need to be unique within a network namespace.

This series makes RDMA device names unique per network namespace, matching net device semantics, and adapts the users that assumed system-wide unique names.

Scoping reuses the existing rdma_dev_access_netns() predicate, so behavior only changes in exclusive mode:
- shared mode (default): names stay unique system-wide, no change;
- exclusive mode: names only need to be unique within a namespace;
- CONFIG_NET_NS=n: everything is init_net, names stay system-wide unique.

There are two users that cannot be made per-namespace and are documented as known limitations instead of changed:
- the rdma_cm configfs tree: configfs has no network namespace

    support, so it cannot represent two same-named devices;

- SELinux ibendport labelling: endports are labelled by (device name, port) from a global policy; distinguishing same-named devices would need net namespace support in the SELinux policy language and tooling.

Tested with the new rxe_netns_names kselftest added in the last patch.

Jiri Pirko (14):
RDMA/core: Pass the net namespace to the device name lookups RDMA/core: Handle device name conflicts when changing net namespace RDMA/core: Support renaming a device when changing its net namespace RDMA/nldev: Report net namespace move errors through extack RDMA/nldev: Allow setting the device name while changing net namespace net/smc: Look up the pnetid ib device within the net namespace RDMA/srp: Make the SRP sysfs class net namespace aware RDMA/cgroup: Disambiguate devices across net namespaces RDMA/cma: Document that CM configfs cannot be net namespace scoped RDMA/core: Document the SELinux ibendport net namespace limitation RDMA/core: Make device names unique per net namespace RDMA/rxe: Allow queue VMAs to outlive ucontexts
RDMA/rxe: Implement disassociate_ucontext callback RDMA/selftests: Add rxe_netns_names test

 Documentation/ABI/testing/configfs-rdma_cm    |   4 +
 Documentation/admin-guide/cgroup-v1/rdma.rst  |   8 +
 Documentation/admin-guide/cgroup-v2.rst       |  15 +-
 drivers/infiniband/core/cgroup.c              |   1 +
 drivers/infiniband/core/cma_configfs.c        |   4 +
 drivers/infiniband/core/core_priv.h           |   3 +-
 drivers/infiniband/core/device.c              | 245 +++++++++++--
 drivers/infiniband/core/nldev.c               |  26 +-
 drivers/infiniband/core/security.c            |   6 +
 drivers/infiniband/sw/rxe/rxe_mmap.c          |  35 +-
 drivers/infiniband/sw/rxe/rxe_verbs.c         |   5 +
 drivers/infiniband/ulp/srp/ib_srp.c           |  16 +-
 include/linux/cgroup_rdma.h                   |   1 +
 include/uapi/rdma/rdma_netlink.h              |   5 +-
 kernel/cgroup/rdma.c                          |  71 +++-
 net/smc/smc_pnet.c                            |  20 +-
 tools/testing/selftests/rdma/Makefile         |   3 +-
 tools/testing/selftests/rdma/config           |   2 +
 .../testing/selftests/rdma/rxe_netns_names.sh | 334 ++++++++++++++++++
 19 files changed, 705 insertions(+), 99 deletions(-)
 create mode 100755 tools/testing/selftests/rdma/rxe_netns_names.sh
Signature · 1 line
2.54.0