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 librump: add kpreempt_disabled(9) ...



details:   https://anonhg.NetBSD.org/src/rev/784e064c6d9d
branches:  trunk
changeset: 796489:784e064c6d9d
user:      rmind <rmind%NetBSD.org@localhost>
date:      Thu Jun 05 23:43:04 2014 +0000

description:
librump: add kpreempt_disabled(9) and softint_schedule_cpu(9).

diffstat:

 sys/rump/librump/rumpkern/intr.c      |  12 ++++++++++--
 sys/rump/librump/rumpkern/scheduler.c |  13 +++++++++++--
 2 files changed, 21 insertions(+), 4 deletions(-)

diffs (67 lines):

diff -r cc1c3cb6768e -r 784e064c6d9d sys/rump/librump/rumpkern/intr.c
--- a/sys/rump/librump/rumpkern/intr.c  Thu Jun 05 23:42:25 2014 +0000
+++ b/sys/rump/librump/rumpkern/intr.c  Thu Jun 05 23:43:04 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.c,v 1.42 2013/11/11 23:11:30 pooka Exp $  */
+/*     $NetBSD: intr.c,v 1.43 2014/06/05 23:43:04 rmind Exp $  */
 
 /*
  * Copyright (c) 2008-2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.42 2013/11/11 23:11:30 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.43 2014/06/05 23:43:04 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -324,6 +324,14 @@
        }
 }
 
+void
+softint_schedule_cpu(void *arg, struct cpu_info *ci)
+{
+       /* TODO: implement this properly */
+       KASSERT(curcpu() == ci);
+       softint_schedule(arg);
+}
+
 /*
  * flimsy disestablish: should wait for softints to finish.
  */
diff -r cc1c3cb6768e -r 784e064c6d9d sys/rump/librump/rumpkern/scheduler.c
--- a/sys/rump/librump/rumpkern/scheduler.c     Thu Jun 05 23:42:25 2014 +0000
+++ b/sys/rump/librump/rumpkern/scheduler.c     Thu Jun 05 23:43:04 2014 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: scheduler.c,v 1.37 2014/04/09 23:53:36 pooka Exp $    */
+/*      $NetBSD: scheduler.c,v 1.38 2014/06/05 23:43:04 rmind Exp $    */
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.37 2014/04/09 23:53:36 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.38 2014/06/05 23:43:04 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -523,6 +523,15 @@
        KPREEMPT_ENABLE(curlwp);
 }
 
+bool
+kpreempt_disabled(void)
+{
+       const lwp_t *l = curlwp;
+
+       return l->l_nopreempt != 0 || l->l_stat == LSZOMB ||
+           (l->l_flag & LW_IDLE) != 0 /* || cpu_kpreempt_disabled() */;
+}
+
 void
 suspendsched(void)
 {



Home | Main Index | Thread Index | Old Index