From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98A3B3E9F96 for ; Thu, 9 Jul 2026 09:55:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783590939; cv=none; b=UAFdL7RWgN0xqLlVCwC2ws0nqTHwZiSt97drQQ6h9Np1TgnKDMi1LgjAMDkih+c2THWI+lNvn1aTmhPQaoLvRZ4iKctEh34CWOapbYmv+hCwDvNNlMW+Wf7oHq0g0BCJ2PsdaV2DDaAf+X2Ib6vME9nOhmjyju7wjNdEW0kAqRI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783590939; c=relaxed/simple; bh=6v4UEKMGI0CObOrgOsS9xS28THfpqNdtIwk41b4i1C4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MWtZfK+eKu2rT+6rXGcJrCTyULeQCvPBUOryHtefFhCRyhAz5BQQHLqqe+qR21y6/1D4m29Zx4X9HjSHe/rKwOq3kRnh6PfkSw8iYBO/pg0GvYrhFp5esEuX3qWC58UWbfbeovyIfMsmLFPB95vM38ED5LYO/+QmaPBFoIHem30= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us; spf=none smtp.mailfrom=resnulli.us; dkim=pass (2048-bit key) header.d=resnulli-us.20251104.gappssmtp.com header.i=@resnulli-us.20251104.gappssmtp.com header.b=tVF77iwP; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=resnulli.us Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20251104.gappssmtp.com header.i=@resnulli-us.20251104.gappssmtp.com header.b="tVF77iwP" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-47defd0c1c5so856458f8f.3 for ; Thu, 09 Jul 2026 02:55:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20251104.gappssmtp.com; s=20251104; t=1783590936; x=1784195736; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=FmCpTn/G1BPPqIynBfpobYxeMvV2yASv7FeNNa9VjUc=; b=tVF77iwP1Ox/DAzUEBzdrOQ8mS6gW+oByL/ghjEynEnKN+tjSSSmc/M0RT+qrXQZHw BRK2YhNV4rAqY0PimJRQCX6t8kyx8IRm8j/r/EjpwWFlBCfKAA80psHboQv/KKdI+gH0 s3UCnon8+ODyAp+fSGaZvODXKrsZDAW/CCxPZXI9Hgv8bZzhHCPUO45d1tv9RaHr4AaW tbhz/uwntIp7F2ELvMwIrVNi2xcK9mQM1TKCMW+TWnSCf6sQaCNvg0GIP5jMsBlLE2r4 iEM5JeRYs6GXj2Wn5/us9A8wLGK1WrOYWk0CkwmWAsA2zt4CFHNK6Cy4qw/ndvMj1iOU MvIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783590936; x=1784195736; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=FmCpTn/G1BPPqIynBfpobYxeMvV2yASv7FeNNa9VjUc=; b=GN8vPP+ypMBp8MIGCL/LF5wwVldB8Skejwwhtdw8AJJQ+f0DEUYhm3kTY8xjTDDM8a jpfldK2hSnK26qcbR4WAE0A846EFr17K1cs9aHZrPhuQDEoxaxHc5J1fiIIc2+1qbvSZ afUyJdGgEKDK9ZYloqBsu57IVO0x70hT+5Z5fr2+y5Co6tyAFbCW0LYhg3Xdhnjd64MF /RX3llfp4a2szr2kp72nkfU7pU0+aCza9MOrl0Urw95lafLb8YxGYNcfKiEklLUSbtub 74wa3lOZyS4BvvphR4X0kECmXQlIatmsb/NKJzwh2Mw2x/B6+cHiF7I7LaBcjhIKPbuu oXUA== X-Forwarded-Encrypted: i=1; AHgh+Ro7wO+QBsEM484TX/Ndisah7ifCdTLG6ktmlh5jq76att5pq67fbqGzdctTasulFPyDknPMEXXOd+CZ@vger.kernel.org X-Gm-Message-State: AOJu0YyoWemiXFLNN+rN0+PcDajcTAjwOCyrPOkdGD8F2N07PC0uBZV8 Bsc5TjDKwfWRYN1+KY4AqTgysevv5dgB82zQ3yb19B2Kbxgx7PIlc8nTKyppZaCUUHA= X-Gm-Gg: AfdE7clk56di20RJw7JCdDypDAY3z7Ba3seUk63XPro1v/7UkYsrAloGyr0l9s82X3v bn1mOWnlIes+fFjzL5gzjrh4ACaOFXi6Ox4RQUZPxIBt+ouG6iNMAUi+5raQUXZBsbZGJc9A+PV vkQ37bMcPzeASPmiMbwAYAh0bwETKsH2NycJR6Mo3FZbgo3F5twjI5JsnH1MH55tbUJPCWUDBDx cxGkECsnwPoOxusj24dlGw4u8UEo3ym40EvGLW8tZbzcnx3R1fRimXebx2Rq378h8ogklOTpeJT 2TCMis47I8jK9j0fdRcMiscGLYIpoPsR+8+ONP2g2W0WD33rPh+OgpHqmm/4fobv/lcNZLKpaFS cLb4nKnZzq78fDDBRvupzp0T0StpDi2vznZPyJFS9/Nt7+BkKFXhMxfPKpFakIVSdb0XiSxsL3S BisH659LDJUNclFqTOz9UrLA== X-Received: by 2002:a05:6000:144e:b0:47d:dfea:f729 with SMTP id ffacd0b85a97d-47df07a18bcmr7413288f8f.4.1783590935982; Thu, 09 Jul 2026 02:55:35 -0700 (PDT) Received: from localhost ([140.209.217.211]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47df6a31dd5sm5243415f8f.16.2026.07.09.02.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2026 02:55:35 -0700 (PDT) From: Jiri Pirko To: linux-rdma@vger.kernel.org Cc: cgroups@vger.kernel.org, netdev@vger.kernel.org, linux-s390@vger.kernel.org, linux-kselftest@vger.kernel.org, jgg@ziepe.ca, leon@kernel.org, parav@nvidia.com, mbloch@nvidia.com, cmeiohas@nvidia.com, roman.gushchin@linux.dev, bvanassche@acm.org, zyjzyj2000@gmail.com, shuah@kernel.org, tj@kernel.org, mkoutny@suse.com, hannes@cmpxchg.org, alibuda@linux.alibaba.com, dust.li@linux.alibaba.com, sidraya@linux.ibm.com, wenjia@linux.ibm.com Subject: [PATCH rdma-next 00/13] RDMA: Make device names unique per net namespace Date: Thu, 9 Jul 2026 11:55:19 +0200 Message-ID: <20260709095532.855647-1-jiri@resnulli.us> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Jiri Pirko 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 (13): 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: Scope rdma cgroup device visibility to the net namespace 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: Implement disassociate_ucontext callback RDMA/selftests: Add rxe_netns_names test Documentation/ABI/testing/configfs-rdma_cm | 4 + Documentation/admin-guide/cgroup-v2.rst | 7 + drivers/infiniband/core/cgroup.c | 12 + drivers/infiniband/core/cma_configfs.c | 4 + drivers/infiniband/core/core_priv.h | 15 +- drivers/infiniband/core/device.c | 256 +++++++++++++--- drivers/infiniband/core/nldev.c | 26 +- drivers/infiniband/core/security.c | 6 + drivers/infiniband/sw/rxe/rxe_verbs.c | 5 + drivers/infiniband/ulp/srp/ib_srp.c | 16 +- include/linux/cgroup_rdma.h | 10 + include/uapi/rdma/rdma_netlink.h | 5 +- kernel/cgroup/rdma.c | 20 +- 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 | 282 ++++++++++++++++++ 17 files changed, 639 insertions(+), 54 deletions(-) create mode 100755 tools/testing/selftests/rdma/rxe_netns_names.sh -- 2.54.0