#include "linux/threads.h"
#include "linux/interrupt.h"
#include "linux/err.h"
+#include "linux/hardirq.h"
#include "asm/smp.h"
#include "asm/processor.h"
#include "asm/spinlock.h"
-#include "asm/hardirq.h"
#include "user_util.h"
#include "kern_util.h"
#include "kern.h"
#include "os.h"
/* CPU online map, set by smp_boot_cpus */
-unsigned long cpu_online_map = CPU_MASK_NONE;
+cpumask_t cpu_online_map = CPU_MASK_NONE;
+cpumask_t cpu_possible_map = CPU_MASK_NONE;
EXPORT_SYMBOL(cpu_online_map);
+EXPORT_SYMBOL(cpu_possible_map);
/* Per CPU bogomips and other parameters
* The only piece used here is the ipi pipe, which is set before SMP is
*/
struct cpuinfo_um cpu_data[NR_CPUS];
-/* Set when the idlers are all forked */
-int smp_threads_ready = 0;
-
/* A statistic, can be a little off */
int num_reschedules_sent = 0;
-/* Small, random number, never changed */
-unsigned long cache_decay_ticks = 5;
-
/* Not changed after boot */
struct task_struct *idle_threads[NR_CPUS];
current->thread.request.u.thread.proc = idle_proc;
current->thread.request.u.thread.arg = (void *) cpu;
- new_task = copy_process(CLONE_VM | CLONE_IDLETASK, 0, NULL, 0, NULL,
- NULL);
- if(IS_ERR(new_task))
+ new_task = fork_idle(cpu);
+ if(IS_ERR(new_task))
panic("copy_process failed in idle_thread, error = %ld",
PTR_ERR(new_task));
{ .pid = new_task->thread.mode.tt.extern_pid,
.task = new_task } );
idle_threads[cpu] = new_task;
- CHOOSE_MODE(os_write_file(new_task->thread.mode.tt.switch_pipe[1], &c,
- sizeof(c)),
- wake_up_forked_process(new_task);
+ CHOOSE_MODE(os_write_file(new_task->thread.mode.tt.switch_pipe[1], &c,
+ sizeof(c)),
+ ({ panic("skas mode doesn't support SMP"); }));
return(new_task);
}
struct task_struct *idle;
unsigned long waittime;
int err, cpu, me = smp_processor_id();
+ int i;
+
+ for (i = 0; i < ncpus; ++i)
+ cpu_set(i, cpu_possible_map);
cpu_clear(me, cpu_online_map);
cpu_set(me, cpu_online_map);
if(err < 0)
panic("CPU#0 failed to create IPI pipe, errno = %d", -err);
- activate_ipi(cpu_data[me].ipi_pipe[0],
+ activate_ipi(cpu_data[me].ipi_pipe[0],
current->thread.mode.tt.extern_pid);
for(cpu = 1; cpu < ncpus; cpu++){
return(pid_to_processor_id(os_getpid()));
}
-static spinlock_t call_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(call_lock);
static atomic_t scf_started;
static atomic_t scf_finished;
static void (*func)(void *info);
func = _func;
info = _info;
- for (i=0;i<NR_CPUS;i++)
- if((i != current_thread->cpu) &&
- cpu_isset(i, cpu_online_map))
- os_write_file(cpu_data[i].ipi_pipe[1], "C", 1);
+ for_each_online_cpu(i)
+ os_write_file(cpu_data[i].ipi_pipe[1], "C", 1);
while (atomic_read(&scf_started) != cpus)
barrier();