Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode implement cpu idle via sigsuspend



details:   https://anonhg.NetBSD.org/src/rev/50499be7066e
branches:  trunk
changeset: 772033:50499be7066e
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Dec 15 00:40:03 2011 +0000

description:
implement cpu idle via sigsuspend

diffstat:

 sys/arch/usermode/dev/cpu.c        |   8 +++-----
 sys/arch/usermode/include/thunk.h  |   4 +++-
 sys/arch/usermode/usermode/thunk.c |  14 ++++++++++++--
 3 files changed, 18 insertions(+), 8 deletions(-)

diffs (86 lines):

diff -r 40300394dddb -r 50499be7066e sys/arch/usermode/dev/cpu.c
--- a/sys/arch/usermode/dev/cpu.c       Thu Dec 15 00:05:18 2011 +0000
+++ b/sys/arch/usermode/dev/cpu.c       Thu Dec 15 00:40:03 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.52 2011/12/14 12:29:59 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.53 2011/12/15 00:40:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
 #include "opt_hz.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.52 2011/12/14 12:29:59 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.53 2011/12/15 00:40:03 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -247,9 +247,7 @@
        if (ci->ci_want_resched)
                return;
 
-#if notyet
-       thunk_usleep(10000);
-#endif
+       thunk_idle();
 }
 
 void
diff -r 40300394dddb -r 50499be7066e sys/arch/usermode/include/thunk.h
--- a/sys/arch/usermode/include/thunk.h Thu Dec 15 00:05:18 2011 +0000
+++ b/sys/arch/usermode/include/thunk.h Thu Dec 15 00:40:03 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.37 2011/12/12 16:39:16 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.38 2011/12/15 00:40:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -130,6 +130,8 @@
 int    thunk_mprotect(void *addr, size_t len, int prot);
 int    thunk_posix_memalign(void **, size_t, size_t);
 
+int    thunk_idle(void);
+
 char * thunk_getenv(const char *);
 vaddr_t        thunk_get_vm_min_address(void);
 
diff -r 40300394dddb -r 50499be7066e sys/arch/usermode/usermode/thunk.c
--- a/sys/arch/usermode/usermode/thunk.c        Thu Dec 15 00:05:18 2011 +0000
+++ b/sys/arch/usermode/usermode/thunk.c        Thu Dec 15 00:40:03 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.43 2011/12/13 22:22:08 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.44 2011/12/15 00:40:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.43 2011/12/13 22:22:08 jmcneill Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.44 2011/12/15 00:40:03 jmcneill Exp $");
 #endif
 
 #include <sys/types.h>
@@ -41,6 +41,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <sched.h>
 #include <stdarg.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -586,3 +587,12 @@
        return VM_MIN_ADDRESS;
 }
 
+int
+thunk_idle(void)
+{
+       sigset_t sigmask;
+
+       sigemptyset(&sigmask);
+
+       return sigsuspend(&sigmask);
+}



Home | Main Index | Thread Index | Old Index