IB/hfi1, qib, rdmavt: Additional fixes and updates for 4.7
Subsystems (3)
cover IB/hfi1, qib, rdmavt: Additional fixes and updates for 4.7
Here are a few more patches that would be good to get into 4.7 merge window. Two of the fixes are for build warnings on new versions of gcc. There are a couple bug fixes and some minor clean ups.
This patch series should apply on Doug's k.o/for-4.7 branch.
Patches can also be viewed in my repo at:
https://github.com/ddalessa/kernel/tree/for-4.7
---
Dennis Dalessandro (1):
IB/hfi1: Remove anti-pattern in cdev init
Ira Weiny (1):
IB/hfi1: Remove unnecessary comment
Jianxin Xiong (1):
IB/hfi1: Fix bug that blocks process on exit after port bounce
Jubin John (3):
IB/rdmavt: Use kzalloc_node
IB/hfi1: Fix sdma_event_names[] build warning
IB/qib: Remove unused qib_7322_intr_msgs[]Mike Marciniszyn (1):
IB/rdmavt: Insure QP vmalloc variants zero memory
Mitko Haralanov (1):
IB/hfi1: Fix an interval RB node reference count leak
drivers/infiniband/hw/qib/qib_iba7322.c | 15 --------------- drivers/infiniband/sw/rdmavt/mr.c | 4 +++- drivers/infiniband/sw/rdmavt/qp.c | 8 ++++---- drivers/staging/rdma/hfi1/device.c | 14 +++++++------- drivers/staging/rdma/hfi1/qp.c | 3 --- drivers/staging/rdma/hfi1/sdma.c | 2 ++ drivers/staging/rdma/hfi1/user_sdma.c | 18 ++++++++++-------- 7 files changed, 26 insertions(+), 38 deletions(-)
Signature · 5 lines
-Denny -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 1/8 IB/hfi1: Fix an interval RB node reference count leak
In reply to a message not in the archiveFrom: Mitko Haralanov <[email protected]>
Commit e88c9271d9f8 ("IB/hfi1: Fix buffer cache corner case which may cause corruption") introduced a bug which may cause a reference count of a interval RB node to be leaked in the case where an SDMA transfer from that node completes at the same time as the node is being extended.
If a node is being extended, it is first removed from the RB tree in order to be processed without the risk of an invalidation event removing the node at the same time.
If a SDMA completion happens during that time, the completion handler will fail to find the node in the RB tree and, therefore, fail to correctly decrement its refcount. This leaves the node in the tree and its pages pinned for the duration of the user process.
To prevent this from happening the io vector adds a reference to the RB node, which is used during the SDMA completion instead of looking up the node in the RB tree.
This change adds a performance improvement as a side effect by avoiding the RB tree lookup.
--- drivers/staging/rdma/hfi1/user_sdma.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-)
drivers/staging/rdma/hfi1/user_sdma.c +6 -7
@@ -166,6 +166,8 @@ static unsigned initial_pkt_count = 8;#define SDMA_IOWAIT_TIMEOUT 1000/* in milliseconds */ +struct sdma_mmu_node ; +struct user_sdma_iovec {struct list_head list;struct iovec iov;
@@ -178,6 +180,7 @@ struct user_sdma_iovec {* which we last left off. */ u64 offset; +struct sdma_mmu_node *node; };#define SDMA_CACHE_NODE_EVICT BIT(0)
@@ -1153,6 +1156,7 @@ retry: } iovec->pages = node->pages; iovec->npages = npages; + iovec->node = node; ret =hfi1_mmu_rb_insert (&req->pq->sdma_rb_root, &node->rb);if (ret) {
@@ -1519,18 +1523,13 @@ static void user_sdma_free_request(struct user_sdma_request *req, bool unpin) }if (req->data_iovs) {struct sdma_mmu_node *node; -struct mmu_rb_node *mnode;int i;for (i =0 ; i < req->data_iovs; i++) { - mnode =hfi1_mmu_rb_search ( - &req->pq->sdma_rb_root, - (unsigned long )req->iovs[i].iov.iov_base, - req->iovs[i].iov.iov_len); -if (!mnode ||IS_ERR (mnode)) + node = req->iovs[i].node; +if (!node)continue ; - node = container_of(mnode, struct sdma_mmu_node, rb);if (unpin)hfi1_mmu_rb_remove (&req->pq->sdma_rb_root, &node->rb);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/8 IB/rdmavt: Insure QP vmalloc variants zero memory
In reply to a message not in the archiveFrom: Mike Marciniszyn <[email protected]>
The usage of the various vmalloc APIs do not consistently zero memory when allocating the swqe. Insure zeroing variants are used.
--- drivers/infiniband/sw/rdmavt/qp.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rdmavt/qp.c +4 -4
@@ -653,9 +653,9 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,if (gfp ==GFP_NOIO ) swq =__vmalloc ( (init_attr->cap.max_send_wr +1 ) * sz, - gfp,PAGE_KERNEL ); + gfp | __GFP_ZERO,PAGE_KERNEL );else - swq =vmalloc_node ( + swq =vzalloc_node ( (init_attr->cap.max_send_wr +1 ) * sz, rdi->dparms.node);if (!swq)
@@ -704,9 +704,9 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, qp->r_rq.wq =__vmalloc (sizeof (struct rvt_rwq ) + qp->r_rq.size * sz, - gfp,PAGE_KERNEL ); + gfp | __GFP_ZERO,PAGE_KERNEL ); else - qp->r_rq.wq = vmalloc_node( + qp->r_rq.wq = vzalloc_node(sizeof (struct rvt_rwq ) + qp->r_rq.size * sz, rdi->dparms.node);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/8 IB/rdmavt: Use kzalloc_node
In reply to a message not in the archiveFrom: Jubin John <[email protected]>
Use kzalloc_node instead of kzalloc for rdmavt memory region segment allocation to optimize for performance on NUMA platforms.
--- drivers/infiniband/sw/rdmavt/mr.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/infiniband/sw/rdmavt/mr.c +3 -1
@@ -124,11 +124,13 @@ static int rvt_init_mregion(struct rvt_mregion *mr, struct ib_pd *pd, int count) {int m, i =0 ; +struct rvt_dev_info *dev =ib_to_rvt (pd->device); mr->mapsz =0 ; m = (count +RVT_SEGSZ -1 ) /RVT_SEGSZ ;for (; i < m; i++) { - mr->map[i] =kzalloc (sizeof (*mr->map[0 ]),GFP_KERNEL ); + mr->map[i] =kzalloc_node (sizeof (*mr->map[0 ]),GFP_KERNEL , + dev->dparms.node);if (!mr->map[i]) {rvt_deinit_mregion (mr);return -ENOMEM ;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/8 IB/hfi1: Fix sdma_event_names[] build warning
In reply to a message not in the archiveFrom: Jubin John <[email protected]>
sdma_event_names[] is only used within CONFIG_SDMA_VERBOSITY ifdefs, so when CONFIG_SDMA_VERBOSITY is disabled, it results in the following 0-day build warning:
Quoted 2 lines
Quoted 2 lines
drivers/infiniband/hw/hfi1/sdma.c:137:27: warning: 'sdma_event_names' defined but not used [-Wunused-const-variable=]
static const char * const sdma_event_names[] = {
^~~~~~~~~~~~~~~~This occurs on the following compiler:
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
For more information check:
https://lists.01.org/pipermail/kbuild-all/2016-May/020060.html
Fix this warning by defining sdma_event_name[] only within the CONFIG_SDMA_VERBOSITY ifdefs.
--- drivers/staging/rdma/hfi1/sdma.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/staging/rdma/hfi1/sdma.c +2 -0
@@ -134,6 +134,7 @@ static const char * const sdma_state_names[] = { [sdma_state_s99_running] = "s99_Running", }; +#ifdef CONFIG_SDMA_VERBOSITY static const char *const sdma_event_names[] = { [sdma_event_e00_go_hw_down] ="e00_GoHwDown" , [sdma_event_e10_go_hw_start] = "e10_GoHwStart",
@@ -150,6 +151,7 @@ static const char * const sdma_event_names[] = { [sdma_event_e85_link_down] = "e85_LinkDown", [sdma_event_e90_sw_halted] = "e90_SwHalted", }; +#endif static const struct sdma_set_state_action sdma_action_table[] = { [sdma_state_s00_hw_down] = {
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/8 IB/hfi1: Remove unnecessary comment
In reply to a message not in the archiveFrom: Ira Weiny <[email protected]>
This comment was old, the MTU enums have been defined.
--- drivers/staging/rdma/hfi1/qp.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/staging/rdma/hfi1/qp.c +0 -3
@@ -160,9 +160,6 @@ static inline int opa_mtu_enum_to_int(int mtu)* This function is what we would push to the core layer if we wanted to be a * "first class citizen". Instead we hide this here and rely on Verbs ULPs * to blindly pass the MTU enum value from the PathRecord to us. -* -* The actual flag used to determine "8k MTU" will change and is currently -* unknown. */ static inline int verbs_mtu_enum_to_int (struct ib_device *dev,enum ib_mtu mtu) {
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/8 IB/qib: Remove unused qib_7322_intr_msgs[]
In reply to a message not in the archiveFrom: Jubin John <[email protected]>
Building the qib driver with gcc version 6.1.0 raises the following build warning:drivers/infiniband/hw/qib/qib_iba7322.c:1311:39: warning:
'qib_7322_intr_msgs' defined but not used [-Wunused-const-variable=]
static const struct qib_hwerror_msgs qib_7322_intr_msgs[] = {
^~~~~~~~~~~~~~~~~~Remove the unused qib_7322_intr_msgs[]
--- drivers/infiniband/hw/qib/qib_iba7322.c | 15 --------------- 1 files changed, 0 insertions(+), 15 deletions(-)
drivers/infiniband/hw/qib/qib_iba7322.c +0 -15
@@ -1308,21 +1308,6 @@ static const struct qib_hwerror_msgs qib_7322p_error_msgs[] = { SYM_LSB(IntMask, fldname##17IntMask)), \ .msg = #fldname "_C", .sz = sizeof(#fldname "_C") } -static const struct qib_hwerror_msgs qib_7322_intr_msgs[] = { -INTR_AUTO_P (SDmaInt), -INTR_AUTO_P (SDmaProgressInt), -INTR_AUTO_P (SDmaIdleInt), -INTR_AUTO_P (SDmaCleanupDone), -INTR_AUTO_C (RcvUrg), -INTR_AUTO_P (ErrInt), -INTR_AUTO (ErrInt),/* non-port-specific errs */ -INTR_AUTO (AssertGPIOInt), -INTR_AUTO_P (SendDoneInt), -INTR_AUTO (SendBufAvailInt), -INTR_AUTO_C (RcvAvail), - { .mask =0 , .sz =0 } -}; -#define TXSYMPTOM_AUTO_P (fldname) \ { .mask = SYM_MASK(SendHdrErrSymptom_0, fldname), \ .msg = #fldname, .sz = sizeof(#fldname) }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 7/8 IB/hfi1: Fix bug that blocks process on exit after port bounce
In reply to a message not in the archiveFrom: Jianxin Xiong <[email protected]>
During the processing of a user SDMA request, if there was an error before the request counter was increased, the state of the packet queue could be updated incorrectly, causing the counter to underflow. As the result, the process could get stuck later since the counter could never get back to 0.
This patch adds a condition to guard the packet queue update so that the counter is only decreased if it has been increased before the error happens.
--- drivers/staging/rdma/hfi1/user_sdma.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/staging/rdma/hfi1/user_sdma.c +4 -1
@@ -510,6 +510,7 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec,struct sdma_req_info info;struct user_sdma_request *req;u8 opcode, sc, vl; +int req_queued =0 ;if (iovec[idx].iov_len <sizeof (info) +sizeof (req->hdr)) { hfi1_cdbg(
@@ -706,6 +707,7 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec,set_comp_state (pq, cq, info.comp_idx,QUEUED ,0 );atomic_inc (&pq->n_reqs); + req_queued =1 ;/* Send the first N packets in the request to buy us some time */ ret =user_sdma_send_pkts (req, pcount);if (unlikely (ret <0 && ret != -EBUSY )) {
@@ -750,7 +752,8 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec,return 0 ; free_req:user_sdma_free_request (req, true); -pq_update (pq); +if (req_queued) +pq_update (pq);set_comp_state (pq, cq, info.comp_idx,ERROR , req->status);return ret; }
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/8 IB/hfi1: Remove anti-pattern in cdev init
In reply to a message not in the archiveRemove the usage of an anti-pattern goto in hfi1_cdev_init to improve code readability.
--- drivers/staging/rdma/hfi1/device.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/rdma/hfi1/device.c +7 -7
@@ -82,13 +82,13 @@ int hfi1_cdev_init(int minor, const char *name,else device =device_create (class,NULL , dev,NULL ,"%s" , name); -if (!IS_ERR (device)) - goto done; - ret =PTR_ERR (device); - device =NULL ; -pr_err ("Could not create device for minor %d, %s (err %d)\n" , - minor, name, -ret); -cdev_del (cdev); +if (IS_ERR (device)) { + ret =PTR_ERR (device); + device =NULL ; +pr_err ("Could not create device for minor %d, %s (err %d)\n" , + minor, name, -ret); +cdev_del (cdev); + } done: *devp = device;return ret;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 32 lines · Dennis Dalessandro
Here are a few more patches that would be good to get into 4.7 merge window. Two of the fixes are for build warnings on new versions of gcc. There are a couple bug fixes and some minor clean ups.
This patch series should apply on Doug's k.o/for-4.7 branch.
Patches can also be viewed in my repo at:
https://github.com/ddalessa/kernel/tree/for-4.7---
Dennis Dalessandro (1):
IB/hfi1: Remove anti-pattern in cdev initIra Weiny (1):
IB/hfi1: Remove unnecessary commentJianxin Xiong (1):
IB/hfi1: Fix bug that blocks process on exit after port bounceJubin John (3):
IB/rdmavt: Use kzalloc_node IB/hfi1: Fix sdma_event_names[] build warning IB/qib: Remove unused qib_7322_intr_msgs[]Mike Marciniszyn (1):
IB/rdmavt: Insure QP vmalloc variants zero memoryMitko Haralanov (1):
IB/hfi1: Fix an interval RB node reference count leak
Quoted 9 lines
drivers/infiniband/hw/qib/qib_iba7322.c | 15 --------------- drivers/infiniband/sw/rdmavt/mr.c | 4 +++- drivers/infiniband/sw/rdmavt/qp.c | 8 ++++---- drivers/staging/rdma/hfi1/device.c | 14 +++++++------- drivers/staging/rdma/hfi1/qp.c | 3 --- drivers/staging/rdma/hfi1/sdma.c | 2 ++ drivers/staging/rdma/hfi1/user_sdma.c | 18 ++++++++++-------- 7 files changed, 26 insertions(+), 38 deletions(-)
Thanks, series applied.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD