Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Mar 2018 18:45:47 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r331792 - stable/11/sys/dev/mlx4/mlx4_ib
Message-ID:  <201803301845.w2UIjlZK083290@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Mar 30 18:45:47 2018
New Revision: 331792
URL: https://svnweb.freebsd.org/changeset/base/331792

Log:
  MFC r330594:
  Disable unsupported disassociate ucontext functionality in mlx4ib(4).
  
  Sponsored by:	Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
==============================================================================
--- stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c	Fri Mar 30 18:44:51 2018	(r331791)
+++ stable/11/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c	Fri Mar 30 18:45:47 2018	(r331792)
@@ -1135,68 +1135,6 @@ static const struct vm_operations_struct mlx4_ib_vm_op
 	.close = mlx4_ib_vma_close
 };
 
-static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext)
-{
-	int i;
-	int ret = 0;
-	struct vm_area_struct *vma;
-	struct mlx4_ib_ucontext *context = to_mucontext(ibcontext);
-	struct task_struct *owning_process  = NULL;
-	struct mm_struct   *owning_mm       = NULL;
-
-	owning_process = get_pid_task(ibcontext->tgid, PIDTYPE_PID);
-	if (!owning_process)
-		return;
-
-	owning_mm = get_task_mm(owning_process);
-	if (!owning_mm) {
-		pr_info("no mm, disassociate ucontext is pending task termination\n");
-		while (1) {
-			/* make sure that task is dead before returning, it may
-			 * prevent a rare case of module down in parallel to a
-			 * call to mlx4_ib_vma_close.
-			 */
-			put_task_struct(owning_process);
-			msleep(1);
-			owning_process = get_pid_task(ibcontext->tgid,
-						      PIDTYPE_PID);
-			if (!owning_process /* ||
-			    owning_process->state == TASK_DEAD */) {
-				pr_info("disassociate ucontext done, task was terminated\n");
-				/* in case task was dead need to release the task struct */
-				if (owning_process)
-					put_task_struct(owning_process);
-				return;
-			}
-		}
-	}
-
-	/* need to protect from a race on closing the vma as part of
-	 * mlx4_ib_vma_close().
-	 */
-	down_read(&owning_mm->mmap_sem);
-	for (i = 0; i < HW_BAR_COUNT; i++) {
-		vma = context->hw_bar_info[i].vma;
-		if (!vma)
-			continue;
-
-		ret = zap_vma_ptes(context->hw_bar_info[i].vma,
-				   context->hw_bar_info[i].vma->vm_start,
-				   PAGE_SIZE);
-		if (ret) {
-			pr_err("Error: zap_vma_ptes failed for index=%d, ret=%d\n", i, ret);
-			BUG_ON(1);
-		}
-
-		/* context going to be destroyed, should not access ops any more */
-		context->hw_bar_info[i].vma->vm_ops = NULL;
-	}
-
-	up_read(&owning_mm->mmap_sem);
-	mmput(owning_mm);
-	put_task_struct(owning_process);
-}
-
 static void mlx4_ib_set_vma_data(struct vm_area_struct *vma,
 				 struct mlx4_ib_vma_private_data *vma_private_data)
 {
@@ -2695,7 +2633,6 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 	ibdev->ib_dev.process_mad	= mlx4_ib_process_mad;
 	ibdev->ib_dev.get_port_immutable = mlx4_port_immutable;
 	ibdev->ib_dev.get_dev_fw_str    = get_fw_ver_str;
-	ibdev->ib_dev.disassociate_ucontext = mlx4_ib_disassociate_ucontext;
 
 	if (!mlx4_is_slave(ibdev->dev)) {
 		ibdev->ib_dev.alloc_fmr		= mlx4_ib_fmr_alloc;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803301845.w2UIjlZK083290>