public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cciss: fix schedule_timeout() parameters
@ 2009-08-30 20:19 Randy Dunlap
  2009-08-31 14:23 ` Miller, Mike (OS Dev)
  2009-08-31 18:24 ` Marcin Slusarz
  0 siblings, 2 replies; 5+ messages in thread
From: Randy Dunlap @ 2009-08-30 20:19 UTC (permalink / raw)
  To: lkml; +Cc: akpm, Mike Miller, iss_storagedev

From: Randy Dunlap <randy.dunlap@oracle.com>

Change schedule_timeout() parameter to not be specific to HZ=1000.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: iss_storagedev@hp.com
---
 drivers/block/cciss.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- lnx-2631-rc7.orig/drivers/block/cciss.c
+++ lnx-2631-rc7/drivers/block/cciss.c
@@ -36,6 +36,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/init.h>
+#include <linux/jiffies.h>
 #include <linux/hdreg.h>
 #include <linux/spinlock.h>
 #include <linux/compat.h>
@@ -3489,7 +3490,7 @@ static int __devinit cciss_pci_init(ctlr
 		if (scratchpad == CCISS_FIRMWARE_READY)
 			break;
 		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(HZ / 10);	/* wait 100ms */
+		schedule_timeout(msecs_to_jiffies(100));	/* wait 100ms */
 	}
 	if (scratchpad != CCISS_FIRMWARE_READY) {
 		printk(KERN_WARNING "cciss: Board not ready.  Timed out.\n");
@@ -3615,7 +3616,7 @@ static int __devinit cciss_pci_init(ctlr
 			break;
 		/* delay and try again */
 		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(10);
+		schedule_timeout(msecs_to_jiffies(1));
 	}
 
 #ifdef CCISS_DEBUG

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

* RE: [PATCH] cciss: fix schedule_timeout() parameters
  2009-08-30 20:19 [PATCH] cciss: fix schedule_timeout() parameters Randy Dunlap
@ 2009-08-31 14:23 ` Miller, Mike (OS Dev)
  2009-08-31 18:24 ` Marcin Slusarz
  1 sibling, 0 replies; 5+ messages in thread
From: Miller, Mike (OS Dev) @ 2009-08-31 14:23 UTC (permalink / raw)
  To: Randy Dunlap, lkml; +Cc: akpm, ISS StorageDev

 

> -----Original Message-----
> From: Randy Dunlap [mailto:rdunlap@xenotime.net] 
> Sent: Sunday, August 30, 2009 3:19 PM
> To: lkml
> Cc: akpm; Miller, Mike (OS Dev); ISS StorageDev
> Subject: [PATCH] cciss: fix schedule_timeout() parameters
> 
> From: Randy Dunlap <randy.dunlap@oracle.com>
> 
> Change schedule_timeout() parameter to not be specific to HZ=1000.
> 
> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> Cc: Mike Miller <mike.miller@hp.com>
> Cc: iss_storagedev@hp.com

Acked-by: Mike Miller <mike.miller@hp.com>

> ---
>  drivers/block/cciss.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> --- lnx-2631-rc7.orig/drivers/block/cciss.c
> +++ lnx-2631-rc7/drivers/block/cciss.c
> @@ -36,6 +36,7 @@
>  #include <linux/proc_fs.h>
>  #include <linux/seq_file.h>
>  #include <linux/init.h>
> +#include <linux/jiffies.h>
>  #include <linux/hdreg.h>
>  #include <linux/spinlock.h>
>  #include <linux/compat.h>
> @@ -3489,7 +3490,7 @@ static int __devinit cciss_pci_init(ctlr
>  		if (scratchpad == CCISS_FIRMWARE_READY)
>  			break;
>  		set_current_state(TASK_INTERRUPTIBLE);
> -		schedule_timeout(HZ / 10);	/* wait 100ms */
> +		schedule_timeout(msecs_to_jiffies(100));	
> /* wait 100ms */
>  	}
>  	if (scratchpad != CCISS_FIRMWARE_READY) {
>  		printk(KERN_WARNING "cciss: Board not ready.  
> Timed out.\n"); @@ -3615,7 +3616,7 @@ static int __devinit 
> cciss_pci_init(ctlr
>  			break;
>  		/* delay and try again */
>  		set_current_state(TASK_INTERRUPTIBLE);
> -		schedule_timeout(10);
> +		schedule_timeout(msecs_to_jiffies(1));
>  	}
>  
>  #ifdef CCISS_DEBUG
> 

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

* Re: [PATCH] cciss: fix schedule_timeout() parameters
  2009-08-30 20:19 [PATCH] cciss: fix schedule_timeout() parameters Randy Dunlap
  2009-08-31 14:23 ` Miller, Mike (OS Dev)
@ 2009-08-31 18:24 ` Marcin Slusarz
  2009-08-31 20:03   ` Randy Dunlap
  1 sibling, 1 reply; 5+ messages in thread
From: Marcin Slusarz @ 2009-08-31 18:24 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: lkml, akpm, Mike Miller, iss_storagedev

Randy Dunlap wrote:
> From: Randy Dunlap <randy.dunlap@oracle.com>
> 
> Change schedule_timeout() parameter to not be specific to HZ=1000.
> 
> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> Cc: Mike Miller <mike.miller@hp.com>
> Cc: iss_storagedev@hp.com
> ---
>  drivers/block/cciss.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> --- lnx-2631-rc7.orig/drivers/block/cciss.c
> +++ lnx-2631-rc7/drivers/block/cciss.c
> @@ -36,6 +36,7 @@
>  #include <linux/proc_fs.h>
>  #include <linux/seq_file.h>
>  #include <linux/init.h>
> +#include <linux/jiffies.h>
>  #include <linux/hdreg.h>
>  #include <linux/spinlock.h>
>  #include <linux/compat.h>
> @@ -3489,7 +3490,7 @@ static int __devinit cciss_pci_init(ctlr
>  		if (scratchpad == CCISS_FIRMWARE_READY)
>  			break;
>  		set_current_state(TASK_INTERRUPTIBLE);
> -		schedule_timeout(HZ / 10);	/* wait 100ms */
> +		schedule_timeout(msecs_to_jiffies(100));	/* wait 100ms */
>  	}
>  	if (scratchpad != CCISS_FIRMWARE_READY) {
>  		printk(KERN_WARNING "cciss: Board not ready.  Timed out.\n");
> @@ -3615,7 +3616,7 @@ static int __devinit cciss_pci_init(ctlr
>  			break;
>  		/* delay and try again */
>  		set_current_state(TASK_INTERRUPTIBLE);
> -		schedule_timeout(10);
> +		schedule_timeout(msecs_to_jiffies(1));

shouldn't it be msecs_to_jiffies(10)?

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

* Re: [PATCH] cciss: fix schedule_timeout() parameters
  2009-08-31 18:24 ` Marcin Slusarz
@ 2009-08-31 20:03   ` Randy Dunlap
  2009-09-01 19:43     ` Miller, Mike (OS Dev)
  0 siblings, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2009-08-31 20:03 UTC (permalink / raw)
  To: Marcin Slusarz; +Cc: lkml, akpm, Mike Miller, iss_storagedev

On Mon, 31 Aug 2009 20:24:45 +0200 Marcin Slusarz wrote:

> Randy Dunlap wrote:
> > From: Randy Dunlap <randy.dunlap@oracle.com>
> > 
> > Change schedule_timeout() parameter to not be specific to HZ=1000.
> > 
> > Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> > Cc: Mike Miller <mike.miller@hp.com>
> > Cc: iss_storagedev@hp.com
> > ---
> >  drivers/block/cciss.c |    5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > --- lnx-2631-rc7.orig/drivers/block/cciss.c
> > +++ lnx-2631-rc7/drivers/block/cciss.c
> > @@ -36,6 +36,7 @@
> >  #include <linux/proc_fs.h>
> >  #include <linux/seq_file.h>
> >  #include <linux/init.h>
> > +#include <linux/jiffies.h>
> >  #include <linux/hdreg.h>
> >  #include <linux/spinlock.h>
> >  #include <linux/compat.h>
> > @@ -3489,7 +3490,7 @@ static int __devinit cciss_pci_init(ctlr
> >  		if (scratchpad == CCISS_FIRMWARE_READY)
> >  			break;
> >  		set_current_state(TASK_INTERRUPTIBLE);
> > -		schedule_timeout(HZ / 10);	/* wait 100ms */
> > +		schedule_timeout(msecs_to_jiffies(100));	/* wait 100ms */
> >  	}
> >  	if (scratchpad != CCISS_FIRMWARE_READY) {
> >  		printk(KERN_WARNING "cciss: Board not ready.  Timed out.\n");
> > @@ -3615,7 +3616,7 @@ static int __devinit cciss_pci_init(ctlr
> >  			break;
> >  		/* delay and try again */
> >  		set_current_state(TASK_INTERRUPTIBLE);
> > -		schedule_timeout(10);
> > +		schedule_timeout(msecs_to_jiffies(1));
> 
> shouldn't it be msecs_to_jiffies(10)?

Hm, thanks, that's a good observation -- and possibly correct.


The reason that I used (1) was that I looked at the loop:

	for (i = 0; i < MAX_CONFIG_WAIT; i++) {
		if (!(readl(c->vaddr + SA5_DOORBELL) & CFGTBL_ChangeReq))
			break;
		/* delay and try again */
		set_current_state(TASK_INTERRUPTIBLE);
		schedule_timeout(msecs_to_jiffies(1));
	}

and this:
/* How long to wait (in milliseconds) for board to go into simple mode */
#define MAX_CONFIG_WAIT 30000

and then I tried to make the loop run for a max. of 30000 milliseconds.

Mike M., any comments here?


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

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

* RE: [PATCH] cciss: fix schedule_timeout() parameters
  2009-08-31 20:03   ` Randy Dunlap
@ 2009-09-01 19:43     ` Miller, Mike (OS Dev)
  0 siblings, 0 replies; 5+ messages in thread
From: Miller, Mike (OS Dev) @ 2009-09-01 19:43 UTC (permalink / raw)
  To: Randy Dunlap, Marcin Slusarz; +Cc: lkml, akpm, ISS StorageDev

 

> -----Original Message-----
> From: Randy Dunlap [mailto:rdunlap@xenotime.net] 
> Sent: Monday, August 31, 2009 3:04 PM
> To: Marcin Slusarz
> Cc: lkml; akpm; Miller, Mike (OS Dev); ISS StorageDev
> Subject: Re: [PATCH] cciss: fix schedule_timeout() parameters
> 
> On Mon, 31 Aug 2009 20:24:45 +0200 Marcin Slusarz wrote:
> 
> > Randy Dunlap wrote:
> > > From: Randy Dunlap <randy.dunlap@oracle.com>
> > > 
> > > Change schedule_timeout() parameter to not be specific to HZ=1000.
> > > 
> > > Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> > > Cc: Mike Miller <mike.miller@hp.com>
> > > Cc: iss_storagedev@hp.com
> > > ---
> > >  drivers/block/cciss.c |    5 +++--
> > >  1 file changed, 3 insertions(+), 2 deletions(-)
> > > 
> > > --- lnx-2631-rc7.orig/drivers/block/cciss.c
> > > +++ lnx-2631-rc7/drivers/block/cciss.c
> > > @@ -36,6 +36,7 @@
> > >  #include <linux/proc_fs.h>
> > >  #include <linux/seq_file.h>
> > >  #include <linux/init.h>
> > > +#include <linux/jiffies.h>
> > >  #include <linux/hdreg.h>
> > >  #include <linux/spinlock.h>
> > >  #include <linux/compat.h>
> > > @@ -3489,7 +3490,7 @@ static int __devinit cciss_pci_init(ctlr
> > >  		if (scratchpad == CCISS_FIRMWARE_READY)
> > >  			break;
> > >  		set_current_state(TASK_INTERRUPTIBLE);
> > > -		schedule_timeout(HZ / 10);	/* wait 100ms */
> > > +		schedule_timeout(msecs_to_jiffies(100));	
> /* wait 100ms */
> > >  	}
> > >  	if (scratchpad != CCISS_FIRMWARE_READY) {
> > >  		printk(KERN_WARNING "cciss: Board not ready.  
> Timed out.\n"); @@ 
> > > -3615,7 +3616,7 @@ static int __devinit cciss_pci_init(ctlr
> > >  			break;
> > >  		/* delay and try again */
> > >  		set_current_state(TASK_INTERRUPTIBLE);
> > > -		schedule_timeout(10);
> > > +		schedule_timeout(msecs_to_jiffies(1));
> > 
> > shouldn't it be msecs_to_jiffies(10)?
> 
> Hm, thanks, that's a good observation -- and possibly correct.
> 
> 
> The reason that I used (1) was that I looked at the loop:
> 
> 	for (i = 0; i < MAX_CONFIG_WAIT; i++) {
> 		if (!(readl(c->vaddr + SA5_DOORBELL) & 
> CFGTBL_ChangeReq))
> 			break;
> 		/* delay and try again */
> 		set_current_state(TASK_INTERRUPTIBLE);
> 		schedule_timeout(msecs_to_jiffies(1));
> 	}
> 
> and this:
> /* How long to wait (in milliseconds) for board to go into 
> simple mode */ #define MAX_CONFIG_WAIT 30000
> 
> and then I tried to make the loop run for a max. of 30000 
> milliseconds.
> 
> Mike M., any comments here?

Sorry to take so long to respond. I've been playing around with msecs_to_jiffies figuring out what it means to me. :) 1 is the correct value. If we loop 30000 times with a value of 10 it takes 5 minutes. I can't think of anything that would take that much time. 

-- mikem

> 
> 
> ---
> ~Randy
> *** Remember to use Documentation/SubmitChecklist when 
> testing your code ***
> 

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

end of thread, other threads:[~2009-09-01 19:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-30 20:19 [PATCH] cciss: fix schedule_timeout() parameters Randy Dunlap
2009-08-31 14:23 ` Miller, Mike (OS Dev)
2009-08-31 18:24 ` Marcin Slusarz
2009-08-31 20:03   ` Randy Dunlap
2009-09-01 19:43     ` Miller, Mike (OS Dev)

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