Module Name:    src
Committed By:   riastradh
Date:           Wed Aug 28 12:50:18 UTC 2013

Modified Files:
        src/sys/kern: init_main.c kern_rndq.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.452 -r1.453 src/sys/kern/init_main.c
cvs rdiff -u -r1.18 -r1.19 src/sys/kern/kern_rndq.c

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.452 src/sys/kern/init_main.c:1.453
--- src/sys/kern/init_main.c:1.452	Tue Aug 27 19:30:10 2013
+++ src/sys/kern/init_main.c	Wed Aug 28 12:50:18 2013
@@ -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();

Index: src/sys/kern/kern_rndq.c
diff -u src/sys/kern/kern_rndq.c:1.18 src/sys/kern/kern_rndq.c:1.19
--- src/sys/kern/kern_rndq.c:1.18	Tue Aug 27 19:30:10 2013
+++ src/sys/kern/kern_rndq.c	Wed Aug 28 12:50:18 2013
@@ -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();
 }
 

Reply via email to