From 0b1ed8035b5c536a39f589b1f7d917d2de0754c4 Mon Sep 17 00:00:00 2001 From: "Mccormick, Patrick M" Date: Sun, 23 Apr 2017 11:30:06 +0300 Subject: [PATCH] Xeon Phi updates 0003 patch should replace the existing and includes these changes: Update ccl-direct ABI to pass PD correct local_dma_lkey. Update ccl-direct ABI to pass cq flags. Zero initialize sa path_recs in ibp_server to avoid null pointer deref. The 0008 patch will be new: Forward port QP multicast changes from 3.18-3 for mlx4 and mlx5 kernel QPs. This is needed for IPoIB with ccl-direct. Signed-off-by: Mccormick, Patrick M --- ...dd-the-ibp-client-and-server-drivers.patch | 33 ++++--- ...-use-of-multicast-QPs-for-ccl-direct.patch | 93 +++++++++++++++++++ 2 files changed, 112 insertions(+), 14 deletions(-) create mode 100644 tech-preview/xeon-phi/0008-Allow-use-of-multicast-QPs-for-ccl-direct.patch diff --git a/tech-preview/xeon-phi/0003-add-the-ibp-client-and-server-drivers.patch b/tech-preview/xeon-phi/0003-add-the-ibp-client-and-server-drivers.patch index 52f843c..90a984b 100644 --- a/tech-preview/xeon-phi/0003-add-the-ibp-client-and-server-drivers.patch +++ b/tech-preview/xeon-phi/0003-add-the-ibp-client-and-server-drivers.patch @@ -1,7 +1,7 @@ -From bd9c0ebb6c193ae15edb8a1030e60c7d657350a5 Mon Sep 17 00:00:00 2001 +From d6e76907bc776a15cf6cb48ea57f5031f37ff14e Mon Sep 17 00:00:00 2001 From: Jerrie Coffman Date: Fri, 20 May 2016 16:17:43 -0700 -Subject: [PATCH 3/7] add the ibp client and server drivers +Subject: [PATCH 3/8] add the ibp client and server drivers This adds the CCL-Direct (ibp) client and server drivers to infiniband. It includes the base ib proxy driver, the mlx4 @@ -51,11 +51,11 @@ Signed-off-by: Patrick McCormick drivers/infiniband/ibp/drv/hw/mlx5/main.h | 327 ++++ drivers/infiniband/ibp/drv/hw/mlx5/qp.c | 714 +++++++ drivers/infiniband/ibp/drv/hw/mlx5/srq.c | 185 ++ - drivers/infiniband/ibp/drv/ibp-abi.h | 649 ++++++ + drivers/infiniband/ibp/drv/ibp-abi.h | 651 +++++++ drivers/infiniband/ibp/drv/ibp.h | 260 +++ drivers/infiniband/ibp/drv/server.c | 503 +++++ drivers/infiniband/ibp/drv/server.h | 182 ++ - drivers/infiniband/ibp/drv/server_msg.c | 2815 +++++++++++++++++++++++++++ + drivers/infiniband/ibp/drv/server_msg.c | 2818 +++++++++++++++++++++++++++ drivers/infiniband/ibp/sa/Makefile | 13 + drivers/infiniband/ibp/sa/client.c | 134 ++ drivers/infiniband/ibp/sa/client.h | 90 + @@ -72,7 +72,7 @@ Signed-off-by: Patrick McCormick drivers/infiniband/ibp/sa/server.c | 218 +++ drivers/infiniband/ibp/sa/server.h | 173 ++ drivers/infiniband/ibp/sa/server_msg.c | 185 ++ - 62 files changed, 22337 insertions(+) + 62 files changed, 22342 insertions(+) create mode 100644 drivers/infiniband/ibp/Kconfig create mode 100644 drivers/infiniband/ibp/Makefile create mode 100644 drivers/infiniband/ibp/cm/Makefile @@ -2771,7 +2771,7 @@ index 0000000..f08608e +EXPORT_SYMBOL(ib_cm_init_qp_attr); diff --git a/drivers/infiniband/ibp/cm/cm_server_msg.c b/drivers/infiniband/ibp/cm/cm_server_msg.c new file mode 100644 -index 0000000..02b3fb3 +index 0000000..5fd6f72 --- /dev/null +++ b/drivers/infiniband/ibp/cm/cm_server_msg.c @@ -0,0 +1,1065 @@ @@ -3349,8 +3349,8 @@ index 0000000..02b3fb3 + struct ibp_send_cm_req_cmd *cmd; + struct ib_cm_id *cm_id; + struct ib_cm_req_param param = {0}; -+ struct ib_sa_path_rec primary_path; -+ struct ib_sa_path_rec alternate_path; ++ struct ib_sa_path_rec primary_path = { 0 }; ++ struct ib_sa_path_rec alternate_path = { 0 }; + size_t len; + int ret; + @@ -14393,10 +14393,10 @@ index 0000000..c9a5524 +} diff --git a/drivers/infiniband/ibp/drv/ibp-abi.h b/drivers/infiniband/ibp/drv/ibp-abi.h new file mode 100644 -index 0000000..fa8a1a9 +index 0000000..cad1e30 --- /dev/null +++ b/drivers/infiniband/ibp/drv/ibp-abi.h -@@ -0,0 +1,649 @@ +@@ -0,0 +1,651 @@ +/* + * Copyright (c) 2011-2013 Intel Corporation. All rights reserved. + * @@ -14753,6 +14753,7 @@ index 0000000..fa8a1a9 + +struct ibp_alloc_pd_resp { + u64 pd; ++ u32 local_dma_lkey; + u64 data[0]; +}; + @@ -14975,6 +14976,7 @@ index 0000000..fa8a1a9 + u64 cq_context; + u32 cqe; + u32 vector; ++ u32 flags; + u64 data[0]; +}; + @@ -16011,10 +16013,10 @@ index 0000000..faf8dae +#endif /* SERVER_H */ diff --git a/drivers/infiniband/ibp/drv/server_msg.c b/drivers/infiniband/ibp/drv/server_msg.c new file mode 100644 -index 0000000..b0cb8cf +index 0000000..c6a15df --- /dev/null +++ b/drivers/infiniband/ibp/drv/server_msg.c -@@ -0,0 +1,2815 @@ +@@ -0,0 +1,2818 @@ +/* + * Copyright (c) 2011-2013 Intel Corporation. All rights reserved. + * @@ -17328,6 +17330,7 @@ index 0000000..b0cb8cf + len += outlen - udata.outlen; /* add driver private data */ + + resp->pd = (uintptr_t)pd; ++ resp->local_dma_lkey = pd->local_dma_lkey; + +send_resp: + IBP_INIT_RESP(device, msg, len, VERB_RESPONSE, hdr->request, ret); @@ -17576,10 +17579,11 @@ index 0000000..b0cb8cf + pd = (struct ib_pd *) cmd->pd; + msg = (struct ibp_verb_response_msg *) tx_buf; + resp = (struct ibp_create_srq_resp *) msg->data; -+ len = hdr->length - sizeof(*cmd); ++ len = hdr->length - sizeof(*cmd); + outlen = MAX_MSG_SIZE - sizeof(*msg) - sizeof(*resp); + -+ INIT_UDATA(&udata, cmd->data, resp->data, len, outlen); ++ // TODO: get proper len from uOS: ++ INIT_UDATA(&udata, cmd->data, resp->data, len-8, outlen); + + len = sizeof(*msg); + @@ -18268,6 +18272,7 @@ index 0000000..b0cb8cf + memset(&attr, 0, sizeof(attr)); + attr.cqe = cmd->cqe; + attr.comp_vector = cmd->vector; ++ attr.flags = cmd->flags; + + cq = device->ib_dev->create_cq(device->ib_dev, &attr, + ucontext->ibucontext, &udata); diff --git a/tech-preview/xeon-phi/0008-Allow-use-of-multicast-QPs-for-ccl-direct.patch b/tech-preview/xeon-phi/0008-Allow-use-of-multicast-QPs-for-ccl-direct.patch new file mode 100644 index 0000000..ef0abb1 --- /dev/null +++ b/tech-preview/xeon-phi/0008-Allow-use-of-multicast-QPs-for-ccl-direct.patch @@ -0,0 +1,93 @@ +From f2dbf0422ef72a07b06363e4daa3c4b91202e0a8 Mon Sep 17 00:00:00 2001 +From: pmmccorm +Date: Thu, 20 Apr 2017 06:41:52 -0700 +Subject: [PATCH 8/8] Allow use of multicast QPs for ccl-direct. + +Signed-off-by: pmmccorm +--- + drivers/infiniband/hw/mlx4/qp.c | 17 ++++++++++++++--- + drivers/infiniband/hw/mlx5/qp.c | 3 +++ + 2 files changed, 17 insertions(+), 3 deletions(-) + +diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c +index 03b4634..c16235b 100644 +--- a/drivers/infiniband/hw/mlx4/qp.c ++++ b/drivers/infiniband/hw/mlx4/qp.c +@@ -713,15 +713,19 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, + + qp->mlx4_ib_qp_type = qp_type; + ++ if (init_attr->create_flags & IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK) ++ qp->flags |= MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK; ++ ++ if (init_attr->create_flags & IB_QP_CREATE_IPOIB_UD_LSO) ++ qp->flags |= MLX4_IB_QP_LSO; ++ + mutex_init(&qp->mutex); + spin_lock_init(&qp->sq.lock); + spin_lock_init(&qp->rq.lock); + INIT_LIST_HEAD(&qp->gid_list); + INIT_LIST_HEAD(&qp->steering_rules); + +- if (init_attr->create_flags & IB_QP_CREATE_IPOIB_UD_LSO) +- qp->flags |= MLX4_IB_QP_LSO; +- ++ /* + if (init_attr->create_flags & IB_QP_CREATE_NETIF_QP) { + if (dev->steering_support == MLX4_STEERING_MODE_DEVICE_MANAGED) + qp->flags |= MLX4_IB_QP_NETIF; +@@ -730,6 +734,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, + goto err; + } + } ++ */ + + qp->state = IB_QPS_RESET; + if (init_attr->sq_sig_type == IB_SIGNAL_ALL_WR) +@@ -1133,6 +1138,8 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd, + + gfp = (init_attr->create_flags & MLX4_IB_QP_CREATE_USE_GFP_NOIO) ? + GFP_NOIO : GFP_KERNEL; ++ ++#if 0 /* Removed to allow Xeon Phi's use of ib_ipoib via CCL-Direct (ibp) */ + /* + * We only support LSO, vendor flag1, and multicast loopback blocking, + * and only for kernel UD QPs. +@@ -1163,6 +1170,7 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd, + init_attr->qp_type != IB_QPT_GSI)) + return ERR_PTR(-EINVAL); + } ++#endif /* if 0 */ + + switch (init_attr->qp_type) { + case IB_QPT_XRC_TGT: +@@ -1203,9 +1211,12 @@ static struct ib_qp *_mlx4_ib_create_qp(struct ib_pd *pd, + { + int sqpn; + ++#if 0 /* Removed to allow Xeon Phi's use of ib_ipoib via CCL-Direct (ibp) */ + /* Userspace is not allowed to create special QPs: */ + if (udata) + return ERR_PTR(-EINVAL); ++#endif /* if 0 */ ++ + if (init_attr->create_flags & MLX4_IB_QP_CREATE_ROCE_V2_GSI) { + int res = mlx4_qp_reserve_range(to_mdev(pd->device)->dev, 1, 1, &sqpn, 0); + +diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c +index affc3f6..a0bb69ae 100644 +--- a/drivers/infiniband/hw/mlx5/qp.c ++++ b/drivers/infiniband/hw/mlx5/qp.c +@@ -1568,6 +1568,9 @@ static int create_qp_common(struct mlx5_ib_dev *dev, struct ib_pd *pd, + } + + if (pd) { ++ if (init_attr->create_flags & IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK) ++ qp->flags |= MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK; ++ + if (pd->uobject) { + __u32 max_wqes = + 1 << MLX5_CAP_GEN(mdev, log_max_qp_sz); +-- +1.8.3.1 + -- 2.41.0