From patchwork Mon Jun 11 18:44:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [06/27] UBUNTU: [Upstream] SCSI: AACRAID: Relax the tight timeout loop on fib commands X-Patchwork-Submitter: Benjamin Collins X-Patchwork-Id: 164265 Message-Id: To: kernel-team@lists.ubuntu.com Date: Mon, 11 Jun 2012 14:44:44 -0400 From: Ben Collins List-Id: Kernel team discussions 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 Cc: Adaptec OEM Raid Solutions event_wait)) { int blink; - if (--count == 0) { + if (time_is_before_eq_jiffies(timeout)) { struct aac_queue * q = &dev->queues->queue[AdapNormCmdQueue]; spin_lock_irqsave(q->lock, qflags); q->numpending--; @@ -588,7 +588,10 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, } return -EFAULT; } - udelay(5); + /* We used to udelay() here but that absorbed + * a CPU when a timeout occured. Not very + * useful. */ + cpu_relax(); } } else if (down_interruptible(&fibptr->event_wait)) { /* Do nothing ... satisfy