aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Marciniszyn <mike.marciniszyn@intel.com>2017-02-08 08:26:08 -0500
committerDoug Ledford <dledford@redhat.com>2017-02-19 09:18:33 -0500
commiteb04ff09d834c1a531d02ee0b3e4b503253df609 (patch)
tree63a12f9592d86a731d910f3245cc3efc280f71f5
parenta82a7fcd1f23497a97df237829622dfdfacf24fe (diff)
IB/hfi1: Ensure read of producer s_head is correct
The read of s_head in the hfi1_make_rc_req() and qib_make_rc_req() lack the necesary barrier instuctions. Correct other ACCESS_ONCE() warnings in the same file. Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/infiniband/hw/hfi1/rc.c7
-rw-r--r--drivers/infiniband/hw/qib/qib_rc.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/hfi1/rc.c b/drivers/infiniband/hw/hfi1/rc.c
index 1dd999e9349c..6446179843e9 100644
--- a/drivers/infiniband/hw/hfi1/rc.c
+++ b/drivers/infiniband/hw/hfi1/rc.c
@@ -414,7 +414,7 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
414 goto bail; 414 goto bail;
415 /* We are in the error state, flush the work request. */ 415 /* We are in the error state, flush the work request. */
416 smp_read_barrier_depends(); /* see post_one_send() */ 416 smp_read_barrier_depends(); /* see post_one_send() */
417 if (qp->s_last == ACCESS_ONCE(qp->s_head)) 417 if (qp->s_last == READ_ONCE(qp->s_head))
418 goto bail; 418 goto bail;
419 /* If DMAs are in progress, we can't flush immediately. */ 419 /* If DMAs are in progress, we can't flush immediately. */
420 if (iowait_sdma_pending(&priv->s_iowait)) { 420 if (iowait_sdma_pending(&priv->s_iowait)) {
@@ -457,7 +457,8 @@ int hfi1_make_rc_req(struct rvt_qp *qp, struct hfi1_pkt_state *ps)
457 newreq = 0; 457 newreq = 0;
458 if (qp->s_cur == qp->s_tail) { 458 if (qp->s_cur == qp->s_tail) {
459 /* Check if send work queue is empty. */ 459 /* Check if send work queue is empty. */
460 if (qp->s_tail == qp->s_head) { 460 smp_read_barrier_depends(); /* see post_one_send() */
461 if (qp->s_tail == READ_ONCE(qp->s_head)) {
461 clear_ahg(qp); 462 clear_ahg(qp);
462 goto bail; 463 goto bail;
463 } 464 }
@@ -1590,7 +1591,7 @@ static void rc_rcv_resp(struct hfi1_ibport *ibp,
1590 1591
1591 /* Ignore invalid responses. */ 1592 /* Ignore invalid responses. */
1592 smp_read_barrier_depends(); /* see post_one_send */ 1593 smp_read_barrier_depends(); /* see post_one_send */
1593 if (cmp_psn(psn, ACCESS_ONCE(qp->s_next_psn)) >= 0) 1594 if (cmp_psn(psn, READ_ONCE(qp->s_next_psn)) >= 0)
1594 goto ack_done; 1595 goto ack_done;
1595 1596
1596 /* Ignore duplicate responses. */ 1597 /* Ignore duplicate responses. */
diff --git a/drivers/infiniband/hw/qib/qib_rc.c b/drivers/infiniband/hw/qib/qib_rc.c
index 031433cb7206..696bcd0d087c 100644
--- a/drivers/infiniband/hw/qib/qib_rc.c
+++ b/drivers/infiniband/hw/qib/qib_rc.c
@@ -257,7 +257,7 @@ int qib_make_rc_req(struct rvt_qp *qp, unsigned long *flags)
257 goto bail; 257 goto bail;
258 /* We are in the error state, flush the work request. */ 258 /* We are in the error state, flush the work request. */
259 smp_read_barrier_depends(); /* see post_one_send() */ 259 smp_read_barrier_depends(); /* see post_one_send() */
260 if (qp->s_last == ACCESS_ONCE(qp->s_head)) 260 if (qp->s_last == READ_ONCE(qp->s_head))
261 goto bail; 261 goto bail;
262 /* If DMAs are in progress, we can't flush immediately. */ 262 /* If DMAs are in progress, we can't flush immediately. */
263 if (atomic_read(&priv->s_dma_busy)) { 263 if (atomic_read(&priv->s_dma_busy)) {
@@ -303,7 +303,8 @@ int qib_make_rc_req(struct rvt_qp *qp, unsigned long *flags)
303 newreq = 0; 303 newreq = 0;
304 if (qp->s_cur == qp->s_tail) { 304 if (qp->s_cur == qp->s_tail) {
305 /* Check if send work queue is empty. */ 305 /* Check if send work queue is empty. */
306 if (qp->s_tail == qp->s_head) 306 smp_read_barrier_depends(); /* see post_one_send() */
307 if (qp->s_tail == READ_ONCE(qp->s_head))
307 goto bail; 308 goto bail;
308 /* 309 /*
309 * If a fence is requested, wait for previous 310 * If a fence is requested, wait for previous
@@ -1390,7 +1391,7 @@ static void qib_rc_rcv_resp(struct qib_ibport *ibp,
1390 1391
1391 /* Ignore invalid responses. */ 1392 /* Ignore invalid responses. */
1392 smp_read_barrier_depends(); /* see post_one_send */ 1393 smp_read_barrier_depends(); /* see post_one_send */
1393 if (qib_cmp24(psn, ACCESS_ONCE(qp->s_next_psn)) >= 0) 1394 if (qib_cmp24(psn, READ_ONCE(qp->s_next_psn)) >= 0)
1394 goto ack_done; 1395 goto ack_done;
1395 1396
1396 /* Ignore duplicate responses. */ 1397 /* Ignore duplicate responses. */