mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] 2.5.41, cciss (3 of 3)
@ 2002-10-11 14:10 Stephen Cameron
  2002-10-11 14:21 ` Arjan van de Ven
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Cameron @ 2002-10-11 14:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: axboe


Wait up to 20 seconds for polled commands to complete.  A certain multiport
storage box needs this.

diff -urN linux-2.5.41-p/drivers/block/cciss.c linux-2.5.41-q/drivers/block/cciss.c
--- linux-2.5.41-p/drivers/block/cciss.c	Wed Oct  9 15:22:14 2002
+++ linux-2.5.41-q/drivers/block/cciss.c	Wed Oct  9 15:54:35 2002
@@ -1318,9 +1318,9 @@
         unsigned long done;
         int i;
 
-        /* Wait (up to 2 seconds) for a command to complete */
+        /* Wait (up to 20 seconds) for a command to complete */
 
-        for (i = 200000; i > 0; i--) {
+        for (i = 2000000; i > 0; i--) {
                 done = hba[ctlr]->access.command_completed(hba[ctlr]);
                 if (done == FIFO_EMPTY) {
                         udelay(10);     /* a short fixed delay */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] 2.5.41, cciss (3 of 3)
  2002-10-11 14:10 [PATCH] 2.5.41, cciss (3 of 3) Stephen Cameron
@ 2002-10-11 14:21 ` Arjan van de Ven
  0 siblings, 0 replies; 4+ messages in thread
From: Arjan van de Ven @ 2002-10-11 14:21 UTC (permalink / raw)
  To: steve.cameron; +Cc: linux-kernel, axboe

[-- Attachment #1: Type: text/plain, Size: 998 bytes --]

On Fri, 2002-10-11 at 16:10, Stephen Cameron wrote:
> 
> Wait up to 20 seconds for polled commands to complete.  A certain multiport
> storage box needs this.
> 
> diff -urN linux-2.5.41-p/drivers/block/cciss.c linux-2.5.41-q/drivers/block/cciss.c
> --- linux-2.5.41-p/drivers/block/cciss.c	Wed Oct  9 15:22:14 2002
> +++ linux-2.5.41-q/drivers/block/cciss.c	Wed Oct  9 15:54:35 2002
> @@ -1318,9 +1318,9 @@
>          unsigned long done;
>          int i;
>  
> -        /* Wait (up to 2 seconds) for a command to complete */
> +        /* Wait (up to 20 seconds) for a command to complete */
>  
> -        for (i = 200000; i > 0; i--) {
> +        for (i = 2000000; i > 0; i--) {
>                  done = hba[ctlr]->access.command_completed(hba[ctlr]);
>                  if (done == FIFO_EMPTY) {
>                          udelay(10);     /* a short fixed delay */

ugh 20 seconds udelay....

why can't you sleep here ?
(and yes 20 seconds WILL trigger watchdogs!)


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] 2.5.41, cciss (3 of 3)
@ 2002-10-11 15:38 Stephen Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Cameron @ 2002-10-11 15:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: arjanv, axboe

Arjan van de Ven wrote:

> On Fri, 2002-10-11 at 16:10, Stephen Cameron wrote:
[... a bogus patch involving a 20 second udelay ...]

> ugh 20 seconds udelay....
>
> why can't you sleep here ? [...]

No reason that I can see.  Thanks for pointing it out.
Is this better?  (I also changed the spaces to tabs 
while I was at it.)

-- steve

diff -urN linux-2.5.41/drivers/block/cciss.c linux-2.5.41-20sec/drivers/block/cciss.c
--- linux-2.5.41/drivers/block/cciss.c	Fri Oct 11 09:17:00 2002
+++ linux-2.5.41-20sec/drivers/block/cciss.c	Fri Oct 11 09:07:17 2002
@@ -1297,24 +1297,25 @@
 /*
  *   Wait polling for a command to complete.
  *   The memory mapped FIFO is polled for the completion.
- *   Used only at init time, interrupts disabled.
+ *   Used only at init time, interrupts from the HBA are disabled.
  */
 static unsigned long pollcomplete(int ctlr)
 {
-        unsigned long done;
-        int i;
+	unsigned long done;
+	int i;
+	DECLARE_WAIT_QUEUE_HEAD(polling_wqh);
 
-        /* Wait (up to 2 seconds) for a command to complete */
+	/* Wait (up to 20 seconds) for a command to complete */
 
-        for (i = 200000; i > 0; i--) {
-                done = hba[ctlr]->access.command_completed(hba[ctlr]);
-                if (done == FIFO_EMPTY) {
-                        udelay(10);     /* a short fixed delay */
-                } else
-                        return (done);
-        }
-        /* Invalid address to tell caller we ran out of time */
-        return 1;
+	for (i = 20 * HZ; i > 0; i--) {
+		done = hba[ctlr]->access.command_completed(hba[ctlr]);
+		if (done == FIFO_EMPTY)
+			interruptible_sleep_on_timeout(&polling_wqh, 1);
+		else
+			return (done);
+	}
+	/* Invalid address to tell caller we ran out of time */
+	return 1;
 }
 /*
  * Send a command to the controller, and wait for it to complete.  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] 2.5.41, cciss (3 of 3)
@ 2002-10-11 14:32 Cameron, Steve
  0 siblings, 0 replies; 4+ messages in thread
From: Cameron, Steve @ 2002-10-11 14:32 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel, axboe


> From: Arjan van de Ven wrote:
> On Fri, 2002-10-11 at 16:10, Stephen Cameron wrote:
> > 
> > Wait up to 20 seconds for polled commands to complete.  A 
> certain multiport
> > storage box needs this.
> > 
> > diff -urN linux-2.5.41-p/drivers/block/cciss.c 
> linux-2.5.41-q/drivers/block/cciss.c
> > --- linux-2.5.41-p/drivers/block/cciss.c	Wed Oct  9 15:22:14 2002
> > +++ linux-2.5.41-q/drivers/block/cciss.c	Wed Oct  9 15:54:35 2002
> > @@ -1318,9 +1318,9 @@
> >          unsigned long done;
> >          int i;
> >  
> > -        /* Wait (up to 2 seconds) for a command to complete */
> > +        /* Wait (up to 20 seconds) for a command to complete */
> >  
> > -        for (i = 200000; i > 0; i--) {
> > +        for (i = 2000000; i > 0; i--) {
> >                  done = 
> hba[ctlr]->access.command_completed(hba[ctlr]);
> >                  if (done == FIFO_EMPTY) {
> >                          udelay(10);     /* a short fixed delay */
> 
> ugh 20 seconds udelay....
> 
> why can't you sleep here ?
> (and yes 20 seconds WILL trigger watchdogs!)

Ok.  Nevermind that patch then.  We'll have to rethink it.
-- steve


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-10-11 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-11 14:10 [PATCH] 2.5.41, cciss (3 of 3) Stephen Cameron
2002-10-11 14:21 ` Arjan van de Ven
2002-10-11 14:32 Cameron, Steve
2002-10-11 15:38 Stephen Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®