Module Name: src Committed By: rmind Date: Sun Jan 20 17:09:47 UTC 2013
Modified Files: src/sys/rump/librump/rumpkern: emul.c Log Message: Provide xc_send_ipi() routine in RUMP, which is required for high-priority xcall(9) mechanism. It is emulated using low-priority xcall(9). To generate a diff of this commit: cvs rdiff -u -r1.151 -r1.152 src/sys/rump/librump/rumpkern/emul.c 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.151 src/sys/rump/librump/rumpkern/emul.c:1.152 --- src/sys/rump/librump/rumpkern/emul.c:1.151 Sat Oct 27 17:18:40 2012 +++ src/sys/rump/librump/rumpkern/emul.c Sun Jan 20 17:09:47 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: emul.c,v 1.151 2012/10/27 17:18:40 chs Exp $ */ +/* $NetBSD: emul.c,v 1.152 2013/01/20 17:09:47 rmind 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.151 2012/10/27 17:18:40 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.152 2013/01/20 17:09:47 rmind Exp $"); #include <sys/param.h> #include <sys/null.h> @@ -284,9 +284,32 @@ syscall_intern(struct proc *p) void xc_send_ipi(struct cpu_info *ci) { + const struct cpu_info *curci = curcpu(); + CPU_INFO_ITERATOR cii; - /* I'll think about the implementation if this is ever used */ - panic("not implemented"); + /* + * 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