IB/rxe: Issue warnings once

It is strongly recommended to report kernel warnings once instead
of every time a condition is hit. Hence change WARN_ON() into
WARN_ON_ONCE() / BUILD_BUG_ON() as appropriate.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Andrew Boyer <andrew.boyer@dell.com>
Cc: Moni Shoua <monis@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Bart Van Assche 2017-01-10 11:15:47 -08:00 committed by Doug Ledford
parent 32404fb764
commit 43553b47c3
3 changed files with 10 additions and 9 deletions

View File

@ -254,7 +254,7 @@ static inline enum comp_state check_ack(struct rxe_qp *qp,
} }
break; break;
default: default:
WARN_ON(1); WARN_ON_ONCE(1);
} }
/* Check operation validity. */ /* Check operation validity. */

View File

@ -123,7 +123,7 @@ static int rxe_mem_alloc(struct rxe_dev *rxe, struct rxe_mem *mem, int num_buf)
goto err2; goto err2;
} }
WARN_ON(!is_power_of_2(RXE_BUF_PER_MAP)); BUILD_BUG_ON(!is_power_of_2(RXE_BUF_PER_MAP));
mem->map_shift = ilog2(RXE_BUF_PER_MAP); mem->map_shift = ilog2(RXE_BUF_PER_MAP);
mem->map_mask = RXE_BUF_PER_MAP - 1; mem->map_mask = RXE_BUF_PER_MAP - 1;
@ -189,7 +189,7 @@ int rxe_mem_init_user(struct rxe_dev *rxe, struct rxe_pd *pd, u64 start,
goto err1; goto err1;
} }
WARN_ON(!is_power_of_2(umem->page_size)); WARN_ON_ONCE(!is_power_of_2(umem->page_size));
mem->page_shift = ilog2(umem->page_size); mem->page_shift = ilog2(umem->page_size);
mem->page_mask = umem->page_size - 1; mem->page_mask = umem->page_size - 1;
@ -375,7 +375,7 @@ int rxe_mem_copy(struct rxe_mem *mem, u64 iova, void *addr, int length,
return 0; return 0;
} }
WARN_ON(!mem->map); WARN_ON_ONCE(!mem->map);
err = mem_check_range(mem, iova, length); err = mem_check_range(mem, iova, length);
if (err) { if (err) {

View File

@ -307,7 +307,7 @@ static enum resp_states check_op_valid(struct rxe_qp *qp,
break; break;
default: default:
WARN_ON(1); WARN_ON_ONCE(1);
break; break;
} }
@ -495,7 +495,7 @@ static enum resp_states check_rkey(struct rxe_qp *qp,
} }
} }
WARN_ON(qp->resp.mr); WARN_ON_ONCE(qp->resp.mr);
qp->resp.mr = mem; qp->resp.mr = mem;
return RESPST_EXECUTE; return RESPST_EXECUTE;
@ -808,9 +808,10 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt)
err = process_atomic(qp, pkt); err = process_atomic(qp, pkt);
if (err) if (err)
return err; return err;
} else } else {
/* Unreachable */ /* Unreachable */
WARN_ON(1); WARN_ON_ONCE(1);
}
/* We successfully processed this new request. */ /* We successfully processed this new request. */
qp->resp.msn++; qp->resp.msn++;
@ -1396,7 +1397,7 @@ int rxe_responder(void *arg)
goto exit; goto exit;
default: default:
WARN_ON(1); WARN_ON_ONCE(1);
} }
} }