public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@gmail.com>
To: scameron@beardog.cce.hp.com
Cc: james.bottomley@hansenpartnership.com,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	stephenmcameron@gmail.com, thenzl@redhat.com,
	akpm@linux-foundation.org, mikem@beardog.cce.hp.com
Subject: Re: [PATCH 07/17] hpsa: do not give up retry of driver cmds after only 3 retries
Date: Wed, 2 May 2012 22:27:59 +0200	[thread overview]
Message-ID: <20120502202759.GB19349@andi> (raw)
In-Reply-To: <20120502163009.GV11802@beardog.cce.hp.com>

On Wed, May 02, 2012 at 11:30:09AM -0500, scameron@beardog.cce.hp.com wrote:
> On Tue, May 01, 2012 at 11:39:34PM +0200, Andi Shyti wrote:
> > Hi Steve,
> > 
> > Thanks for the walk-through, but still some doubts...
> > 
> > On Tue, May 01, 2012 at 01:20:11PM -0500, scameron@beardog.cce.hp.com wrote:
> > > On Tue, May 01, 2012 at 07:26:34PM +0200, Andi Shyti wrote:
> > > > >  
> > > > >  	do {
> > > > >  		memset(c->err_info, 0, sizeof(*c->err_info));
> > > > >  		hpsa_scsi_do_simple_cmd_core(h, c);
> > > > >  		retry_count++;
> > > > > +		if (retry_count > 3) {
> > > > > +			msleep(backoff_time);
> > > > 
> > > > for 10ms isn't it better to avoid using msleep?
> > > 
> > > [...] 
> > > > > +			if (backoff_time < 1000)
> > > > > +				backoff_time *= 2;
> > > 
> > > Eh, maybe.  from Documentation/timers-howto.txt
> > > 
> > >                         msleep(1~20) may not do what the caller intends, and
> > >                         will often sleep longer (~20 ms actual sleep for any
> > >                         value given in the 1~20ms range). In many cases this
> > >                         is not the desired behavior.
> > > 
> > > Sleeping longer (~20ms instead of 10ms) in this instance is fine, as I don't
> > > really care too much exactly how long it sleeps, and it backs off to up to
> > > 1280ms eventually anyway.  The idea is, "wait a bit, and retry, and then if
> > > that doesn't work, wait twice as long, and retry, etc."  *exactly* how long
> > > "a bit" is is not super important.  I could change the initial back_off time
> > > to 20 or 30 to satisfy the letter of the advice in Documentation/timers-howto.txt,
> > > if doing so is important.
> > 
> > No, you're right, it should not really matter, but here in the
> > worst case you put the driver on sleep for almost 22 seconds,
> > that is a huge difference compared to the original
> > implementation.
> >  
> > > This is kind of a corner case of a corner case, I don't expect
> > > things will ordinarily end up waiting that long, because normally
> > > one of the 1st 3 retries will succeed.  I just wanted to make it 
> > > a little more robust and not just give up immediately if the 3
> > > initial retries don't succeed, the specific number of retries,
> > > wait times, etc, I just made up.
> > 
> > Premising that I don't know the device, therefore I could be
> > totally wrong, if you don't expect things to wait so long, why not
> > to decrease the MAX_DRIVER_CMD_RETRIES and sleep increasingly (as
> > you did) but for shorter period?
> 
> [...]
> 
> So yeah, the "echo 1 > /sys/blah/blah/rescan" process will sleep for up to ~20 seconds
> in the event of some (presumably very rare) 20 second BUSY condition, but it will work in
> cases the old code will not, and so it sleeps 20 secs, I don't think that's really a 
> problem, esp. compared to the alternative of just failing.
>

Uhh... that was a good explanation :)
Thanks a lot! You convinced me :)

If you want you can add

Reviewed-by: Andi Shyti <andi.shyti@gmail.com> 

  reply	other threads:[~2012-05-02 20:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-01 16:42 [PATCH 00/17] hpsa: resend updates for April, 2012 Stephen M. Cameron
2012-05-01 16:42 ` [PATCH 01/17] hpsa: call pci_disable_device on driver unload Stephen M. Cameron
2012-05-01 16:42 ` [PATCH 02/17] hpsa: do not skip disabled devices Stephen M. Cameron
2012-05-01 16:42 ` [PATCH 03/17] hpsa: enable bus master bit after pci_enable_device Stephen M. Cameron
2012-05-01 16:42 ` [PATCH 04/17] hpsa: suppress excessively chatty error messages Stephen M. Cameron
2012-05-01 16:42 ` [PATCH 05/17] hpsa: do not read from controller unnecessarily in completion code Stephen M. Cameron
2012-05-01 16:42 ` [PATCH 06/17] hpsa: retry driver initiated commands on busy status Stephen M. Cameron
2012-05-01 16:42 ` [PATCH 07/17] hpsa: do not give up retry of driver cmds after only 3 retries Stephen M. Cameron
2012-05-01 17:26   ` Andi Shyti
2012-05-01 18:20     ` scameron
2012-05-01 21:39       ` Andi Shyti
2012-05-02 16:30         ` scameron
2012-05-02 20:27           ` Andi Shyti [this message]
2012-05-01 16:42 ` [PATCH 08/17] hpsa: remove unused parameter from finish_cmd Stephen M. Cameron
2012-05-01 16:42 ` [PATCH 09/17] hpsa: add abort error handler function Stephen M. Cameron
2012-05-01 16:42 ` [PATCH 10/17] hpsa: do aborts two ways Stephen M. Cameron
2012-05-01 16:43 ` [PATCH 11/17] hpsa: factor out tail calls to next_command() in process_(non)indexed_cmd() Stephen M. Cameron
2012-05-01 16:43 ` [PATCH 12/17] hpsa: use multiple reply queues Stephen M. Cameron
2012-05-01 16:43 ` [PATCH 13/17] hpsa: refine interrupt handler locking for greater concurrency Stephen M. Cameron
2012-05-01 16:43 ` [PATCH 14/17] hpsa: factor out hpsa_free_irqs_and_disable_msix Stephen M. Cameron
2012-05-01 16:43 ` [PATCH 15/17] hpsa: add new RAID level "1(ADM)" Stephen M. Cameron
2012-05-01 16:43 ` [PATCH 16/17] hpsa: removed unused member maxQsinceinit Stephen M. Cameron
2012-05-01 16:43 ` [PATCH 17/17] hpsa: dial down lockup detection during firmware flash Stephen M. Cameron

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=20120502202759.GB19349@andi \
    --to=andi.shyti@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mikem@beardog.cce.hp.com \
    --cc=scameron@beardog.cce.hp.com \
    --cc=stephenmcameron@gmail.com \
    --cc=thenzl@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox