diff --git a/sys/rump/librump/rumpkern/rump.c b/sys/rump/librump/rumpkern/rump.c index 7a613f2eb509..fc24ed9ef942 100644 --- a/sys/rump/librump/rumpkern/rump.c +++ b/sys/rump/librump/rumpkern/rump.c @@ -1,4 +1,4 @@ -/* $NetBSD: rump.c,v 1.185 2010/09/06 20:10:20 pooka Exp $ */ +/* $NetBSD: rump.c,v 1.186 2010/09/07 07:59:48 pooka Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.185 2010/09/06 20:10:20 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.186 2010/09/07 07:59:48 pooka Exp $"); #include #define ELFSIZE ARCH_ELFSIZE @@ -313,7 +313,7 @@ rump__init(int rump_version) lwpinit_specificdata(); lwp_initspecific(&lwp0); - rump_scheduler_init(); + rump_scheduler_init(numcpu); /* revert temporary context and schedule a real context */ l->l_cpu = NULL; rumpuser_set_curlwp(NULL); @@ -329,9 +329,15 @@ rump__init(int rump_version) tc_setclock(&ts); /* we are mostly go. do per-cpu subsystem init */ - for (i = 0; i < ncpu; i++) { + for (i = 0; i < numcpu; i++) { struct cpu_info *ci = cpu_lookup(i); + /* attach non-bootstrap CPUs */ + if (i > 0) { + rump_cpu_attach(ci); + ncpu++; + } + callout_init_cpu(ci); softint_init(ci); xc_init_cpu(ci); diff --git a/sys/rump/librump/rumpkern/rump_private.h b/sys/rump/librump/rumpkern/rump_private.h index e992a159088d..befd0f33b876 100644 --- a/sys/rump/librump/rumpkern/rump_private.h +++ b/sys/rump/librump/rumpkern/rump_private.h @@ -1,4 +1,4 @@ -/* $NetBSD: rump_private.h,v 1.55 2010/09/01 19:37:58 pooka Exp $ */ +/* $NetBSD: rump_private.h,v 1.56 2010/09/07 07:59:48 pooka Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -111,7 +111,7 @@ int rump_sysproxy_copyin(const void *, void *, size_t); struct lwp * rump__lwproc_allockernlwp(void); void rump_cpus_bootstrap(int); -void rump_scheduler_init(void); +void rump_scheduler_init(int); void rump_schedule(void); void rump_unschedule(void); void rump_schedule_cpu(struct lwp *); diff --git a/sys/rump/librump/rumpkern/scheduler.c b/sys/rump/librump/rumpkern/scheduler.c index 965d6a3933e5..5d5a64ffb44c 100644 --- a/sys/rump/librump/rumpkern/scheduler.c +++ b/sys/rump/librump/rumpkern/scheduler.c @@ -1,4 +1,4 @@ -/* $NetBSD: scheduler.c,v 1.19 2010/09/01 19:37:59 pooka Exp $ */ +/* $NetBSD: scheduler.c,v 1.20 2010/09/07 07:59:48 pooka Exp $ */ /* * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.19 2010/09/01 19:37:59 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.20 2010/09/07 07:59:48 pooka Exp $"); #include #include @@ -136,13 +136,15 @@ rump_cpus_bootstrap(int num) rcpu = &rcpu_storage[i]; ci = &rump_cpus[i]; ci->ci_index = i; - rump_cpu_attach(ci); - ncpu++; } + + /* attach first cpu for bootstrap */ + rump_cpu_attach(&rump_cpus[0]); + ncpu = 1; } void -rump_scheduler_init() +rump_scheduler_init(int numcpu) { struct rumpcpu *rcpu; struct cpu_info *ci; @@ -150,7 +152,7 @@ rump_scheduler_init() rumpuser_mutex_init(&lwp0mtx); rumpuser_cv_init(&lwp0cv); - for (i = 0; i < ncpu; i++) { + for (i = 0; i < numcpu; i++) { rcpu = &rcpu_storage[i]; ci = &rump_cpus[i]; rcpu->rcpu_ci = ci;