patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / arch / parisc / kernel / smp.c
1 /*
2 ** SMP Support
3 **
4 ** Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
5 ** Copyright (C) 1999 David Mosberger-Tang <davidm@hpl.hp.com>
6 ** Copyright (C) 2001,2004 Grant Grundler <grundler@parisc-linux.org>
7 ** 
8 ** Lots of stuff stolen from arch/alpha/kernel/smp.c
9 ** ...and then parisc stole from arch/ia64/kernel/smp.c. Thanks David! :^)
10 **
11 ** Thanks to John Curry and Ullas Ponnadi. I learned alot from their work.
12 ** -grant (1/12/2001)
13 **
14 **      This program is free software; you can redistribute it and/or modify
15 **      it under the terms of the GNU General Public License as published by
16 **      the Free Software Foundation; either version 2 of the License, or
17 **      (at your option) any later version.
18 */
19 #undef ENTRY_SYS_CPUS   /* syscall support for iCOD-like functionality */
20
21 #include <linux/autoconf.h>
22
23 #include <linux/types.h>
24 #include <linux/spinlock.h>
25 #include <linux/slab.h>
26
27 #include <linux/kernel.h>
28 #include <linux/module.h>
29 #include <linux/sched.h>
30 #include <linux/init.h>
31 #include <linux/interrupt.h>
32 #include <linux/smp.h>
33 #include <linux/kernel_stat.h>
34 #include <linux/mm.h>
35 #include <linux/delay.h>
36
37 #include <asm/system.h>
38 #include <asm/atomic.h>
39 #include <asm/bitops.h>
40 #include <asm/current.h>
41 #include <asm/delay.h>
42 #include <asm/pgalloc.h>        /* for flush_tlb_all() proto/macro */
43
44 #include <asm/io.h>
45 #include <asm/irq.h>            /* for CPU_IRQ_REGION and friends */
46 #include <asm/mmu_context.h>
47 #include <asm/page.h>
48 #include <asm/pgtable.h>
49 #include <asm/pgalloc.h>
50 #include <asm/processor.h>
51 #include <asm/ptrace.h>
52 #include <asm/unistd.h>
53 #include <asm/cacheflush.h>
54
55 #define kDEBUG 0
56
57 spinlock_t pa_dbit_lock = SPIN_LOCK_UNLOCKED;
58
59 spinlock_t smp_lock = SPIN_LOCK_UNLOCKED;
60
61 volatile struct task_struct *smp_init_current_idle_task;
62
63 static volatile int cpu_now_booting = 0;        /* track which CPU is booting */
64 static int parisc_max_cpus = -1;                /* Command line */
65
66 unsigned long cache_decay_ticks;        /* declared by include/linux/sched.h */
67 cpumask_t cpu_online_map = CPU_MASK_NONE;       /* Bitmap of online CPUs */
68 cpumask_t cpu_possible_map = CPU_MASK_NONE;     /* Bitmap of Present CPUs */
69
70 EXPORT_SYMBOL(cpu_online_map);
71 EXPORT_SYMBOL(cpu_possible_map);
72
73
74 struct smp_call_struct {
75         void (*func) (void *info);
76         void *info;
77         long wait;
78         atomic_t unstarted_count;
79         atomic_t unfinished_count;
80 };
81 static volatile struct smp_call_struct *smp_call_function_data;
82
83 enum ipi_message_type {
84         IPI_NOP=0,
85         IPI_RESCHEDULE=1,
86         IPI_CALL_FUNC,
87         IPI_CPU_START,
88         IPI_CPU_STOP,
89         IPI_CPU_TEST
90 };
91
92
93 /********** SMP inter processor interrupt and communication routines */
94
95 #undef PER_CPU_IRQ_REGION
96 #ifdef PER_CPU_IRQ_REGION
97 /* XXX REVISIT Ignore for now.
98 **    *May* need this "hook" to register IPI handler
99 **    once we have perCPU ExtIntr switch tables.
100 */
101 static void
102 ipi_init(int cpuid)
103 {
104
105         /* If CPU is present ... */
106 #ifdef ENTRY_SYS_CPUS
107         /* *and* running (not stopped) ... */
108 #error iCOD support wants state checked here.
109 #endif
110
111 #error verify IRQ_OFFSET(IPI_IRQ) is ipi_interrupt() in new IRQ region
112
113         if(cpu_online(cpuid) )
114         {
115                 switch_to_idle_task(current);
116         }
117
118         return;
119 }
120 #endif
121
122
123 /*
124 ** Yoink this CPU from the runnable list... 
125 **
126 */
127 static void
128 halt_processor(void) 
129 {
130 #ifdef ENTRY_SYS_CPUS
131 #error halt_processor() needs rework
132 /*
133 ** o migrate I/O interrupts off this CPU.
134 ** o leave IPI enabled - __cli() will disable IPI.
135 ** o leave CPU in online map - just change the state
136 */
137         cpu_data[this_cpu].state = STATE_STOPPED;
138         mark_bh(IPI_BH);
139 #else
140         /* REVISIT : redirect I/O Interrupts to another CPU? */
141         /* REVISIT : does PM *know* this CPU isn't available? */
142         cpu_clear(smp_processor_id(), cpu_online_map);
143         local_irq_disable();
144         for (;;)
145                 ;
146 #endif
147 }
148
149
150 irqreturn_t
151 ipi_interrupt(int irq, void *dev_id, struct pt_regs *regs) 
152 {
153         int this_cpu = smp_processor_id();
154         struct cpuinfo_parisc *p = &cpu_data[this_cpu];
155         unsigned long ops;
156         unsigned long flags;
157
158         /* Count this now; we may make a call that never returns. */
159         p->ipi_count++;
160
161         mb();   /* Order interrupt and bit testing. */
162
163         for (;;) {
164                 spin_lock_irqsave(&(p->lock),flags);
165                 ops = p->pending_ipi;
166                 p->pending_ipi = 0;
167                 spin_unlock_irqrestore(&(p->lock),flags);
168
169                 mb(); /* Order bit clearing and data access. */
170
171                 if (!ops)
172                     break;
173
174                 while (ops) {
175                         unsigned long which = ffz(~ops);
176
177                         switch (which) {
178                         case IPI_RESCHEDULE:
179 #if (kDEBUG>=100)
180                                 printk(KERN_DEBUG "CPU%d IPI_RESCHEDULE\n",this_cpu);
181 #endif /* kDEBUG */
182                                 ops &= ~(1 << IPI_RESCHEDULE);
183                                 /*
184                                  * Reschedule callback.  Everything to be
185                                  * done is done by the interrupt return path.
186                                  */
187                                 break;
188
189                         case IPI_CALL_FUNC:
190 #if (kDEBUG>=100)
191                                 printk(KERN_DEBUG "CPU%d IPI_CALL_FUNC\n",this_cpu);
192 #endif /* kDEBUG */
193                                 ops &= ~(1 << IPI_CALL_FUNC);
194                                 {
195                                         volatile struct smp_call_struct *data;
196                                         void (*func)(void *info);
197                                         void *info;
198                                         int wait;
199
200                                         data = smp_call_function_data;
201                                         func = data->func;
202                                         info = data->info;
203                                         wait = data->wait;
204
205                                         mb();
206                                         atomic_dec ((atomic_t *)&data->unstarted_count);
207
208                                         /* At this point, *data can't
209                                          * be relied upon.
210                                          */
211
212                                         (*func)(info);
213
214                                         /* Notify the sending CPU that the
215                                          * task is done.
216                                          */
217                                         mb();
218                                         if (wait)
219                                                 atomic_dec ((atomic_t *)&data->unfinished_count);
220                                 }
221                                 break;
222
223                         case IPI_CPU_START:
224 #if (kDEBUG>=100)
225                                 printk(KERN_DEBUG "CPU%d IPI_CPU_START\n",this_cpu);
226 #endif /* kDEBUG */
227                                 ops &= ~(1 << IPI_CPU_START);
228 #ifdef ENTRY_SYS_CPUS
229                                 p->state = STATE_RUNNING;
230 #endif
231                                 break;
232
233                         case IPI_CPU_STOP:
234 #if (kDEBUG>=100)
235                                 printk(KERN_DEBUG "CPU%d IPI_CPU_STOP\n",this_cpu);
236 #endif /* kDEBUG */
237                                 ops &= ~(1 << IPI_CPU_STOP);
238 #ifdef ENTRY_SYS_CPUS
239 #else
240                                 halt_processor();
241 #endif
242                                 break;
243
244                         case IPI_CPU_TEST:
245 #if (kDEBUG>=100)
246                                 printk(KERN_DEBUG "CPU%d is alive!\n",this_cpu);
247 #endif /* kDEBUG */
248                                 ops &= ~(1 << IPI_CPU_TEST);
249                                 break;
250
251                         default:
252                                 printk(KERN_CRIT "Unknown IPI num on CPU%d: %lu\n",
253                                         this_cpu, which);
254                                 ops &= ~(1 << which);
255                                 return IRQ_NONE;
256                         } /* Switch */
257                 } /* while (ops) */
258         }
259         return IRQ_HANDLED;
260 }
261
262
263 static inline void
264 ipi_send(int cpu, enum ipi_message_type op)
265 {
266         struct cpuinfo_parisc *p = &cpu_data[cpu];
267         unsigned long flags;
268
269         spin_lock_irqsave(&(p->lock),flags);
270         p->pending_ipi |= 1 << op;
271         __raw_writel(IRQ_OFFSET(IPI_IRQ), cpu_data[cpu].hpa);
272         spin_unlock_irqrestore(&(p->lock),flags);
273 }
274
275
276 static inline void
277 send_IPI_single(int dest_cpu, enum ipi_message_type op)
278 {
279         if (dest_cpu == NO_PROC_ID) {
280                 BUG();
281                 return;
282         }
283
284         ipi_send(dest_cpu, op);
285 }
286
287 static inline void
288 send_IPI_allbutself(enum ipi_message_type op)
289 {
290         int i;
291         
292         for (i = 0; i < parisc_max_cpus; i++) {
293                 if (cpu_online(i) && i != smp_processor_id())
294                         send_IPI_single(i, op);
295         }
296 }
297
298
299 inline void 
300 smp_send_stop(void)     { send_IPI_allbutself(IPI_CPU_STOP); }
301
302 static inline void
303 smp_send_start(void)    { send_IPI_allbutself(IPI_CPU_START); }
304
305 void 
306 smp_send_reschedule(int cpu) { send_IPI_single(cpu, IPI_RESCHEDULE); }
307
308
309 /**
310  * Run a function on all other CPUs.
311  *  <func>      The function to run. This must be fast and non-blocking.
312  *  <info>      An arbitrary pointer to pass to the function.
313  *  <retry>     If true, keep retrying until ready.
314  *  <wait>      If true, wait until function has completed on other CPUs.
315  *  [RETURNS]   0 on success, else a negative status code.
316  *
317  * Does not return until remote CPUs are nearly ready to execute <func>
318  * or have executed.
319  */
320
321 int
322 smp_call_function (void (*func) (void *info), void *info, int retry, int wait)
323 {
324         struct smp_call_struct data;
325         unsigned long timeout;
326         static spinlock_t lock = SPIN_LOCK_UNLOCKED;
327
328         /* Can deadlock when called with interrupts disabled */
329         WARN_ON(irqs_disabled());
330         
331         data.func = func;
332         data.info = info;
333         data.wait = wait;
334         atomic_set(&data.unstarted_count, num_online_cpus() - 1);
335         atomic_set(&data.unfinished_count, num_online_cpus() - 1);
336
337         if (retry) {
338                 spin_lock (&lock);
339                 while (smp_call_function_data != 0)
340                         barrier();
341         }
342         else {
343                 spin_lock (&lock);
344                 if (smp_call_function_data) {
345                         spin_unlock (&lock);
346                         return -EBUSY;
347                 }
348         }
349
350         smp_call_function_data = &data;
351         spin_unlock (&lock);
352         
353         /*  Send a message to all other CPUs and wait for them to respond  */
354         send_IPI_allbutself(IPI_CALL_FUNC);
355
356         /*  Wait for response  */
357         timeout = jiffies + HZ;
358         while ( (atomic_read (&data.unstarted_count) > 0) &&
359                 time_before (jiffies, timeout) )
360                 barrier ();
361
362         /* We either got one or timed out. Release the lock */
363
364         mb();
365         smp_call_function_data = NULL;
366         if (atomic_read (&data.unstarted_count) > 0) {
367                 printk(KERN_CRIT "SMP CALL FUNCTION TIMED OUT! (cpu=%d)\n",
368                       smp_processor_id());
369                 return -ETIMEDOUT;
370         }
371
372         while (wait && atomic_read (&data.unfinished_count) > 0)
373                         barrier ();
374
375         return 0;
376 }
377
378 EXPORT_SYMBOL(smp_call_function);
379
380
381
382 /*
383  *      Setup routine for controlling SMP activation
384  *
385  *      Command-line option of "nosmp" or "maxcpus=0" will disable SMP
386  *      activation entirely (the MPS table probe still happens, though).
387  *
388  *      Command-line option of "maxcpus=<NUM>", where <NUM> is an integer
389  *      greater than 0, limits the maximum number of CPUs activated in
390  *      SMP mode to <NUM>.
391  */
392
393 static int __init nosmp(char *str)
394 {
395         parisc_max_cpus = 0;
396         return 1;
397 }
398
399 __setup("nosmp", nosmp);
400
401 static int __init maxcpus(char *str)
402 {
403         get_option(&str, &parisc_max_cpus);
404         return 1;
405 }
406
407 __setup("maxcpus=", maxcpus);
408
409 /*
410  * Flush all other CPU's tlb and then mine.  Do this with on_each_cpu()
411  * as we want to ensure all TLB's flushed before proceeding.
412  */
413
414 extern void flush_tlb_all_local(void);
415
416 void
417 smp_flush_tlb_all(void)
418 {
419         on_each_cpu((void (*)(void *))flush_tlb_all_local, NULL, 1, 1);
420 }
421
422
423 void 
424 smp_do_timer(struct pt_regs *regs)
425 {
426         int cpu = smp_processor_id();
427         struct cpuinfo_parisc *data = &cpu_data[cpu];
428
429         if (!--data->prof_counter) {
430                 data->prof_counter = data->prof_multiplier;
431                 update_process_times(user_mode(regs));
432         }
433 }
434
435 /*
436  * Called by secondaries to update state and initialize CPU registers.
437  */
438 static void __init
439 smp_cpu_init(int cpunum)
440 {
441         extern int init_per_cpu(int);  /* arch/parisc/kernel/setup.c */
442         extern void init_IRQ(void);    /* arch/parisc/kernel/irq.c */
443
444         /* Set modes and Enable floating point coprocessor */
445         (void) init_per_cpu(cpunum);
446
447         disable_sr_hashing();
448
449         mb();
450
451         /* Well, support 2.4 linux scheme as well. */
452         if (cpu_test_and_set(cpunum, cpu_online_map))
453         {
454                 extern void machine_halt(void); /* arch/parisc.../process.c */
455
456                 printk(KERN_CRIT "CPU#%d already initialized!\n", cpunum);
457                 machine_halt();
458         }  
459
460         /* Initialise the idle task for this CPU */
461         atomic_inc(&init_mm.mm_count);
462         current->active_mm = &init_mm;
463         if(current->mm)
464                 BUG();
465         enter_lazy_tlb(&init_mm, current);
466
467         init_IRQ();   /* make sure no IRQ's are enabled or pending */
468 }
469
470
471 /*
472  * Slaves start using C here. Indirectly called from smp_slave_stext.
473  * Do what start_kernel() and main() do for boot strap processor (aka monarch)
474  */
475 void __init smp_callin(void)
476 {
477         extern void cpu_idle(void);     /* arch/parisc/kernel/process.c */
478         int slave_id = cpu_now_booting;
479 #if 0
480         void *istack;
481 #endif
482
483         smp_cpu_init(slave_id);
484
485 #if 0   /* NOT WORKING YET - see entry.S */
486         istack = (void *)__get_free_pages(GFP_KERNEL,ISTACK_ORDER);
487         if (istack == NULL) {
488             printk(KERN_CRIT "Failed to allocate interrupt stack for cpu %d\n",slave_id);
489             BUG();
490         }
491         mtctl(istack,31);
492 #endif
493
494         flush_cache_all_local(); /* start with known state */
495         flush_tlb_all_local();
496
497         local_irq_enable();  /* Interrupts have been off until now */
498
499         cpu_idle();      /* Wait for timer to schedule some work */
500
501         /* NOTREACHED */
502         panic("smp_callin() AAAAaaaaahhhh....\n");
503 }
504
505 #if 0
506 /*
507  * Create the idle task for a new Slave CPU.  DO NOT use kernel_thread()
508  * because that could end up calling schedule(). If it did, the new idle
509  * task could get scheduled before we had a chance to remove it from the
510  * run-queue...
511  */
512 static struct task_struct *fork_by_hand(void)
513 {
514         struct pt_regs regs;  
515
516         /*
517          * don't care about the regs settings since
518          * we'll never reschedule the forked task.
519          */
520         return copy_process(CLONE_VM|CLONE_IDLETASK, 0, &regs, 0, NULL, NULL);
521 }
522
523
524 /*
525  * Bring one cpu online.
526  */
527 int __init smp_boot_one_cpu(int cpuid, int cpunum)
528 {
529         struct task_struct *idle;
530         long timeout;
531
532         /* 
533          * Create an idle task for this CPU.  Note the address wed* give 
534          * to kernel_thread is irrelevant -- it's going to start
535          * where OS_BOOT_RENDEVZ vector in SAL says to start.  But
536          * this gets all the other task-y sort of data structures set
537          * up like we wish.   We need to pull the just created idle task 
538          * off the run queue and stuff it into the init_tasks[] array.  
539          * Sheesh . . .
540          */
541
542         idle = fork_by_hand();
543         if (IS_ERR(idle))
544                 panic("SMP: fork failed for CPU:%d", cpuid);
545
546         wake_up_forked_process(idle);
547         init_idle(idle, cpunum);
548         unhash_process(idle);
549         idle->thread_info->cpu = cpunum;
550
551         /* Let _start know what logical CPU we're booting
552         ** (offset into init_tasks[],cpu_data[])
553         */
554         cpu_now_booting = cpunum;
555
556         /* 
557         ** boot strap code needs to know the task address since
558         ** it also contains the process stack.
559         */
560         smp_init_current_idle_task = idle ;
561         mb();
562
563         /*
564         ** This gets PDC to release the CPU from a very tight loop.
565         ** See MEM_RENDEZ comments in head.S.
566         */
567         __raw_writel(IRQ_OFFSET(TIMER_IRQ), cpu_data[cpunum].hpa);
568         mb();
569
570         /* 
571          * OK, wait a bit for that CPU to finish staggering about. 
572          * Slave will set a bit when it reaches smp_cpu_init().
573          * Once the "monarch CPU" sees the bit change, it can move on.
574          */
575         for (timeout = 0; timeout < 10000; timeout++) {
576                 if(cpu_online(cpunum)) {
577                         /* Which implies Slave has started up */
578                         cpu_now_booting = 0;
579                         smp_init_current_idle_task = NULL;
580                         goto alive ;
581                 }
582                 udelay(100);
583                 barrier();
584         }
585
586         put_task_struct(idle);
587         idle = NULL;
588
589         printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid);
590         return -1;
591
592 alive:
593         /* Remember the Slave data */
594 #if (kDEBUG>=100)
595         printk(KERN_DEBUG "SMP: CPU:%d (num %d) came alive after %ld _us\n",
596                 cpuid,  cpunum, timeout * 100);
597 #endif /* kDEBUG */
598 #ifdef ENTRY_SYS_CPUS
599         cpu_data[cpunum].state = STATE_RUNNING;
600 #endif
601         return 0;
602 }
603 #endif
604
605
606 void __devinit smp_prepare_boot_cpu(void)
607 {
608         int bootstrap_processor=cpu_data[0].cpuid;      /* CPU ID of BSP */
609
610 #ifdef ENTRY_SYS_CPUS
611         cpu_data[0].state = STATE_RUNNING;
612 #endif
613
614         /* Setup BSP mappings */
615         printk(KERN_DEBUG "SMP: bootstrap CPU ID is %d\n",bootstrap_processor);
616         init_task.thread_info->cpu = bootstrap_processor; 
617         current->thread_info->cpu = bootstrap_processor;
618
619         cpu_set(bootstrap_processor, cpu_online_map);
620         cpu_set(bootstrap_processor, cpu_possible_map);
621
622         /* Mark Boostrap processor as present */
623         current->active_mm = &init_mm;
624
625         cache_decay_ticks = HZ/100;     /* FIXME very rough.  */
626 }
627
628
629
630 /*
631 ** inventory.c:do_inventory() hasn't yet been run and thus we
632 ** don't 'discover' the additional CPU's until later.
633 */
634 void __init smp_prepare_cpus(unsigned int max_cpus)
635 {
636
637         if (max_cpus != -1) 
638                 printk(KERN_INFO "SMP: Limited to %d CPUs\n", max_cpus);
639
640         printk(KERN_INFO "SMP: Monarch CPU activated (%lu.%02lu BogoMIPS)\n",
641                (cpu_data[0].loops_per_jiffy + 25) / 5000,
642                ((cpu_data[0].loops_per_jiffy + 25) / 50) % 100);
643
644         return;
645 }
646
647
648 void smp_cpus_done(unsigned int cpu_max)
649 {
650         return;
651 }
652
653
654 int __devinit __cpu_up(unsigned int cpu)
655 {
656         return cpu_online(cpu) ? 0 : -ENOSYS;
657 }
658
659
660
661 #ifdef ENTRY_SYS_CPUS
662 /* Code goes along with:
663 **    entry.s:        ENTRY_NAME(sys_cpus)   / * 215, for cpu stat * /
664 */
665 int sys_cpus(int argc, char **argv)
666 {
667         int i,j=0;
668         extern int current_pid(int cpu);
669
670         if( argc > 2 ) {
671                 printk("sys_cpus:Only one argument supported\n");
672                 return (-1);
673         }
674         if ( argc == 1 ){
675         
676 #ifdef DUMP_MORE_STATE
677                 for(i=0; i<NR_CPUS; i++) {
678                         int cpus_per_line = 4;
679                         if(cpu_online(i)) {
680                                 if (j++ % cpus_per_line)
681                                         printk(" %3d",i);
682                                 else
683                                         printk("\n %3d",i);
684                         }
685                 }
686                 printk("\n"); 
687 #else
688                 printk("\n 0\n"); 
689 #endif
690         } else if((argc==2) && !(strcmp(argv[1],"-l"))) {
691                 printk("\nCPUSTATE  TASK CPUNUM CPUID HARDCPU(HPA)\n");
692 #ifdef DUMP_MORE_STATE
693                 for(i=0;i<NR_CPUS;i++) {
694                         if (!cpu_online(i))
695                                 continue;
696                         if (cpu_data[i].cpuid != NO_PROC_ID) {
697                                 switch(cpu_data[i].state) {
698                                         case STATE_RENDEZVOUS:
699                                                 printk("RENDEZVS ");
700                                                 break;
701                                         case STATE_RUNNING:
702                                                 printk((current_pid(i)!=0) ? "RUNNING  " : "IDLING   ");
703                                                 break;
704                                         case STATE_STOPPED:
705                                                 printk("STOPPED  ");
706                                                 break;
707                                         case STATE_HALTED:
708                                                 printk("HALTED   ");
709                                                 break;
710                                         default:
711                                                 printk("%08x?", cpu_data[i].state);
712                                                 break;
713                                 }
714                                 if(cpu_online(i)) {
715                                         printk(" %4d",current_pid(i));
716                                 }       
717                                 printk(" %6d",cpu_number_map(i));
718                                 printk(" %5d",i);
719                                 printk(" 0x%lx\n",cpu_data[i].hpa);
720                         }       
721                 }
722 #else
723                 printk("\n%s  %4d      0     0 --------",
724                         (current->pid)?"RUNNING ": "IDLING  ",current->pid); 
725 #endif
726         } else if ((argc==2) && !(strcmp(argv[1],"-s"))) { 
727 #ifdef DUMP_MORE_STATE
728                 printk("\nCPUSTATE   CPUID\n");
729                 for (i=0;i<NR_CPUS;i++) {
730                         if (!cpu_online(i))
731                                 continue;
732                         if (cpu_data[i].cpuid != NO_PROC_ID) {
733                                 switch(cpu_data[i].state) {
734                                         case STATE_RENDEZVOUS:
735                                                 printk("RENDEZVS");break;
736                                         case STATE_RUNNING:
737                                                 printk((current_pid(i)!=0) ? "RUNNING " : "IDLING");
738                                                 break;
739                                         case STATE_STOPPED:
740                                                 printk("STOPPED ");break;
741                                         case STATE_HALTED:
742                                                 printk("HALTED  ");break;
743                                         default:
744                                 }
745                                 printk("  %5d\n",i);
746                         }       
747                 }
748 #else
749                 printk("\n%s    CPU0",(current->pid==0)?"RUNNING ":"IDLING  "); 
750 #endif
751         } else {
752                 printk("sys_cpus:Unknown request\n");
753                 return (-1);
754         }
755         return 0;
756 }
757 #endif /* ENTRY_SYS_CPUS */
758
759 #ifdef CONFIG_PROC_FS
760 int __init
761 setup_profiling_timer(unsigned int multiplier)
762 {
763         return -EINVAL;
764 }
765 #endif