Skip to contentSkip to conversation

cciss: fix schedule_timeout() parameters

PATCH In review Randy Dunlap 3 participants 5 messages Aug 30, 2009 – Sep 1, 2009 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cciss: fix schedule_timeout() parameters

From: Randy Dunlap <[email protected]>

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

---
 drivers/block/cciss.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/block/cciss.c +3 -2
@@ -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
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines

-----Original Message-----
From: Randy Dunlap [mailto:[email protected]]
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

Quoted 7 lines

From: Randy Dunlap <[email protected]>

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

Quoted 35 lines
---
 drivers/block/cciss.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/block/cciss.c +2 -1
@@ -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

drivers/block/cciss.c +1 -1
 			break;
 		/* delay and try again */
 		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(10);
+		schedule_timeout(msecs_to_jiffies(1));
 	}
 
 #ifdef CCISS_DEBUG
#2 lore raw
In reply to Randy Dunlap
Quoted 31 lines · Randy Dunlap

From: Randy Dunlap <[email protected]>

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

---
 drivers/block/cciss.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/block/cciss.c +2 -1
@@ -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");

drivers/block/cciss.c static int __devinit cciss_pci_init(ctlr · line 3619

Quoted 5 lines
drivers/block/cciss.c +1 -1
@@ -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)?

#3 lore raw
Quoted 31 lines · On Mon, 31 Aug 2009 20:24:45 +0200 Marcin Slusarz wrote:
Quoted 30 lines · Randy Dunlap

From: Randy Dunlap <[email protected]>

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

---
 drivers/block/cciss.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/block/cciss.c +2 -1
@@ -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");
Quoted 8 lines

drivers/block/cciss.c static int __devinit cciss_pci_init(ctlr · line 3619

Quoted 6 lines
drivers/block/cciss.c +1 -1
@@ -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 ***

#4 lore raw
Quoted 67 lines

-----Original Message-----
From: Randy Dunlap [mailto:[email protected]]
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

Quoted 12 lines · On Mon, 31 Aug 2009 20:24:45 +0200 Marcin Slusarz wrote:
Quoted 11 lines · Randy Dunlap

From: Randy Dunlap <[email protected]>

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

---
 drivers/block/cciss.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 16 lines
Quoted 11 lines
drivers/block/cciss.c +1 -0
@@ -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>

drivers/block/cciss.c static int __devinit cciss_pci_init(ctlr · line 3493

Quoted 5 lines
drivers/block/cciss.c +1 -1
@@ -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 */

Quoted 3 lines

drivers/block/cciss.c static int __devinit cciss_pci_init(ctlr

Quoted 3 lines
drivers/block/cciss.c +0 -0
 	}
 	if (scratchpad != CCISS_FIRMWARE_READY) {
 		printk(KERN_WARNING "cciss: Board not ready.  

Timed out.\n"); @@

Quoted 8 lines

drivers/block/cciss.c static int __devinit cciss_pci_init(ctlr · line 3619

Quoted 6 lines

-3615,7 +3616,7 @@ static int __devinit cciss_pci_init(ctlr

drivers/block/cciss.c +1 -1
 			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));
	}
Quoted 8 lines

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

Quoted 7 lines

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