aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorNishanth Aravamudan <nacc@us.ibm.com>2005-09-03 18:56:01 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 03:06:01 -0400
commit0287ebedfa032a57bb47f4bc5cb5e268ecd844ad (patch)
treea30b87a024e4cedcc0fdcb242e7511f8a4c22aaf /arch
parent233ccd0d0452682edb51725410e0f8c0384e8b34 (diff)
[PATCH] ppc64: replace schedule_timeout() with msleep_interruptible()
Use msleep_interruptible() instead of schedule_timeout() in ppc64-specific code to cleanup/simplify the sleeping logic. Change the units of the parameter of do_event_scan_all_cpus() to milliseconds from jiffies. The return value of rtas_extended_busy_delay_time() was incorrectly being used as a jiffies value (it is actually milliseconds), which is fixed by using the value as a parameter to msleep_interruptible(). Also, use rtas_extended_busy_delay_time() in another case where similar logic is duplicated. Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ppc64/kernel/rtasd.c10
-rw-r--r--arch/ppc64/kernel/rtc.c7
-rw-r--r--arch/ppc64/kernel/scanlog.c17
3 files changed, 12 insertions, 22 deletions
diff --git a/arch/ppc64/kernel/rtasd.c b/arch/ppc64/kernel/rtasd.c
index b0c3b829fe47..e26b0420b6dd 100644
--- a/arch/ppc64/kernel/rtasd.c
+++ b/arch/ppc64/kernel/rtasd.c
@@ -19,6 +19,7 @@
19#include <linux/vmalloc.h> 19#include <linux/vmalloc.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/cpu.h> 21#include <linux/cpu.h>
22#include <linux/delay.h>
22 23
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24#include <asm/io.h> 25#include <asm/io.h>
@@ -412,8 +413,7 @@ static void do_event_scan_all_cpus(long delay)
412 413
413 /* Drop hotplug lock, and sleep for the specified delay */ 414 /* Drop hotplug lock, and sleep for the specified delay */
414 unlock_cpu_hotplug(); 415 unlock_cpu_hotplug();
415 set_current_state(TASK_INTERRUPTIBLE); 416 msleep_interruptible(delay);
416 schedule_timeout(delay);
417 lock_cpu_hotplug(); 417 lock_cpu_hotplug();
418 418
419 cpu = next_cpu(cpu, cpu_online_map); 419 cpu = next_cpu(cpu, cpu_online_map);
@@ -442,7 +442,7 @@ static int rtasd(void *unused)
442 442
443 printk(KERN_INFO "RTAS daemon started\n"); 443 printk(KERN_INFO "RTAS daemon started\n");
444 444
445 DEBUG("will sleep for %d jiffies\n", (HZ*60/rtas_event_scan_rate) / 2); 445 DEBUG("will sleep for %d milliseconds\n", (30000/rtas_event_scan_rate));
446 446
447 /* See if we have any error stored in NVRAM */ 447 /* See if we have any error stored in NVRAM */
448 memset(logdata, 0, rtas_error_log_max); 448 memset(logdata, 0, rtas_error_log_max);
@@ -459,7 +459,7 @@ static int rtasd(void *unused)
459 } 459 }
460 460
461 /* First pass. */ 461 /* First pass. */
462 do_event_scan_all_cpus(HZ); 462 do_event_scan_all_cpus(1000);
463 463
464 if (surveillance_timeout != -1) { 464 if (surveillance_timeout != -1) {
465 DEBUG("enabling surveillance\n"); 465 DEBUG("enabling surveillance\n");
@@ -471,7 +471,7 @@ static int rtasd(void *unused)
471 * machines have problems if we call event-scan too 471 * machines have problems if we call event-scan too
472 * quickly. */ 472 * quickly. */
473 for (;;) 473 for (;;)
474 do_event_scan_all_cpus((HZ*60/rtas_event_scan_rate) / 2); 474 do_event_scan_all_cpus(30000/rtas_event_scan_rate);
475 475
476error: 476error:
477 /* Should delete proc entries */ 477 /* Should delete proc entries */
diff --git a/arch/ppc64/kernel/rtc.c b/arch/ppc64/kernel/rtc.c
index d729fefa0df5..6ff52bc61325 100644
--- a/arch/ppc64/kernel/rtc.c
+++ b/arch/ppc64/kernel/rtc.c
@@ -35,6 +35,7 @@
35#include <linux/spinlock.h> 35#include <linux/spinlock.h>
36#include <linux/bcd.h> 36#include <linux/bcd.h>
37#include <linux/interrupt.h> 37#include <linux/interrupt.h>
38#include <linux/delay.h>
38 39
39#include <asm/io.h> 40#include <asm/io.h>
40#include <asm/uaccess.h> 41#include <asm/uaccess.h>
@@ -351,8 +352,7 @@ void rtas_get_rtc_time(struct rtc_time *rtc_tm)
351 return; /* delay not allowed */ 352 return; /* delay not allowed */
352 } 353 }
353 wait_time = rtas_extended_busy_delay_time(error); 354 wait_time = rtas_extended_busy_delay_time(error);
354 set_current_state(TASK_INTERRUPTIBLE); 355 msleep_interruptible(wait_time);
355 schedule_timeout(wait_time);
356 error = RTAS_CLOCK_BUSY; 356 error = RTAS_CLOCK_BUSY;
357 } 357 }
358 } while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb)); 358 } while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb));
@@ -386,8 +386,7 @@ int rtas_set_rtc_time(struct rtc_time *tm)
386 if (in_interrupt()) 386 if (in_interrupt())
387 return 1; /* probably decrementer */ 387 return 1; /* probably decrementer */
388 wait_time = rtas_extended_busy_delay_time(error); 388 wait_time = rtas_extended_busy_delay_time(error);
389 set_current_state(TASK_INTERRUPTIBLE); 389 msleep_interruptible(wait_time);
390 schedule_timeout(wait_time);
391 error = RTAS_CLOCK_BUSY; 390 error = RTAS_CLOCK_BUSY;
392 } 391 }
393 } while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb)); 392 } while (error == RTAS_CLOCK_BUSY && (__get_tb() < max_wait_tb));
diff --git a/arch/ppc64/kernel/scanlog.c b/arch/ppc64/kernel/scanlog.c
index 4d70736619c7..215bf8900304 100644
--- a/arch/ppc64/kernel/scanlog.c
+++ b/arch/ppc64/kernel/scanlog.c
@@ -25,6 +25,7 @@
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/proc_fs.h> 26#include <linux/proc_fs.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/delay.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/rtas.h> 30#include <asm/rtas.h>
30#include <asm/prom.h> 31#include <asm/prom.h>
@@ -77,7 +78,7 @@ static ssize_t scanlog_read(struct file *file, char __user *buf,
77 return -EFAULT; 78 return -EFAULT;
78 79
79 for (;;) { 80 for (;;) {
80 wait_time = HZ/2; /* default wait if no data */ 81 wait_time = 500; /* default wait if no data */
81 spin_lock(&rtas_data_buf_lock); 82 spin_lock(&rtas_data_buf_lock);
82 memcpy(rtas_data_buf, data, RTAS_DATA_BUF_SIZE); 83 memcpy(rtas_data_buf, data, RTAS_DATA_BUF_SIZE);
83 status = rtas_call(ibm_scan_log_dump, 2, 1, NULL, 84 status = rtas_call(ibm_scan_log_dump, 2, 1, NULL,
@@ -107,24 +108,14 @@ static ssize_t scanlog_read(struct file *file, char __user *buf,
107 break; 108 break;
108 default: 109 default:
109 if (status > 9900 && status <= 9905) { 110 if (status > 9900 && status <= 9905) {
110 /* No data. RTAS is hinting at a delay required 111 wait_time = rtas_extended_busy_delay_time(status);
111 * between 1-100000 milliseconds
112 */
113 int ms = 1;
114 for (; status > 9900; status--)
115 ms = ms * 10;
116 /* Use microseconds for reasonable accuracy */
117 ms *= 1000;
118 wait_time = ms / (1000000/HZ); /* round down is fine */
119 /* Fall through to sleep */
120 } else { 112 } else {
121 printk(KERN_ERR "scanlog: unknown error from rtas: %d\n", status); 113 printk(KERN_ERR "scanlog: unknown error from rtas: %d\n", status);
122 return -EIO; 114 return -EIO;
123 } 115 }
124 } 116 }
125 /* Apparently no data yet. Wait and try again. */ 117 /* Apparently no data yet. Wait and try again. */
126 set_current_state(TASK_INTERRUPTIBLE); 118 msleep_interruptible(wait_time);
127 schedule_timeout(wait_time);
128 } 119 }
129 /*NOTREACHED*/ 120 /*NOTREACHED*/
130} 121}