Module Name: src Committed By: martin Date: Tue Feb 19 09:04:55 UTC 2013
Modified Files: src/sys/rump/librump/rumpkern: emul.c rump.c rump_private.h src/sys/rump/librump/rumpkern/arch/i386: rumpcpu.c src/sys/sys: xcall.h Log Message: Stopgap fix to make rump cooperate with pserialize, may be revisited later. Patch from pooka, ok: rmind. No related regressions in a complete atf test run (which works again with this, even on non x86 SMP machines). To generate a diff of this commit: cvs rdiff -u -r1.152 -r1.153 src/sys/rump/librump/rumpkern/emul.c cvs rdiff -u -r1.250 -r1.251 src/sys/rump/librump/rumpkern/rump.c cvs rdiff -u -r1.72 -r1.73 src/sys/rump/librump/rumpkern/rump_private.h cvs rdiff -u -r1.9 -r1.10 src/sys/rump/librump/rumpkern/arch/i386/rumpcpu.c cvs rdiff -u -r1.4 -r1.5 src/sys/sys/xcall.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/rump/librump/rumpkern/emul.c diff -u src/sys/rump/librump/rumpkern/emul.c:1.152 src/sys/rump/librump/rumpkern/emul.c:1.153 --- src/sys/rump/librump/rumpkern/emul.c:1.152 Sun Jan 20 17:09:47 2013 +++ src/sys/rump/librump/rumpkern/emul.c Tue Feb 19 09:04:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: emul.c,v 1.152 2013/01/20 17:09:47 rmind Exp $ */ +/* $NetBSD: emul.c,v 1.153 2013/02/19 09:04:54 martin Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.152 2013/01/20 17:09:47 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.153 2013/02/19 09:04:54 martin Exp $"); #include <sys/param.h> #include <sys/null.h> @@ -281,37 +281,6 @@ syscall_intern(struct proc *p) } #endif -void -xc_send_ipi(struct cpu_info *ci) -{ - const struct cpu_info *curci = curcpu(); - CPU_INFO_ITERATOR cii; - - /* - * IPI are considered asynchronous, therefore no need to wait for - * unicast call delivery (nor the order of calls matters). Our LWP - * needs to be bound to the CPU, since xc_unicast(9) may block. - * - * WARNING: These must be low-priority calls, as this routine is - * used to emulate high-priority (XC_HIGHPRI) mechanism. - */ - - if (ci) { - KASSERT(curci != ci); - (void)xc_unicast(0, (xcfunc_t)xc_ipi_handler, NULL, NULL, ci); - return; - } - - curlwp->l_pflag |= LP_BOUND; - for (CPU_INFO_FOREACH(cii, ci)) { - if (curci == ci) { - continue; - } - (void)xc_unicast(0, (xcfunc_t)xc_ipi_handler, NULL, NULL, ci); - } - curlwp->l_pflag &= ~LP_BOUND; -} - int trace_enter(register_t code, const register_t *args, int narg) { Index: src/sys/rump/librump/rumpkern/rump.c diff -u src/sys/rump/librump/rumpkern/rump.c:1.250 src/sys/rump/librump/rumpkern/rump.c:1.251 --- src/sys/rump/librump/rumpkern/rump.c:1.250 Mon Jan 14 16:52:35 2013 +++ src/sys/rump/librump/rumpkern/rump.c Tue Feb 19 09:04:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rump.c,v 1.250 2013/01/14 16:52:35 pooka Exp $ */ +/* $NetBSD: rump.c,v 1.251 2013/02/19 09:04:54 martin Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.250 2013/01/14 16:52:35 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.251 2013/02/19 09:04:54 martin Exp $"); #include <sys/systm.h> #define ELFSIZE ARCH_ELFSIZE @@ -892,3 +892,23 @@ rump_allbetsareoff_setid(pid_t pid, int l->l_lid = lid; p->p_pid = pid; } + +#include <sys/pserialize.h> + +static void +ipiemu(void *a1, void *a2) +{ + + xc__highpri_intr(NULL); + pserialize_switchpoint(); +} + +void +rump_xc_highpri(struct cpu_info *ci) +{ + + if (ci) + xc_unicast(0, ipiemu, NULL, NULL, ci); + else + xc_broadcast(0, ipiemu, NULL, NULL); +} Index: src/sys/rump/librump/rumpkern/rump_private.h diff -u src/sys/rump/librump/rumpkern/rump_private.h:1.72 src/sys/rump/librump/rumpkern/rump_private.h:1.73 --- src/sys/rump/librump/rumpkern/rump_private.h:1.72 Mon Jan 14 16:45:47 2013 +++ src/sys/rump/librump/rumpkern/rump_private.h Tue Feb 19 09:04:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rump_private.h,v 1.72 2013/01/14 16:45:47 pooka Exp $ */ +/* $NetBSD: rump_private.h,v 1.73 2013/02/19 09:04:54 martin Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -139,4 +139,6 @@ void rump_softint_run(struct cpu_info *) void *rump_hypermalloc(size_t, int, bool, const char *); void rump_hyperfree(void *, size_t); +void rump_xc_highpri(struct cpu_info *); + #endif /* _SYS_RUMP_PRIVATE_H_ */ Index: src/sys/rump/librump/rumpkern/arch/i386/rumpcpu.c diff -u src/sys/rump/librump/rumpkern/arch/i386/rumpcpu.c:1.9 src/sys/rump/librump/rumpkern/arch/i386/rumpcpu.c:1.10 --- src/sys/rump/librump/rumpkern/arch/i386/rumpcpu.c:1.9 Wed Apr 28 00:34:25 2010 +++ src/sys/rump/librump/rumpkern/arch/i386/rumpcpu.c Tue Feb 19 09:04:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rumpcpu.c,v 1.9 2010/04/28 00:34:25 pooka Exp $ */ +/* $NetBSD: rumpcpu.c,v 1.10 2013/02/19 09:04:54 martin Exp $ */ /* * Copyright (c) 2008 Antti Kantee. All Rights Reserved. @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rumpcpu.c,v 1.9 2010/04/28 00:34:25 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rumpcpu.c,v 1.10 2013/02/19 09:04:54 martin Exp $"); #include <sys/param.h> @@ -49,6 +49,9 @@ rump_cpu_attach(struct cpu_info *ci) /* XXX: wrong order, but ... */ ci->ci_next = cpu_info_list; cpu_info_list = ci; + + kcpuset_set(kcpuset_attached, cpu_index(ci)); + kcpuset_set(kcpuset_running, cpu_index(ci)); } struct cpu_info * Index: src/sys/sys/xcall.h diff -u src/sys/sys/xcall.h:1.4 src/sys/sys/xcall.h:1.5 --- src/sys/sys/xcall.h:1.4 Tue Jun 22 18:29:01 2010 +++ src/sys/sys/xcall.h Tue Feb 19 09:04:53 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: xcall.h,v 1.4 2010/06/22 18:29:01 rmind Exp $ */ +/* $NetBSD: xcall.h,v 1.5 2013/02/19 09:04:53 martin Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -43,6 +43,8 @@ void xc_init_cpu(struct cpu_info *); void xc_send_ipi(struct cpu_info *); void xc_ipi_handler(void); +void xc__highpri_intr(void *); + uint64_t xc_broadcast(u_int, xcfunc_t, void *, void *); uint64_t xc_unicast(u_int, xcfunc_t, void *, void *, struct cpu_info *); void xc_wait(uint64_t);