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.
This commit is contained in:
christos 2013-06-20 23:21:41 +00:00
parent fd65ca0108
commit 816452912b
3 changed files with 14 additions and 13 deletions

View File

@ -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();

View File

@ -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,10 +213,6 @@ 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)
{
@ -218,10 +220,6 @@ rnd_schedule_process(void)
rnd_schedule_softint(rnd_process);
return;
}
if (!cold) {
rnd_process = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE,
rnd_intr, NULL);
}
rnd_process_events();
}

View File

@ -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);