All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Guenter Roeck <linux@roeck-us.net>,
	Sanjeev Sharma <sanjeev_sharma@mentor.com>
Cc: gregkh@linuxfoundation.org, kraxel@redhat.com,
	mdharm-usb@one-eyed-alien.net, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] uas: replace WARN_ON_ONCE() with assert_spin_locked().
Date: Mon, 11 Aug 2014 20:55:07 +0200	[thread overview]
Message-ID: <53E9118B.3020309@redhat.com> (raw)
In-Reply-To: <20140811181905.GA25727@roeck-us.net>

Hi,

On 08/11/2014 08:19 PM, Guenter Roeck wrote:
> On Mon, Aug 11, 2014 at 01:29:26PM +0530, Sanjeev Sharma wrote:
>> spin_is_locked() always return false in uniprocessor configuration and therefore it
>> would be advise to repalce with assert_spin_locked().
>>
>> Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com>
>> ---
>>  drivers/usb/storage/uas.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
>> index 3f42785..8e5877d 100644
>> --- a/drivers/usb/storage/uas.c
>> +++ b/drivers/usb/storage/uas.c
>> @@ -154,7 +154,7 @@ static void uas_mark_cmd_dead(struct uas_dev_info *devinfo,
>>  	struct scsi_cmnd *cmnd = container_of(scp, struct scsi_cmnd, SCp);
>>  
>>  	uas_log_cmd_state(cmnd, caller);
>> -	WARN_ON_ONCE(!spin_is_locked(&devinfo->lock));
>> +	assert_spin_locked(&devinfo->lock);
> 
> Seems to me that replacing WARN_ON_ONCE (which may be annoying but only
> creates a traceback, and only once) with assert_spin_locked (which
> crashes the kernel) is a bit drastic.

I can see your point, but so far these paranoia checks have never triggered,
and having them trigger _always_ one some uni-processor (which is the reason
for this patch) to me seems the worse problem of the 2.

Ideally we would have a warn_spin_not_locked or such ...

Regards,

Hans

  reply	other threads:[~2014-08-11 18:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11  7:59 [PATCH] uas: replace WARN_ON_ONCE() with assert_spin_locked() Sanjeev Sharma
2014-08-11  7:59 ` Sanjeev Sharma
2014-08-11  8:28 ` Greg KH
     [not found]   ` <20140811082811.GC1422-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2014-08-11 11:56     ` Sharma, Sanjeev
2014-08-11 11:56       ` Sharma, Sanjeev
2014-08-11 22:53       ` Greg KH
2014-08-11 18:19 ` Guenter Roeck
2014-08-11 18:55   ` Hans de Goede [this message]
2014-08-11 19:08     ` Guenter Roeck
2014-08-11 19:53       ` Hans de Goede
2014-08-11 18:56 ` Hans de Goede

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=53E9118B.3020309@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mdharm-usb@one-eyed-alien.net \
    --cc=sanjeev_sharma@mentor.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.