Source-Changes-HG archive

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

[src/trunk]: src/sys Add critpoll (critical polling) hooks. These are keep t...



details:   https://anonhg.NetBSD.org/src/rev/bc77a14397bd
branches:  trunk
changeset: 759504:bc77a14397bd
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Dec 11 22:27:53 2010 +0000

description:
Add critpoll (critical polling) hooks.  These are keep things like watchdogs
from firing when the system is doing stuff like waiting at a ddb prompt or
the kernel is doing a lot of printing.

diffstat:

 sys/kern/kern_hook.c |  31 +++++++++++++++++++++++++++++--
 sys/sys/systm.h      |  10 +++++++++-
 2 files changed, 38 insertions(+), 3 deletions(-)

diffs (76 lines):

diff -r 8f94f3c2fad0 -r bc77a14397bd sys/kern/kern_hook.c
--- a/sys/kern/kern_hook.c      Sat Dec 11 19:55:53 2010 +0000
+++ b/sys/kern/kern_hook.c      Sat Dec 11 22:27:53 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_hook.c,v 1.3 2010/01/31 09:27:40 martin Exp $     */
+/*     $NetBSD: kern_hook.c,v 1.4 2010/12/11 22:27:53 matt Exp $       */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_hook.c,v 1.3 2010/01/31 09:27:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_hook.c,v 1.4 2010/12/11 22:27:53 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -279,6 +279,33 @@
        }
 }
 
+static hook_list_t critpollhook_list = LIST_HEAD_INITIALIZER(critpollhook_list);
+
+void *
+critpollhook_establish(void (*fn)(void *), void *arg)
+{
+       return hook_establish(&critpollhook_list, fn, arg);
+}
+
+void
+critpollhook_disestablish(void *vhook)
+{
+       hook_disestablish(&critpollhook_list, vhook);
+}
+
+/*
+ * Run critical polling hooks.
+ */
+void
+docritpollhooks(void)
+{
+       struct hook_desc *hd;
+
+       LIST_FOREACH(hd, &critpollhook_list, hk_list) {
+               (*hd->hk_fn)(hd->hk_arg);
+       }
+}
+
 /*
  * "Power hook" types, functions, and variables.
  * The list of power hooks is kept ordered with the last registered hook
diff -r 8f94f3c2fad0 -r bc77a14397bd sys/sys/systm.h
--- a/sys/sys/systm.h   Sat Dec 11 19:55:53 2010 +0000
+++ b/sys/sys/systm.h   Sat Dec 11 22:27:53 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: systm.h,v 1.242 2010/09/12 16:07:40 drochner Exp $     */
+/*     $NetBSD: systm.h,v 1.243 2010/12/11 22:27:53 matt Exp $ */
 
 /*-
  * Copyright (c) 1982, 1988, 1991, 1993
@@ -322,6 +322,14 @@
 void   setstatclockrate(int);
 
 /*
+ * Critical polling hooks.  Functions to be run while the kernel stays
+ * elevated IPL for a "long" time.  (watchdogs).
+ */
+void   *critpollhook_establish(void (*)(void *), void *);
+void   critpollhook_disestablish(void *);
+void   docritpollhooks(void);
+
+/*
  * Shutdown hooks.  Functions to be run with all interrupts disabled
  * immediately before the system is halted or rebooted.
  */



Home | Main Index | Thread Index | Old Index