Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/librump/rumpkern Provide xc_send_ipi() routine in R...



details:   https://anonhg.NetBSD.org/src/rev/34efecc6f429
branches:  trunk
changeset: 784166:34efecc6f429
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sun Jan 20 17:09:47 2013 +0000

description:
Provide xc_send_ipi() routine in RUMP, which is required for high-priority
xcall(9) mechanism.  It is emulated using low-priority xcall(9).

diffstat:

 sys/rump/librump/rumpkern/emul.c |  31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r f6a707669f08 -r 34efecc6f429 sys/rump/librump/rumpkern/emul.c
--- a/sys/rump/librump/rumpkern/emul.c  Sun Jan 20 15:23:21 2013 +0000
+++ b/sys/rump/librump/rumpkern/emul.c  Sun Jan 20 17:09:47 2013 +0000
@@ -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 @@
 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



Home | Main Index | Thread Index | Old Index