aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx5/main.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-12-29 02:06:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-12-29 02:06:01 -0500
commit19286e4a7a0ce0a7ac584be614c40513d6318ad6 (patch)
tree10b2f6defef19db7a49a66c940d4ba53221cee95 /drivers/infiniband/hw/mlx5/main.c
parent5f520fc318764df800789edd202b5e3b55130613 (diff)
parent45e6ae7ef21b907dacb18da62d5787d74a31d860 (diff)
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma fixes from Jason Gunthorpe: "This is the next batch of for-rc patches from RDMA. It includes the fix for the ipoib regression I mentioned last time, and the result of a fairly major debugging effort to get iser working reliably on cxgb4 hardware - it turns out the cxgb4 driver was not handling QP error flushing properly causing iser to fail. - cxgb4 fix for an iser testing failure as debugged by Steve and Sagi. The problem was a driver bug in the handling of shutting down a QP. - Various vmw_pvrdma fixes for bogus WARN_ON, missed resource free on error unwind and a use after free bug - Improper congestion counter values on mlx5 when link aggregation is enabled - ipoib lockdep regression introduced in this merge window - hfi1 regression supporting the device in a VM introduced in a recent patch - Typo that breaks future uAPI compatibility in the verbs core - More SELinux related oops fixing - Fix an oops during error unwind in mlx5" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: IB/mlx5: Fix mlx5_ib_alloc_mr error flow IB/core: Verify that QP is security enabled in create and destroy IB/uverbs: Fix command checking as part of ib_uverbs_ex_modify_qp() IB/mlx5: Serialize access to the VMA list IB/hfi: Only read capability registers if the capability exists IB/ipoib: Fix lockdep issue found on ipoib_ib_dev_heavy_flush IB/mlx5: Fix congestion counters in LAG mode RDMA/vmw_pvrdma: Avoid use after free due to QP/CQ/SRQ destroy RDMA/vmw_pvrdma: Use refcount_dec_and_test to avoid warning RDMA/vmw_pvrdma: Call ib_umem_release on destroy QP path iw_cxgb4: when flushing, complete all wrs in a chain iw_cxgb4: reflect the original WR opcode in drain cqes iw_cxgb4: Only validate the MSN for successful completions
Diffstat (limited to 'drivers/infiniband/hw/mlx5/main.c')
-rw-r--r--drivers/infiniband/hw/mlx5/main.c43
1 files changed, 14 insertions, 29 deletions
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 543d0a4c8bf3..8ac50de2b242 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1463,6 +1463,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev,
1463 } 1463 }
1464 1464
1465 INIT_LIST_HEAD(&context->vma_private_list); 1465 INIT_LIST_HEAD(&context->vma_private_list);
1466 mutex_init(&context->vma_private_list_mutex);
1466 INIT_LIST_HEAD(&context->db_page_list); 1467 INIT_LIST_HEAD(&context->db_page_list);
1467 mutex_init(&context->db_page_mutex); 1468 mutex_init(&context->db_page_mutex);
1468 1469
@@ -1624,7 +1625,9 @@ static void mlx5_ib_vma_close(struct vm_area_struct *area)
1624 * mlx5_ib_disassociate_ucontext(). 1625 * mlx5_ib_disassociate_ucontext().
1625 */ 1626 */
1626 mlx5_ib_vma_priv_data->vma = NULL; 1627 mlx5_ib_vma_priv_data->vma = NULL;
1628 mutex_lock(mlx5_ib_vma_priv_data->vma_private_list_mutex);
1627 list_del(&mlx5_ib_vma_priv_data->list); 1629 list_del(&mlx5_ib_vma_priv_data->list);
1630 mutex_unlock(mlx5_ib_vma_priv_data->vma_private_list_mutex);
1628 kfree(mlx5_ib_vma_priv_data); 1631 kfree(mlx5_ib_vma_priv_data);
1629} 1632}
1630 1633
@@ -1644,10 +1647,13 @@ static int mlx5_ib_set_vma_data(struct vm_area_struct *vma,
1644 return -ENOMEM; 1647 return -ENOMEM;
1645 1648
1646 vma_prv->vma = vma; 1649 vma_prv->vma = vma;
1650 vma_prv->vma_private_list_mutex = &ctx->vma_private_list_mutex;
1647 vma->vm_private_data = vma_prv; 1651 vma->vm_private_data = vma_prv;
1648 vma->vm_ops = &mlx5_ib_vm_ops; 1652 vma->vm_ops = &mlx5_ib_vm_ops;
1649 1653
1654 mutex_lock(&ctx->vma_private_list_mutex);
1650 list_add(&vma_prv->list, vma_head); 1655 list_add(&vma_prv->list, vma_head);
1656 mutex_unlock(&ctx->vma_private_list_mutex);
1651 1657
1652 return 0; 1658 return 0;
1653} 1659}
@@ -1690,6 +1696,7 @@ static void mlx5_ib_disassociate_ucontext(struct ib_ucontext *ibcontext)
1690 * mlx5_ib_vma_close. 1696 * mlx5_ib_vma_close.
1691 */ 1697 */
1692 down_write(&owning_mm->mmap_sem); 1698 down_write(&owning_mm->mmap_sem);
1699 mutex_lock(&context->vma_private_list_mutex);
1693 list_for_each_entry_safe(vma_private, n, &context->vma_private_list, 1700 list_for_each_entry_safe(vma_private, n, &context->vma_private_list,
1694 list) { 1701 list) {
1695 vma = vma_private->vma; 1702 vma = vma_private->vma;
@@ -1704,6 +1711,7 @@ static void mlx5_ib_disassociate_ucontext(struct ib_ucontext *ibcontext)
1704 list_del(&vma_private->list); 1711 list_del(&vma_private->list);
1705 kfree(vma_private); 1712 kfree(vma_private);
1706 } 1713 }
1714 mutex_unlock(&context->vma_private_list_mutex);
1707 up_write(&owning_mm->mmap_sem); 1715 up_write(&owning_mm->mmap_sem);
1708 mmput(owning_mm); 1716 mmput(owning_mm);
1709 put_task_struct(owning_process); 1717 put_task_struct(owning_process);
@@ -3737,34 +3745,6 @@ free:
3737 return ret; 3745 return ret;
3738} 3746}
3739 3747
3740static int mlx5_ib_query_cong_counters(struct mlx5_ib_dev *dev,
3741 struct mlx5_ib_port *port,
3742 struct rdma_hw_stats *stats)
3743{
3744 int outlen = MLX5_ST_SZ_BYTES(query_cong_statistics_out);
3745 void *out;
3746 int ret, i;
3747 int offset = port->cnts.num_q_counters;
3748
3749 out = kvzalloc(outlen, GFP_KERNEL);
3750 if (!out)
3751 return -ENOMEM;
3752
3753 ret = mlx5_cmd_query_cong_counter(dev->mdev, false, out, outlen);
3754 if (ret)
3755 goto free;
3756
3757 for (i = 0; i < port->cnts.num_cong_counters; i++) {
3758 stats->value[i + offset] =
3759 be64_to_cpup((__be64 *)(out +
3760 port->cnts.offsets[i + offset]));
3761 }
3762
3763free:
3764 kvfree(out);
3765 return ret;
3766}
3767
3768static int mlx5_ib_get_hw_stats(struct ib_device *ibdev, 3748static int mlx5_ib_get_hw_stats(struct ib_device *ibdev,
3769 struct rdma_hw_stats *stats, 3749 struct rdma_hw_stats *stats,
3770 u8 port_num, int index) 3750 u8 port_num, int index)
@@ -3782,7 +3762,12 @@ static int mlx5_ib_get_hw_stats(struct ib_device *ibdev,
3782 num_counters = port->cnts.num_q_counters; 3762 num_counters = port->cnts.num_q_counters;
3783 3763
3784 if (MLX5_CAP_GEN(dev->mdev, cc_query_allowed)) { 3764 if (MLX5_CAP_GEN(dev->mdev, cc_query_allowed)) {
3785 ret = mlx5_ib_query_cong_counters(dev, port, stats); 3765 ret = mlx5_lag_query_cong_counters(dev->mdev,
3766 stats->value +
3767 port->cnts.num_q_counters,
3768 port->cnts.num_cong_counters,
3769 port->cnts.offsets +
3770 port->cnts.num_q_counters);
3786 if (ret) 3771 if (ret)
3787 return ret; 3772 return ret;
3788 num_counters += port->cnts.num_cong_counters; 3773 num_counters += port->cnts.num_cong_counters;