Tighten initialization of rnd softints.

- Do rnd_init_softint as early as possible in main, after configure2,
  and before networking is initialized.

- Initialize the rnd_wakeup softint in rnd_init_softint, not lazily in
  rnd_schedule_wakeup.

ok tls
This commit is contained in:
riastradh 2013-08-28 12:50:18 +00:00
parent efab425d4c
commit 5287a42d7a
2 changed files with 9 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.452 2013/08/27 19:30:10 riastradh Exp $ */
/* $NetBSD: init_main.c,v 1.453 2013/08/28 12:50:18 riastradh 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.452 2013/08/27 19:30:10 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.453 2013/08/28 12:50:18 riastradh Exp $");
#include "opt_ddb.h"
#include "opt_ipsec.h"
@ -519,6 +519,9 @@ main(void)
/* Now timer is working. Enable preemption. */
kpreempt_enable();
/* Enable deferred processing of RNG samples */
rnd_init_softint();
#ifdef SYSVSHM
/* Initialize System V style shared memory. */
shminit();
@ -565,8 +568,6 @@ 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.18 2013/08/27 19:30:10 riastradh Exp $ */
/* $NetBSD: kern_rndq.c,v 1.19 2013/08/28 12:50:18 riastradh 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.18 2013/08/27 19:30:10 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.19 2013/08/28 12:50:18 riastradh Exp $");
#include <sys/param.h>
#include <sys/ioctl.h>
@ -168,6 +168,8 @@ void
rnd_init_softint(void) {
rnd_process = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE,
rnd_intr, NULL);
rnd_wakeup = softint_establish(SOFTINT_CLOCK|SOFTINT_MPSAFE,
rnd_wake, NULL);
}
/*
@ -220,10 +222,6 @@ rnd_schedule_wakeup(void)
rnd_schedule_softint(rnd_wakeup);
return;
}
if (!cold) {
rnd_wakeup = softint_establish(SOFTINT_CLOCK|SOFTINT_MPSAFE,
rnd_wake, NULL);
}
rnd_wakeup_readers();
}