smp.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  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. #include <linux/config.h>
  21. #include <linux/types.h>
  22. #include <linux/spinlock.h>
  23. #include <linux/slab.h>
  24. #include <linux/kernel.h>
  25. #include <linux/module.h>
  26. #include <linux/sched.h>
  27. #include <linux/init.h>
  28. #include <linux/interrupt.h>
  29. #include <linux/smp.h>
  30. #include <linux/kernel_stat.h>
  31. #include <linux/mm.h>
  32. #include <linux/delay.h>
  33. #include <linux/bitops.h>
  34. #include <asm/system.h>
  35. #include <asm/atomic.h>
  36. #include <asm/current.h>
  37. #include <asm/delay.h>
  38. #include <asm/tlbflush.h>
  39. #include <asm/io.h>
  40. #include <asm/irq.h> /* for CPU_IRQ_REGION and friends */
  41. #include <asm/mmu_context.h>
  42. #include <asm/page.h>
  43. #include <asm/pgtable.h>
  44. #include <asm/pgalloc.h>
  45. #include <asm/processor.h>
  46. #include <asm/ptrace.h>
  47. #include <asm/unistd.h>
  48. #include <asm/cacheflush.h>
  49. #define kDEBUG 0
  50. DEFINE_SPINLOCK(smp_lock);
  51. volatile struct task_struct *smp_init_current_idle_task;
  52. static volatile int cpu_now_booting __read_mostly = 0; /* track which CPU is booting */
  53. static int parisc_max_cpus __read_mostly = 1;
  54. /* online cpus are ones that we've managed to bring up completely
  55. * possible cpus are all valid cpu
  56. * present cpus are all detected cpu
  57. *
  58. * On startup we bring up the "possible" cpus. Since we discover
  59. * CPUs later, we add them as hotplug, so the possible cpu mask is
  60. * empty in the beginning.
  61. */
  62. cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE; /* Bitmap of online CPUs */
  63. cpumask_t cpu_possible_map __read_mostly = CPU_MASK_ALL; /* Bitmap of Present CPUs */
  64. EXPORT_SYMBOL(cpu_online_map);
  65. EXPORT_SYMBOL(cpu_possible_map);
  66. struct smp_call_struct {
  67. void (*func) (void *info);
  68. void *info;
  69. long wait;
  70. atomic_t unstarted_count;
  71. atomic_t unfinished_count;
  72. };
  73. static volatile struct smp_call_struct *smp_call_function_data;
  74. enum ipi_message_type {
  75. IPI_NOP=0,
  76. IPI_RESCHEDULE=1,
  77. IPI_CALL_FUNC,
  78. IPI_CPU_START,
  79. IPI_CPU_STOP,
  80. IPI_CPU_TEST
  81. };
  82. /********** SMP inter processor interrupt and communication routines */
  83. #undef PER_CPU_IRQ_REGION
  84. #ifdef PER_CPU_IRQ_REGION
  85. /* XXX REVISIT Ignore for now.
  86. ** *May* need this "hook" to register IPI handler
  87. ** once we have perCPU ExtIntr switch tables.
  88. */
  89. static void
  90. ipi_init(int cpuid)
  91. {
  92. /* If CPU is present ... */
  93. #ifdef ENTRY_SYS_CPUS
  94. /* *and* running (not stopped) ... */
  95. #error iCOD support wants state checked here.
  96. #endif
  97. #error verify IRQ_OFFSET(IPI_IRQ) is ipi_interrupt() in new IRQ region
  98. if(cpu_online(cpuid) )
  99. {
  100. switch_to_idle_task(current);
  101. }
  102. return;
  103. }
  104. #endif
  105. /*
  106. ** Yoink this CPU from the runnable list...
  107. **
  108. */
  109. static void
  110. halt_processor(void)
  111. {
  112. #ifdef ENTRY_SYS_CPUS
  113. #error halt_processor() needs rework
  114. /*
  115. ** o migrate I/O interrupts off this CPU.
  116. ** o leave IPI enabled - __cli() will disable IPI.
  117. ** o leave CPU in online map - just change the state
  118. */
  119. cpu_data[this_cpu].state = STATE_STOPPED;
  120. mark_bh(IPI_BH);
  121. #else
  122. /* REVISIT : redirect I/O Interrupts to another CPU? */
  123. /* REVISIT : does PM *know* this CPU isn't available? */
  124. cpu_clear(smp_processor_id(), cpu_online_map);
  125. local_irq_disable();
  126. for (;;)
  127. ;
  128. #endif
  129. }
  130. irqreturn_t
  131. ipi_interrupt(int irq, void *dev_id, struct pt_regs *regs)
  132. {
  133. int this_cpu = smp_processor_id();
  134. struct cpuinfo_parisc *p = &cpu_data[this_cpu];
  135. unsigned long ops;
  136. unsigned long flags;
  137. /* Count this now; we may make a call that never returns. */
  138. p->ipi_count++;
  139. mb(); /* Order interrupt and bit testing. */
  140. for (;;) {
  141. spin_lock_irqsave(&(p->lock),flags);
  142. ops = p->pending_ipi;
  143. p->pending_ipi = 0;
  144. spin_unlock_irqrestore(&(p->lock),flags);
  145. mb(); /* Order bit clearing and data access. */
  146. if (!ops)
  147. break;
  148. while (ops) {
  149. unsigned long which = ffz(~ops);
  150. ops &= ~(1 << which);
  151. switch (which) {
  152. case IPI_NOP:
  153. #if (kDEBUG>=100)
  154. printk(KERN_DEBUG "CPU%d IPI_NOP\n",this_cpu);
  155. #endif /* kDEBUG */
  156. break;
  157. case IPI_RESCHEDULE:
  158. #if (kDEBUG>=100)
  159. printk(KERN_DEBUG "CPU%d IPI_RESCHEDULE\n",this_cpu);
  160. #endif /* kDEBUG */
  161. /*
  162. * Reschedule callback. Everything to be
  163. * done is done by the interrupt return path.
  164. */
  165. break;
  166. case IPI_CALL_FUNC:
  167. #if (kDEBUG>=100)
  168. printk(KERN_DEBUG "CPU%d IPI_CALL_FUNC\n",this_cpu);
  169. #endif /* kDEBUG */
  170. {
  171. volatile struct smp_call_struct *data;
  172. void (*func)(void *info);
  173. void *info;
  174. int wait;
  175. data = smp_call_function_data;
  176. func = data->func;
  177. info = data->info;
  178. wait = data->wait;
  179. mb();
  180. atomic_dec ((atomic_t *)&data->unstarted_count);
  181. /* At this point, *data can't
  182. * be relied upon.
  183. */
  184. (*func)(info);
  185. /* Notify the sending CPU that the
  186. * task is done.
  187. */
  188. mb();
  189. if (wait)
  190. atomic_dec ((atomic_t *)&data->unfinished_count);
  191. }
  192. break;
  193. case IPI_CPU_START:
  194. #if (kDEBUG>=100)
  195. printk(KERN_DEBUG "CPU%d IPI_CPU_START\n",this_cpu);
  196. #endif /* kDEBUG */
  197. #ifdef ENTRY_SYS_CPUS
  198. p->state = STATE_RUNNING;
  199. #endif
  200. break;
  201. case IPI_CPU_STOP:
  202. #if (kDEBUG>=100)
  203. printk(KERN_DEBUG "CPU%d IPI_CPU_STOP\n",this_cpu);
  204. #endif /* kDEBUG */
  205. #ifdef ENTRY_SYS_CPUS
  206. #else
  207. halt_processor();
  208. #endif
  209. break;
  210. case IPI_CPU_TEST:
  211. #if (kDEBUG>=100)
  212. printk(KERN_DEBUG "CPU%d is alive!\n",this_cpu);
  213. #endif /* kDEBUG */
  214. break;
  215. default:
  216. printk(KERN_CRIT "Unknown IPI num on CPU%d: %lu\n",
  217. this_cpu, which);
  218. return IRQ_NONE;
  219. } /* Switch */
  220. } /* while (ops) */
  221. }
  222. return IRQ_HANDLED;
  223. }
  224. static inline void
  225. ipi_send(int cpu, enum ipi_message_type op)
  226. {
  227. struct cpuinfo_parisc *p = &cpu_data[cpu];
  228. unsigned long flags;
  229. spin_lock_irqsave(&(p->lock),flags);
  230. p->pending_ipi |= 1 << op;
  231. gsc_writel(IPI_IRQ - CPU_IRQ_BASE, cpu_data[cpu].hpa);
  232. spin_unlock_irqrestore(&(p->lock),flags);
  233. }
  234. static inline void
  235. send_IPI_single(int dest_cpu, enum ipi_message_type op)
  236. {
  237. if (dest_cpu == NO_PROC_ID) {
  238. BUG();
  239. return;
  240. }
  241. ipi_send(dest_cpu, op);
  242. }
  243. static inline void
  244. send_IPI_allbutself(enum ipi_message_type op)
  245. {
  246. int i;
  247. for (i = 0; i < NR_CPUS; i++) {
  248. if (cpu_online(i) && i != smp_processor_id())
  249. send_IPI_single(i, op);
  250. }
  251. }
  252. inline void
  253. smp_send_stop(void) { send_IPI_allbutself(IPI_CPU_STOP); }
  254. static inline void
  255. smp_send_start(void) { send_IPI_allbutself(IPI_CPU_START); }
  256. void
  257. smp_send_reschedule(int cpu) { send_IPI_single(cpu, IPI_RESCHEDULE); }
  258. void
  259. smp_send_all_nop(void)
  260. {
  261. send_IPI_allbutself(IPI_NOP);
  262. }
  263. /**
  264. * Run a function on all other CPUs.
  265. * <func> The function to run. This must be fast and non-blocking.
  266. * <info> An arbitrary pointer to pass to the function.
  267. * <retry> If true, keep retrying until ready.
  268. * <wait> If true, wait until function has completed on other CPUs.
  269. * [RETURNS] 0 on success, else a negative status code.
  270. *
  271. * Does not return until remote CPUs are nearly ready to execute <func>
  272. * or have executed.
  273. */
  274. int
  275. smp_call_function (void (*func) (void *info), void *info, int retry, int wait)
  276. {
  277. struct smp_call_struct data;
  278. unsigned long timeout;
  279. static DEFINE_SPINLOCK(lock);
  280. int retries = 0;
  281. if (num_online_cpus() < 2)
  282. return 0;
  283. /* Can deadlock when called with interrupts disabled */
  284. WARN_ON(irqs_disabled());
  285. /* can also deadlock if IPIs are disabled */
  286. WARN_ON((get_eiem() & (1UL<<(CPU_IRQ_MAX - IPI_IRQ))) == 0);
  287. data.func = func;
  288. data.info = info;
  289. data.wait = wait;
  290. atomic_set(&data.unstarted_count, num_online_cpus() - 1);
  291. atomic_set(&data.unfinished_count, num_online_cpus() - 1);
  292. if (retry) {
  293. spin_lock (&lock);
  294. while (smp_call_function_data != 0)
  295. barrier();
  296. }
  297. else {
  298. spin_lock (&lock);
  299. if (smp_call_function_data) {
  300. spin_unlock (&lock);
  301. return -EBUSY;
  302. }
  303. }
  304. smp_call_function_data = &data;
  305. spin_unlock (&lock);
  306. /* Send a message to all other CPUs and wait for them to respond */
  307. send_IPI_allbutself(IPI_CALL_FUNC);
  308. retry:
  309. /* Wait for response */
  310. timeout = jiffies + HZ;
  311. while ( (atomic_read (&data.unstarted_count) > 0) &&
  312. time_before (jiffies, timeout) )
  313. barrier ();
  314. if (atomic_read (&data.unstarted_count) > 0) {
  315. printk(KERN_CRIT "SMP CALL FUNCTION TIMED OUT! (cpu=%d), try %d\n",
  316. smp_processor_id(), ++retries);
  317. goto retry;
  318. }
  319. /* We either got one or timed out. Release the lock */
  320. mb();
  321. smp_call_function_data = NULL;
  322. while (wait && atomic_read (&data.unfinished_count) > 0)
  323. barrier ();
  324. return 0;
  325. }
  326. EXPORT_SYMBOL(smp_call_function);
  327. /*
  328. * Flush all other CPU's tlb and then mine. Do this with on_each_cpu()
  329. * as we want to ensure all TLB's flushed before proceeding.
  330. */
  331. void
  332. smp_flush_tlb_all(void)
  333. {
  334. on_each_cpu(flush_tlb_all_local, NULL, 1, 1);
  335. }
  336. void
  337. smp_do_timer(struct pt_regs *regs)
  338. {
  339. int cpu = smp_processor_id();
  340. struct cpuinfo_parisc *data = &cpu_data[cpu];
  341. if (!--data->prof_counter) {
  342. data->prof_counter = data->prof_multiplier;
  343. update_process_times(user_mode(regs));
  344. }
  345. }
  346. /*
  347. * Called by secondaries to update state and initialize CPU registers.
  348. */
  349. static void __init
  350. smp_cpu_init(int cpunum)
  351. {
  352. extern int init_per_cpu(int); /* arch/parisc/kernel/setup.c */
  353. extern void init_IRQ(void); /* arch/parisc/kernel/irq.c */
  354. /* Set modes and Enable floating point coprocessor */
  355. (void) init_per_cpu(cpunum);
  356. disable_sr_hashing();
  357. mb();
  358. /* Well, support 2.4 linux scheme as well. */
  359. if (cpu_test_and_set(cpunum, cpu_online_map))
  360. {
  361. extern void machine_halt(void); /* arch/parisc.../process.c */
  362. printk(KERN_CRIT "CPU#%d already initialized!\n", cpunum);
  363. machine_halt();
  364. }
  365. /* Initialise the idle task for this CPU */
  366. atomic_inc(&init_mm.mm_count);
  367. current->active_mm = &init_mm;
  368. if(current->mm)
  369. BUG();
  370. enter_lazy_tlb(&init_mm, current);
  371. init_IRQ(); /* make sure no IRQ's are enabled or pending */
  372. }
  373. /*
  374. * Slaves start using C here. Indirectly called from smp_slave_stext.
  375. * Do what start_kernel() and main() do for boot strap processor (aka monarch)
  376. */
  377. void __init smp_callin(void)
  378. {
  379. int slave_id = cpu_now_booting;
  380. #if 0
  381. void *istack;
  382. #endif
  383. smp_cpu_init(slave_id);
  384. preempt_disable();
  385. #if 0 /* NOT WORKING YET - see entry.S */
  386. istack = (void *)__get_free_pages(GFP_KERNEL,ISTACK_ORDER);
  387. if (istack == NULL) {
  388. printk(KERN_CRIT "Failed to allocate interrupt stack for cpu %d\n",slave_id);
  389. BUG();
  390. }
  391. mtctl(istack,31);
  392. #endif
  393. flush_cache_all_local(); /* start with known state */
  394. flush_tlb_all_local(NULL);
  395. local_irq_enable(); /* Interrupts have been off until now */
  396. cpu_idle(); /* Wait for timer to schedule some work */
  397. /* NOTREACHED */
  398. panic("smp_callin() AAAAaaaaahhhh....\n");
  399. }
  400. /*
  401. * Bring one cpu online.
  402. */
  403. int __init smp_boot_one_cpu(int cpuid)
  404. {
  405. struct task_struct *idle;
  406. long timeout;
  407. /*
  408. * Create an idle task for this CPU. Note the address wed* give
  409. * to kernel_thread is irrelevant -- it's going to start
  410. * where OS_BOOT_RENDEVZ vector in SAL says to start. But
  411. * this gets all the other task-y sort of data structures set
  412. * up like we wish. We need to pull the just created idle task
  413. * off the run queue and stuff it into the init_tasks[] array.
  414. * Sheesh . . .
  415. */
  416. idle = fork_idle(cpuid);
  417. if (IS_ERR(idle))
  418. panic("SMP: fork failed for CPU:%d", cpuid);
  419. task_thread_info(idle)->cpu = cpuid;
  420. /* Let _start know what logical CPU we're booting
  421. ** (offset into init_tasks[],cpu_data[])
  422. */
  423. cpu_now_booting = cpuid;
  424. /*
  425. ** boot strap code needs to know the task address since
  426. ** it also contains the process stack.
  427. */
  428. smp_init_current_idle_task = idle ;
  429. mb();
  430. printk("Releasing cpu %d now, hpa=%lx\n", cpuid, cpu_data[cpuid].hpa);
  431. /*
  432. ** This gets PDC to release the CPU from a very tight loop.
  433. **
  434. ** From the PA-RISC 2.0 Firmware Architecture Reference Specification:
  435. ** "The MEM_RENDEZ vector specifies the location of OS_RENDEZ which
  436. ** is executed after receiving the rendezvous signal (an interrupt to
  437. ** EIR{0}). MEM_RENDEZ is valid only when it is nonzero and the
  438. ** contents of memory are valid."
  439. */
  440. gsc_writel(TIMER_IRQ - CPU_IRQ_BASE, cpu_data[cpuid].hpa);
  441. mb();
  442. /*
  443. * OK, wait a bit for that CPU to finish staggering about.
  444. * Slave will set a bit when it reaches smp_cpu_init().
  445. * Once the "monarch CPU" sees the bit change, it can move on.
  446. */
  447. for (timeout = 0; timeout < 10000; timeout++) {
  448. if(cpu_online(cpuid)) {
  449. /* Which implies Slave has started up */
  450. cpu_now_booting = 0;
  451. smp_init_current_idle_task = NULL;
  452. goto alive ;
  453. }
  454. udelay(100);
  455. barrier();
  456. }
  457. put_task_struct(idle);
  458. idle = NULL;
  459. printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid);
  460. return -1;
  461. alive:
  462. /* Remember the Slave data */
  463. #if (kDEBUG>=100)
  464. printk(KERN_DEBUG "SMP: CPU:%d came alive after %ld _us\n",
  465. cpuid, timeout * 100);
  466. #endif /* kDEBUG */
  467. #ifdef ENTRY_SYS_CPUS
  468. cpu_data[cpuid].state = STATE_RUNNING;
  469. #endif
  470. return 0;
  471. }
  472. void __devinit smp_prepare_boot_cpu(void)
  473. {
  474. int bootstrap_processor=cpu_data[0].cpuid; /* CPU ID of BSP */
  475. #ifdef ENTRY_SYS_CPUS
  476. cpu_data[0].state = STATE_RUNNING;
  477. #endif
  478. /* Setup BSP mappings */
  479. printk("SMP: bootstrap CPU ID is %d\n",bootstrap_processor);
  480. cpu_set(bootstrap_processor, cpu_online_map);
  481. cpu_set(bootstrap_processor, cpu_present_map);
  482. }
  483. /*
  484. ** inventory.c:do_inventory() hasn't yet been run and thus we
  485. ** don't 'discover' the additional CPU's until later.
  486. */
  487. void __init smp_prepare_cpus(unsigned int max_cpus)
  488. {
  489. cpus_clear(cpu_present_map);
  490. cpu_set(0, cpu_present_map);
  491. parisc_max_cpus = max_cpus;
  492. if (!max_cpus)
  493. printk(KERN_INFO "SMP mode deactivated.\n");
  494. }
  495. void smp_cpus_done(unsigned int cpu_max)
  496. {
  497. return;
  498. }
  499. int __devinit __cpu_up(unsigned int cpu)
  500. {
  501. if (cpu != 0 && cpu < parisc_max_cpus)
  502. smp_boot_one_cpu(cpu);
  503. return cpu_online(cpu) ? 0 : -ENOSYS;
  504. }
  505. #ifdef ENTRY_SYS_CPUS
  506. /* Code goes along with:
  507. ** entry.s: ENTRY_NAME(sys_cpus) / * 215, for cpu stat * /
  508. */
  509. int sys_cpus(int argc, char **argv)
  510. {
  511. int i,j=0;
  512. extern int current_pid(int cpu);
  513. if( argc > 2 ) {
  514. printk("sys_cpus:Only one argument supported\n");
  515. return (-1);
  516. }
  517. if ( argc == 1 ){
  518. #ifdef DUMP_MORE_STATE
  519. for(i=0; i<NR_CPUS; i++) {
  520. int cpus_per_line = 4;
  521. if(cpu_online(i)) {
  522. if (j++ % cpus_per_line)
  523. printk(" %3d",i);
  524. else
  525. printk("\n %3d",i);
  526. }
  527. }
  528. printk("\n");
  529. #else
  530. printk("\n 0\n");
  531. #endif
  532. } else if((argc==2) && !(strcmp(argv[1],"-l"))) {
  533. printk("\nCPUSTATE TASK CPUNUM CPUID HARDCPU(HPA)\n");
  534. #ifdef DUMP_MORE_STATE
  535. for(i=0;i<NR_CPUS;i++) {
  536. if (!cpu_online(i))
  537. continue;
  538. if (cpu_data[i].cpuid != NO_PROC_ID) {
  539. switch(cpu_data[i].state) {
  540. case STATE_RENDEZVOUS:
  541. printk("RENDEZVS ");
  542. break;
  543. case STATE_RUNNING:
  544. printk((current_pid(i)!=0) ? "RUNNING " : "IDLING ");
  545. break;
  546. case STATE_STOPPED:
  547. printk("STOPPED ");
  548. break;
  549. case STATE_HALTED:
  550. printk("HALTED ");
  551. break;
  552. default:
  553. printk("%08x?", cpu_data[i].state);
  554. break;
  555. }
  556. if(cpu_online(i)) {
  557. printk(" %4d",current_pid(i));
  558. }
  559. printk(" %6d",cpu_number_map(i));
  560. printk(" %5d",i);
  561. printk(" 0x%lx\n",cpu_data[i].hpa);
  562. }
  563. }
  564. #else
  565. printk("\n%s %4d 0 0 --------",
  566. (current->pid)?"RUNNING ": "IDLING ",current->pid);
  567. #endif
  568. } else if ((argc==2) && !(strcmp(argv[1],"-s"))) {
  569. #ifdef DUMP_MORE_STATE
  570. printk("\nCPUSTATE CPUID\n");
  571. for (i=0;i<NR_CPUS;i++) {
  572. if (!cpu_online(i))
  573. continue;
  574. if (cpu_data[i].cpuid != NO_PROC_ID) {
  575. switch(cpu_data[i].state) {
  576. case STATE_RENDEZVOUS:
  577. printk("RENDEZVS");break;
  578. case STATE_RUNNING:
  579. printk((current_pid(i)!=0) ? "RUNNING " : "IDLING");
  580. break;
  581. case STATE_STOPPED:
  582. printk("STOPPED ");break;
  583. case STATE_HALTED:
  584. printk("HALTED ");break;
  585. default:
  586. }
  587. printk(" %5d\n",i);
  588. }
  589. }
  590. #else
  591. printk("\n%s CPU0",(current->pid==0)?"RUNNING ":"IDLING ");
  592. #endif
  593. } else {
  594. printk("sys_cpus:Unknown request\n");
  595. return (-1);
  596. }
  597. return 0;
  598. }
  599. #endif /* ENTRY_SYS_CPUS */
  600. #ifdef CONFIG_PROC_FS
  601. int __init
  602. setup_profiling_timer(unsigned int multiplier)
  603. {
  604. return -EINVAL;
  605. }
  606. #endif