Skip to content

Commit 30002f1

Browse files
benmcollinsJames Bottomley
authored andcommitted
[SCSI] aacraid: Relax the tight timeout loop on fib commands
The loop that waited for syncronous fib commands was causing a CPU stall when a timeout actually occured. 1) Switch to using a more accurate timeout mechanism. 2) Do not pace the loop with udelay(). Use cpu_relax() to allow for scheduling to occur. Signed-off-by: Ben Collins <bcollins@ubuntu.com> Acked-by: Achim Leubner <Achim_Leubner@pmc-sierra.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1 parent 361ee9c commit 30002f1

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎drivers/scsi/aacraid/commsup.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,10 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
564564
* functioning because an interrupt routing or other
565565
* hardware failure has occurred.
566566
*/
567-
unsigned long count = 36000000L; /* 3 minutes */
567+
unsigned long timeout = jiffies + (180 * HZ); /* 3 minutes */
568568
while (down_trylock(&fibptr->event_wait)) {
569569
int blink;
570-
if (--count == 0) {
570+
if (time_is_before_eq_jiffies(timeout)) {
571571
struct aac_queue * q = &dev->queues->queue[AdapNormCmdQueue];
572572
spin_lock_irqsave(q->lock, qflags);
573573
q->numpending--;
@@ -588,7 +588,10 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
588588
}
589589
return -EFAULT;
590590
}
591-
udelay(5);
591+
/* We used to udelay() here but that absorbed
592+
* a CPU when a timeout occured. Not very
593+
* useful. */
594+
cpu_relax();
592595
}
593596
} else if (down_interruptible(&fibptr->event_wait)) {
594597
/* Do nothing ... satisfy

0 commit comments

Comments
 (0)