Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump Add SMP support for all architectures.
details: https://anonhg.NetBSD.org/src/rev/343802a70e23
branches: trunk
changeset: 760421:343802a70e23
user: pooka <pooka%NetBSD.org@localhost>
date: Tue Jan 04 16:23:35 2011 +0000
description:
Add SMP support for all architectures.
tested on sparc64 by martin
diffstat:
sys/rump/include/machine/cpu.h | 13 +++++++++++--
sys/rump/librump/rumpkern/Makefile.rumpkern | 18 +++---------------
sys/rump/librump/rumpkern/rump.c | 11 ++---------
sys/rump/librump/rumpkern/rumpcpu_generic.c | 13 ++++++++++---
4 files changed, 26 insertions(+), 29 deletions(-)
diffs (152 lines):
diff -r bf1166a24fca -r 343802a70e23 sys/rump/include/machine/cpu.h
--- a/sys/rump/include/machine/cpu.h Tue Jan 04 14:22:06 2011 +0000
+++ b/sys/rump/include/machine/cpu.h Tue Jan 04 16:23:35 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.13 2010/12/02 21:20:39 pooka Exp $ */
+/* $NetBSD: cpu.h,v 1.14 2011/01/04 16:23:35 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -40,6 +40,8 @@
cpuid_t ci_cpuid;
struct lwp *ci_curlwp;
+ struct cpu_info *ci_next;
+
/*
* XXX: horrible workaround for vax lock.h.
* I eventually want to nuke rump include/machine, so don't waste
@@ -77,7 +79,14 @@
#define curlwp rumpuser_get_curlwp()
#define curcpu() (curlwp->l_cpu)
-#define cpu_number() 0 /* XXX: not good enuf */
+#define cpu_number() (cpu_index(curcpu))
+
+extern struct cpu_info *rumpcpu_info_list;
+#define CPU_INFO_ITERATOR int
+#define CPU_INFO_FOREACH(_cii_, _ci_) _cii_ = 0, _ci_ = rumpcpu_info_list; \
+ _ci_ != NULL; _ci_ = _ci_->ci_next
+#define CPU_IS_PRIMARY(_ci_) (_ci_->ci_index == 0)
+
#endif /* !_LOCORE */
diff -r bf1166a24fca -r 343802a70e23 sys/rump/librump/rumpkern/Makefile.rumpkern
--- a/sys/rump/librump/rumpkern/Makefile.rumpkern Tue Jan 04 14:22:06 2011 +0000
+++ b/sys/rump/librump/rumpkern/Makefile.rumpkern Tue Jan 04 16:23:35 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.rumpkern,v 1.104 2010/12/17 00:53:16 joerg Exp $
+# $NetBSD: Makefile.rumpkern,v 1.105 2011/01/04 16:23:36 pooka Exp $
#
.include "${RUMPTOP}/Makefile.rump"
@@ -25,12 +25,6 @@
SRCS+= locks.c
#SRCS+= locks_up.c
-# Does the arch support multiple processors?
-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
-RUMP_SMP= # defined
-CPPFLAGS.rump.c+= -DRUMP_SMP
-.endif
-
MKREPRO?=no
.if ${MKREPRO} == "yes"
@@ -180,20 +174,14 @@
# Some architectures require a little special massage with atomic
# compare-and-swap. This is because the kernel version is using
-# instructions or routines unavailable to us in userspace. We
-# use a very simple CAS routine which (correctly) assumes non-SMP
-# and no preemption. If some of these archs later develop MP
-# support, switch them to use atomic_cas_generic.c
+# instructions or routines unavailable to us in userspace.
#
.if ${MACHINE_CPU} == "arm" || ${MACHINE_CPU} == "hppa" \
|| ${MACHINE_CPU} == "mips" || ${MACHINE_CPU} == "sh3" \
|| ${MACHINE_CPU} == "vax" || ${MACHINE_ARCH} == "m68000"
CPPFLAGS+= -I${RUMPTOP}/../../common/lib/libc/atomic
-.ifdef RUMP_SMP
SRCS+= atomic_cas_generic.c
-.else
-SRCS+= rump_atomic_cas_up.c
-.endif
+#SRCS+= rump_atomic_cas_up.c
.endif
.include <bsd.lib.mk>
diff -r bf1166a24fca -r 343802a70e23 sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c Tue Jan 04 14:22:06 2011 +0000
+++ b/sys/rump/librump/rumpkern/rump.c Tue Jan 04 16:23:35 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump.c,v 1.214 2011/01/02 12:52:25 pooka Exp $ */
+/* $NetBSD: rump.c,v 1.215 2011/01/04 16:23:36 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.214 2011/01/02 12:52:25 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.215 2011/01/04 16:23:36 pooka Exp $");
#include <sys/systm.h>
#define ELFSIZE ARCH_ELFSIZE
@@ -255,8 +255,6 @@
if (rumpuser_getenv("RUMP_NCPU", buf, sizeof(buf), &error) == 0)
error = 0;
- /* non-x86 is missing CPU_INFO_FOREACH() support */
-#ifdef RUMP_SMP
if (error == 0) {
numcpu = strtoll(buf, NULL, 10);
if (numcpu < 1)
@@ -264,11 +262,6 @@
} else {
numcpu = rumpuser_getnhostcpu();
}
-#else
- if (error == 0)
- printf("NCPU limited to 1 on this machine architecture\n");
- numcpu = 1;
-#endif
rump_cpus_bootstrap(&numcpu);
rumpuser_gettime(&sec, &nsec, &error);
diff -r bf1166a24fca -r 343802a70e23 sys/rump/librump/rumpkern/rumpcpu_generic.c
--- a/sys/rump/librump/rumpkern/rumpcpu_generic.c Tue Jan 04 14:22:06 2011 +0000
+++ b/sys/rump/librump/rumpkern/rumpcpu_generic.c Tue Jan 04 16:23:35 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpcpu_generic.c,v 1.2 2010/04/27 23:30:30 pooka Exp $ */
+/* $NetBSD: rumpcpu_generic.c,v 1.3 2011/01/04 16:23:36 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -29,15 +29,22 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpcpu_generic.c,v 1.2 2010/04/27 23:30:30 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpcpu_generic.c,v 1.3 2011/01/04 16:23:36 pooka Exp $");
#include <sys/param.h>
#include "rump_private.h"
+struct cpu_info *rumpcpu_info_list;
+
void
rump_cpu_attach(struct cpu_info *ci)
{
+ static int nattached;
- /* nada */
+ /* XXX: wrong order, but ... */
+ ci->ci_next = rumpcpu_info_list;
+ rumpcpu_info_list = ci;
+
+ ci->ci_index = nattached++;
}
Home |
Main Index |
Thread Index |
Old Index