Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Omit call to rnd_getmore from rnd_process_events.



details:   https://anonhg.NetBSD.org/src/rev/3df2647c3851
branches:  trunk
changeset: 343619:3df2647c3851
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Feb 17 00:57:36 2016 +0000

description:
Omit call to rnd_getmore from rnd_process_events.

There are three cases to consider here:

1. You have on-demand synchronous rndsources, e.g. RDRAND (and you're
willing to use it).  In that case, you'll just use those whenever you
need to extract entropy.  There's no benefit to requesting more from
them when we're entering data into the pool.

2. You have on-demand asynchronous rndsources.  These should continue
trying to feed data to the entropy pool as long as it needs more, so
there's no benefit to requesting more from them when we're entering
data into the pool.

3. You don't have any on-demand rndsources.  Then rnd_getmore does
nothing, so there's no benefit to calling it.

ok tls

diffstat:

 sys/kern/kern_rndq.c |  11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diffs (35 lines):

diff -r 75e435fecd9d -r 3df2647c3851 sys/kern/kern_rndq.c
--- a/sys/kern/kern_rndq.c      Wed Feb 17 00:49:28 2016 +0000
+++ b/sys/kern/kern_rndq.c      Wed Feb 17 00:57:36 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_rndq.c,v 1.76 2016/02/17 00:43:42 riastradh Exp $ */
+/*     $NetBSD: kern_rndq.c,v 1.77 2016/02/17 00:57:36 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.76 2016/02/17 00:43:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.77 2016/02/17 00:57:36 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -1127,15 +1127,10 @@
 
        /*
         * If we filled the pool past the threshold, wake anyone
-        * waiting for entropy.  Otherwise, ask all the entropy sources
-        * for more.
+        * waiting for entropy.
         */
        if (pool_entropy > RND_ENTROPY_THRESHOLD * 8) {
                wake++;
-       } else {
-               rnd_getmore(howmany((RND_POOLBITS - pool_entropy), NBBY));
-               rnd_printf_verbose("rnd: empty, asking for %d bytes\n",
-                   (int)(howmany((RND_POOLBITS - pool_entropy), NBBY)));
        }
 
        /* Now we hold no locks: clean up. */



Home | Main Index | Thread Index | Old Index