Source-Changes-HG archive

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

[src/trunk]: src/sys/kern entropy: Only print consolidation warning of AB_DEBUG.



details:   https://anonhg.NetBSD.org/src/rev/610ac88fd0ba
branches:  trunk
changeset: 952310:610ac88fd0ba
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Feb 12 19:48:26 2021 +0000

description:
entropy: Only print consolidation warning of AB_DEBUG.

The previous fix for PR kern/55458 changed printf to log(LOG_DEBUG, ...) with
the intent of hiding the message unless 'boot -x'. But this did not actually
suppress the message to console as log(LOG_DEBUG, ...) will print to console
if syslogd is not running yet.

So instead, just check for AB_DEBUG flag directly in boothowto, and only
printf the message if it is set.

diffstat:

 sys/kern/kern_entropy.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 40a6271f8d3e -r 610ac88fd0ba sys/kern/kern_entropy.c
--- a/sys/kern/kern_entropy.c   Fri Feb 12 18:20:05 2021 +0000
+++ b/sys/kern/kern_entropy.c   Fri Feb 12 19:48:26 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_entropy.c,v 1.29 2021/01/21 17:33:55 riastradh Exp $      */
+/*     $NetBSD: kern_entropy.c,v 1.30 2021/02/12 19:48:26 jmcneill Exp $       */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.29 2021/01/21 17:33:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.30 2021/02/12 19:48:26 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -98,6 +98,7 @@
 #include <sys/percpu.h>
 #include <sys/poll.h>
 #include <sys/queue.h>
+#include <sys/reboot.h>
 #include <sys/rnd.h>           /* legacy kernel API */
 #include <sys/rndio.h>         /* userland ioctl interface */
 #include <sys/rndsource.h>     /* kernel rndsource driver API */
@@ -1031,9 +1032,11 @@
        atomic_store_relaxed(&E->needed, E->needed - diff);
        E->pending -= diff;
        if (__predict_false(E->needed > 0)) {
-               if (ratecheck(&lasttime, &interval))
-                       log(LOG_DEBUG, "entropy: WARNING:"
+               if (ratecheck(&lasttime, &interval) &&
+                   (boothowto & AB_DEBUG) != 0) {
+                       printf("entropy: WARNING:"
                            " consolidating less than full entropy\n");
+               }
        }
 
        /* Advance the epoch and notify waiters.  */



Home | Main Index | Thread Index | Old Index