On 12/17/13 17:48, Upinder Malhi wrote:
> usNIC calls BUG_ON(spinlock_is_held..) at few places.  In some of these
> instances, the call is made with another spinlock already held.  Change
> all such calls in usNIC to WARN_ON to make it fool-proof.
> 
> Signed-off-by: Upinder Malhi <uma...@cisco.com>
> ---
>  drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 16 ++++++++--------
>  drivers/infiniband/hw/usnic/usnic_uiom.c      |  2 +-
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c 
> b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
> index f647b6b..ad57a77 100644
> --- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
> +++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c
> @@ -82,7 +82,7 @@ static int add_fwd_filter(struct usnic_ib_qp_grp *qp_grp,
>       struct usnic_vnic_res_chunk *chunk;
>       int rq_idx;
>  
> -     BUG_ON(!spin_is_locked(&qp_grp->lock));
> +     WARN_ON(!spin_is_locked(&qp_grp->lock));
>  
>       chunk = usnic_ib_qp_grp_get_chunk(qp_grp, USNIC_VNIC_RES_TYPE_RQ);
>       if (IS_ERR_OR_NULL(chunk) || chunk->cnt < 1) {

Please consider using lockdep_assert_held() instead of
BUG_ON(!spin_is_locked()) or WARN_ON(!spin_is_locked()). Both the old
code and the new code will fail on uniprocessor systems with
CONFIG_DEBUG_SPINLOCK=n. From include/linux/spinlock_up.h:

#ifdef CONFIG_DEBUG_SPINLOCK
...
#else /* DEBUG_SPINLOCK */
#define arch_spin_is_locked(lock)       ((void)(lock), 0)
...
#endif

Bart.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to