public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
To: Upinder Malhi <umalhi-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH for-next 5/9] IB/usnic: Change BUG_ON to WARN_ON
Date: Sat, 21 Dec 2013 11:04:09 +0100	[thread overview]
Message-ID: <52B56799.2010306@acm.org> (raw)
In-Reply-To: <1387298917-7365-6-git-send-email-umalhi-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>

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 <umalhi-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
> ---
>  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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2013-12-21 10:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17 16:48 [PATCH for-next 0/9] IB/usnic: Fix kbuild robot, sparse and smatch errs Upinder Malhi
     [not found] ` <1387298917-7365-1-git-send-email-umalhi-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2013-12-17 16:48   ` [PATCH for-next 1/9] IB/usnic: Fix stack frame size exceed warnings Upinder Malhi
2013-12-17 16:48   ` [PATCH for-next 2/9] IB/usnic: Fix format not a string literal warnings Upinder Malhi
     [not found]     ` <1387298917-7365-3-git-send-email-umalhi-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2013-12-21  9:58       ` Bart Van Assche
     [not found]         ` <52B56634.1020300-HInyCGIudOg@public.gmane.org>
2014-01-07 22:03           ` Upinder Malhi (umalhi)
2013-12-17 16:48   ` [PATCH for-next 3/9] IB/usnic: Make usNIC built depend on Intel IOMMU Upinder Malhi
2013-12-17 16:48   ` [PATCH for-next 4/9] IB/usnic: Fix error handling with IS_ERR_OR_NULL Upinder Malhi
     [not found]     ` <1387298917-7365-5-git-send-email-umalhi-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2013-12-21 10:00       ` Bart Van Assche
     [not found]         ` <52B566A9.1080908-HInyCGIudOg@public.gmane.org>
2014-01-07 22:03           ` Upinder Malhi (umalhi)
     [not found]             ` <3A32A946-EB43-4609-A04A-3BB846C442DB-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2014-01-08  0:11               ` Upinder Malhi (umalhi)
2013-12-17 16:48   ` [PATCH for-next 5/9] IB/usnic: Change BUG_ON to WARN_ON Upinder Malhi
     [not found]     ` <1387298917-7365-6-git-send-email-umalhi-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2013-12-21 10:04       ` Bart Van Assche [this message]
     [not found]         ` <52B56799.2010306-HInyCGIudOg@public.gmane.org>
2014-01-07 22:05           ` Upinder Malhi (umalhi)
2013-12-17 16:48   ` [PATCH for-next 6/9] IB/usnic: Initialize all of the data returned to userspace Upinder Malhi
2013-12-17 16:48   ` [PATCH for-next 7/9] IB/usnic: Fix printk format warnings Upinder Malhi
     [not found]     ` <1387298917-7365-8-git-send-email-umalhi-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2013-12-21 10:07       ` Bart Van Assche
     [not found]         ` <52B56847.5070209-HInyCGIudOg@public.gmane.org>
2014-01-07 22:07           ` Upinder Malhi (umalhi)
2013-12-17 16:48   ` [PATCH for-next 8/9] IB/usnic: Remove duplicate and unnecessary consts Upinder Malhi
2013-12-17 16:48   ` [PATCH for-next 9/9] IB/usnic: Fix sparse should be static warnings Upinder Malhi
     [not found]     ` <1387298917-7365-10-git-send-email-umalhi-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org>
2013-12-21 10:09       ` Bart Van Assche
     [not found]         ` <52B568CB.2070804-HInyCGIudOg@public.gmane.org>
2014-01-07 22:14           ` Upinder Malhi (umalhi)
2013-12-20 20:28   ` [PATCH for-next 0/9] IB/usnic: Fix kbuild robot, sparse and smatch errs Upinder Malhi (umalhi)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52B56799.2010306@acm.org \
    --to=bvanassche-hinycgiudog@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=umalhi-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox