Re: [PATCH V3 2/3] hpsa: limit outstanding rescans

2017-03-15 Thread Martin K. Petersen
Don Brace  writes:

> My bad. I'll send up a V4.  Sorry about that.

I already fixed it up and James pulled the new tree. So we're all set.

-- 
Martin K. Petersen  Oracle Linux Engineering


RE: [PATCH V3 2/3] hpsa: limit outstanding rescans

2017-03-15 Thread Don Brace
> -Original Message-
> From: James Bottomley [mailto:j...@linux.vnet.ibm.com]
> Sent: Wednesday, March 15, 2017 12:24 PM
> To: Don Brace <don.br...@microsemi.com>; joseph.szczy...@hpe.com;
> Gerry Morong <gerry.mor...@microsemi.com>; John Hall
> <john.h...@microsemi.com>; Kevin Barnett
> <kevin.barn...@microsemi.com>; Mahesh Rajashekhara
> <mahesh.rajashekh...@microsemi.com>; Bader Ali - Saleh
> <bader.alisa...@microsemi.com>; h...@infradead.org; Scott Teel
> <scott.t...@microsemi.com>; Viswas G <viswa...@microsemi.com>; Justin
> Lindley <justin.lind...@microsemi.com>; Scott Benesh
> <scott.ben...@microsemi.com>; posw...@suse.com
> Cc: linux-scsi@vger.kernel.org
> Subject: Re: [PATCH V3 2/3] hpsa: limit outstanding rescans
> 
> EXTERNAL EMAIL
> 
> 
> On Fri, 2017-03-10 at 14:35 -0600, Don Brace wrote:
> > avoid rescan storms. No need to queue another
> > if one is pending.
> >
> > Reviewed-by: Scott Benesh <scott.ben...@microsemi.com>
> > Reviewed-by: Scott Teel <scott.t...@microsemi.com>
> > Reviewed-by: Tomas Henzl <the...@redhat.com> review
> 
> Guys, what is this additional "review" for?  I just noticed because my
> reply scripts barfed on it.  Please don't add extra junk after an email
> address in a tag line.
> 
> Thanks,
> 
> James

My bad. I'll send up a V4.
Sorry about that.

Thanks,
Don Brace
ESC - Smart Storage
Microsemi Corporation




Re: [PATCH V3 2/3] hpsa: limit outstanding rescans

2017-03-15 Thread James Bottomley
On Fri, 2017-03-10 at 14:35 -0600, Don Brace wrote:
> avoid rescan storms. No need to queue another
> if one is pending.
> 
> Reviewed-by: Scott Benesh 
> Reviewed-by: Scott Teel 
> Reviewed-by: Tomas Henzl  review

Guys, what is this additional "review" for?  I just noticed because my
reply scripts barfed on it.  Please don't add extra junk after an email
address in a tag line.

Thanks,

James



[PATCH V3 2/3] hpsa: limit outstanding rescans

2017-03-10 Thread Don Brace
avoid rescan storms. No need to queue another
if one is pending.

Reviewed-by: Scott Benesh 
Reviewed-by: Scott Teel 
Reviewed-by: Tomas Henzl  review
Signed-off-by: Don Brace 
---
 drivers/scsi/hpsa.c |   16 +++-
 drivers/scsi/hpsa.h |1 +
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 90b76c4..0a8ac68 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -,7 +,7 @@ static void hpsa_scan_complete(struct ctlr_info *h)
 
spin_lock_irqsave(>scan_lock, flags);
h->scan_finished = 1;
-   wake_up_all(>scan_wait_queue);
+   wake_up(>scan_wait_queue);
spin_unlock_irqrestore(>scan_lock, flags);
 }
 
@@ -5573,11 +5573,23 @@ static void hpsa_scan_start(struct Scsi_Host *sh)
if (unlikely(lockup_detected(h)))
return hpsa_scan_complete(h);
 
+   /*
+* If a scan is already waiting to run, no need to add another
+*/
+   spin_lock_irqsave(>scan_lock, flags);
+   if (h->scan_waiting) {
+   spin_unlock_irqrestore(>scan_lock, flags);
+   return;
+   }
+
+   spin_unlock_irqrestore(>scan_lock, flags);
+
/* wait until any scan already in progress is finished. */
while (1) {
spin_lock_irqsave(>scan_lock, flags);
if (h->scan_finished)
break;
+   h->scan_waiting = 1;
spin_unlock_irqrestore(>scan_lock, flags);
wait_event(h->scan_wait_queue, h->scan_finished);
/* Note: We don't need to worry about a race between this
@@ -5587,6 +5599,7 @@ static void hpsa_scan_start(struct Scsi_Host *sh)
 */
}
h->scan_finished = 0; /* mark scan as in progress */
+   h->scan_waiting = 0;
spin_unlock_irqrestore(>scan_lock, flags);
 
if (unlikely(lockup_detected(h)))
@@ -8789,6 +8802,7 @@ static int hpsa_init_one(struct pci_dev *pdev, const 
struct pci_device_id *ent)
init_waitqueue_head(>event_sync_wait_queue);
mutex_init(>reset_mutex);
h->scan_finished = 1; /* no scan currently in progress */
+   h->scan_waiting = 0;
 
pci_set_drvdata(pdev, h);
h->ndevices = 0;
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index bf6cdc1..6f04f2a 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -201,6 +201,7 @@ struct ctlr_info {
dma_addr_t  errinfo_pool_dhandle;
unsigned long   *cmd_pool_bits;
int scan_finished;
+   u8  scan_waiting : 1;
spinlock_t  scan_lock;
wait_queue_head_t   scan_wait_queue;