Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Don't schedule a softint if we have nothing to do.



details:   https://anonhg.NetBSD.org/src/rev/273708ef1a0d
branches:  trunk
changeset: 813769:273708ef1a0d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Feb 17 19:44:40 2016 +0000

description:
Don't schedule a softint if we have nothing to do.

Some systems seem to have gotten stuck in a softint processing loop
doing nothing and then trying to do it again.  Might fix gson's
frozen qemu/anita sparc autobuilds -- tested on macallan's real sparc
hardware and confirmed to fix at least some freeze at boot.

diffstat:

 sys/kern/kern_rndq.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (42 lines):

diff -r d5580658286a -r 273708ef1a0d sys/kern/kern_rndq.c
--- a/sys/kern/kern_rndq.c      Wed Feb 17 10:52:55 2016 +0000
+++ b/sys/kern/kern_rndq.c      Wed Feb 17 19:44:40 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_rndq.c,v 1.80 2016/02/17 01:23:32 riastradh Exp $ */
+/*     $NetBSD: kern_rndq.c,v 1.81 2016/02/17 19:44:40 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.80 2016/02/17 01:23:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.81 2016/02/17 19:44:40 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -297,15 +297,15 @@
        mutex_spin_exit(&rnd_global.lock);
 
        /*
-        * Assume some callback is likely to have entered entropy
-        * synchronously.  In that case, we may need to distribute
-        * entropy to waiters.  Do that, if we can do it
-        * asynchronously.  (Otherwise we may end up trying to
-        * distribute to the very rndsink that is trying to get more
-        * entropy in the first place, leading to lock recursion in
-        * that rndsink's callback.)
+        * Check whether we got entropy samples to process.  In that
+        * case, we may need to distribute entropy to waiters.  Do
+        * that, if we can do it asynchronously.
+        *
+        * - Conditionally because we don't want a softint loop.
+        * - Asynchronously because if we did it synchronously, we may
+        *   end up with lock recursion on rndsinks_lock.
         */
-       if (__predict_true(rnd_process))
+       if (!SIMPLEQ_EMPTY(&rnd_samples.q) && rnd_process != NULL)
                rnd_schedule_process();
 }
 



Home | Main Index | Thread Index | Old Index