Module Name: src Committed By: christos Date: Thu Jun 20 23:21:42 UTC 2013
Modified Files: src/sys/kern: init_main.c kern_rndq.c src/sys/sys: rnd.h Log Message: Initialize the rnd softint explicitly via a function late in main. Avoids LOCKDEBUG panic since softint_establish() was called via wdcintr -> wddone from an interrupt context and tried to acquire a non-spin mutex. To generate a diff of this commit: cvs rdiff -u -r1.449 -r1.450 src/sys/kern/init_main.c cvs rdiff -u -r1.12 -r1.13 src/sys/kern/kern_rndq.c cvs rdiff -u -r1.36 -r1.37 src/sys/sys/rnd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/init_main.c diff -u src/sys/kern/init_main.c:1.449 src/sys/kern/init_main.c:1.450 --- src/sys/kern/init_main.c:1.449 Wed Jun 5 15:01:26 2013 +++ src/sys/kern/init_main.c Thu Jun 20 19:21:41 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.449 2013/06/05 19:01:26 christos Exp $ */ +/* $NetBSD: init_main.c,v 1.450 2013/06/20 23:21:41 christos Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.449 2013/06/05 19:01:26 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.450 2013/06/20 23:21:41 christos Exp $"); #include "opt_ddb.h" #include "opt_ipsec.h" @@ -565,6 +565,8 @@ main(void) if_attachdomain(); splx(s); + rnd_init_softint(); + #ifdef GPROF /* Initialize kernel profiling. */ kmstartup(); Index: src/sys/kern/kern_rndq.c diff -u src/sys/kern/kern_rndq.c:1.12 src/sys/kern/kern_rndq.c:1.13 --- src/sys/kern/kern_rndq.c:1.12 Wed Jun 12 21:37:03 2013 +++ src/sys/kern/kern_rndq.c Thu Jun 20 19:21:41 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_rndq.c,v 1.12 2013/06/13 01:37:03 tls Exp $ */ +/* $NetBSD: kern_rndq.c,v 1.13 2013/06/20 23:21:41 christos Exp $ */ /*- * Copyright (c) 1997-2013 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.12 2013/06/13 01:37:03 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.13 2013/06/20 23:21:41 christos Exp $"); #include <sys/param.h> #include <sys/ioctl.h> @@ -174,6 +174,12 @@ LIST_HEAD(, krndsource) rnd_sources; rndsave_t *boot_rsp; +void +rnd_init_softint(void) { + rnd_process = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE, + rnd_intr, NULL); +} + /* * Generate a 32-bit counter. This should be more machine dependent, * using cycle counters and the like when possible. @@ -207,20 +213,12 @@ rnd_schedule_softint(void *softint) kpreempt_enable(); } -/* - * XXX repulsive: we can't initialize our softints in rnd_init - * XXX (too early) so we wrap the points where we'd schedule them, thus. - */ static inline void rnd_schedule_process(void) { if (__predict_true(rnd_process)) { rnd_schedule_softint(rnd_process); return; - } - if (!cold) { - rnd_process = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE, - rnd_intr, NULL); } rnd_process_events(); } Index: src/sys/sys/rnd.h diff -u src/sys/sys/rnd.h:1.36 src/sys/sys/rnd.h:1.37 --- src/sys/sys/rnd.h:1.36 Wed Jun 12 20:55:01 2013 +++ src/sys/sys/rnd.h Thu Jun 20 19:21:42 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: rnd.h,v 1.36 2013/06/13 00:55:01 tls Exp $ */ +/* $NetBSD: rnd.h,v 1.37 2013/06/20 23:21:42 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -176,6 +176,7 @@ uint32_t rndpool_get_poolsize(void); void rndpool_add_data(rndpool_t *, void *, uint32_t, uint32_t); uint32_t rndpool_extract_data(rndpool_t *, void *, uint32_t, uint32_t); void rnd_init(void); +void rnd_init_softint(void); void _rnd_add_uint32(krndsource_t *, uint32_t); void rnd_add_data(krndsource_t *, const void *const, uint32_t, uint32_t);