Netdev List
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
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,
	yanjun.zhu@linux.dev, cui.tao@linux.dev
Subject: [PATCH rdma-next v2 12/14] RDMA/rxe: Allow queue VMAs to outlive ucontexts
Date: Tue, 14 Jul 2026 16:29:25 +0200	[thread overview]
Message-ID: <20260714142927.1298897-13-jiri@resnulli.us> (raw)
In-Reply-To: <20260714142927.1298897-1-jiri@resnulli.us>

From: Jiri Pirko <jiri@nvidia.com>

Prepare queue mappings for asynchronous ucontext disassociation during
device disable. Rely on the VMA page references to preserve mapped
memory until the final unmap.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
v1->v2:
- new patch
---
 drivers/infiniband/sw/rxe/rxe_mmap.c | 35 ++--------------------------
 1 file changed, 2 insertions(+), 33 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_mmap.c b/drivers/infiniband/sw/rxe/rxe_mmap.c
index 7f723a2f3700..a4ead89ccbd3 100644
--- a/drivers/infiniband/sw/rxe/rxe_mmap.c
+++ b/drivers/infiniband/sw/rxe/rxe_mmap.c
@@ -11,7 +11,6 @@
 
 #include "rxe.h"
 #include "rxe_loc.h"
-#include "rxe_queue.h"
 
 void rxe_mmap_release(struct kref *ref)
 {
@@ -30,29 +29,6 @@ void rxe_mmap_release(struct kref *ref)
 	kfree(ip);
 }
 
-/*
- * open and close keep track of how many times the memory region is mapped,
- * to avoid releasing it.
- */
-static void rxe_vma_open(struct vm_area_struct *vma)
-{
-	struct rxe_mmap_info *ip = vma->vm_private_data;
-
-	kref_get(&ip->ref);
-}
-
-static void rxe_vma_close(struct vm_area_struct *vma)
-{
-	struct rxe_mmap_info *ip = vma->vm_private_data;
-
-	kref_put(&ip->ref, rxe_mmap_release);
-}
-
-static const struct vm_operations_struct rxe_vm_ops = {
-	.open = rxe_vma_open,
-	.close = rxe_vma_close,
-};
-
 /**
  * rxe_mmap - create a new mmap region
  * @context: the IB user context of the process making the mmap() call
@@ -106,17 +82,10 @@ int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
 	list_del_init(&ip->pending_mmaps);
 	spin_unlock_bh(&rxe->pending_lock);
 
-	vma->vm_ops = &rxe_vm_ops;
-	vma->vm_private_data = ip;
-
 	ret = remap_vmalloc_range(vma, ip->obj, 0);
-	if (ret) {
-		vma->vm_private_data = NULL;
-		vma->vm_ops = NULL;
-		kref_put(&ip->ref, rxe_mmap_release);
+	kref_put(&ip->ref, rxe_mmap_release);
+	if (ret)
 		rxe_dbg_dev(rxe, "err %d from remap_vmalloc_range\n", ret);
-		goto done;
-	}
 
 done:
 	return ret;
-- 
2.54.0


  parent reply	other threads:[~2026-07-14 14:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14 14:29 [PATCH rdma-next v2 00/14] RDMA: Make device names unique per net namespace Jiri Pirko
2026-07-14 14:29 ` [PATCH rdma-next v2 01/14] RDMA/core: Pass the net namespace to the device name lookups Jiri Pirko
2026-07-14 14:29 ` [PATCH rdma-next v2 02/14] RDMA/core: Handle device name conflicts when changing net namespace Jiri Pirko
2026-07-14 14:29 ` [PATCH rdma-next v2 03/14] RDMA/core: Support renaming a device when changing its " Jiri Pirko
2026-07-14 14:29 ` [PATCH rdma-next v2 04/14] RDMA/nldev: Report net namespace move errors through extack Jiri Pirko
2026-07-14 14:29 ` [PATCH rdma-next v2 05/14] RDMA/nldev: Allow setting the device name while changing net namespace Jiri Pirko
2026-07-14 14:29 ` [PATCH rdma-next v2 06/14] net/smc: Look up the pnetid ib device within the " Jiri Pirko
2026-07-14 14:29 ` [PATCH rdma-next v2 07/14] RDMA/srp: Make the SRP sysfs class net namespace aware Jiri Pirko
2026-07-14 14:29 ` [PATCH rdma-next v2 08/14] RDMA/cgroup: Disambiguate devices across net namespaces Jiri Pirko
2026-07-14 14:29 ` [PATCH rdma-next v2 09/14] RDMA/cma: Document that CM configfs cannot be net namespace scoped Jiri Pirko
2026-07-14 14:29 ` [PATCH rdma-next v2 10/14] RDMA/core: Document the SELinux ibendport net namespace limitation Jiri Pirko
2026-07-14 14:29 ` [PATCH rdma-next v2 11/14] RDMA/core: Make device names unique per net namespace Jiri Pirko
2026-07-14 14:29 ` Jiri Pirko [this message]
2026-07-14 14:29 ` [PATCH rdma-next v2 13/14] RDMA/rxe: Implement disassociate_ucontext callback Jiri Pirko
2026-07-14 14:29 ` [PATCH rdma-next v2 14/14] RDMA/selftests: Add rxe_netns_names test Jiri Pirko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260714142927.1298897-13-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=alibuda@linux.alibaba.com \
    --cc=bvanassche@acm.org \
    --cc=cgroups@vger.kernel.org \
    --cc=cmeiohas@nvidia.com \
    --cc=cui.tao@linux.dev \
    --cc=dust.li@linux.alibaba.com \
    --cc=hannes@cmpxchg.org \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=mkoutny@suse.com \
    --cc=netdev@vger.kernel.org \
    --cc=parav@nvidia.com \
    --cc=roman.gushchin@linux.dev \
    --cc=shuah@kernel.org \
    --cc=sidraya@linux.ibm.com \
    --cc=tj@kernel.org \
    --cc=wenjia@linux.ibm.com \
    --cc=yanjun.zhu@linux.dev \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox