Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Remove unnecessary, and actively wrong and harmful, ...



details:   https://anonhg.NetBSD.org/src/rev/68bda1f67d92
branches:  trunk
changeset: 337264:68bda1f67d92
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Apr 08 14:11:21 2015 +0000

description:
Remove unnecessary, and actively wrong and harmful, locking.

Obviously this `enable callback' never actually worked, because it
would deadlock against itself as soon as you try it.

diffstat:

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

diffs (55 lines):

diff -r a32cb3889481 -r 68bda1f67d92 sys/kern/kern_rndq.c
--- a/sys/kern/kern_rndq.c      Wed Apr 08 14:08:49 2015 +0000
+++ b/sys/kern/kern_rndq.c      Wed Apr 08 14:11:21 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_rndq.c,v 1.41 2015/04/08 14:08:49 riastradh Exp $ */
+/*     $NetBSD: kern_rndq.c,v 1.42 2015/04/08 14:11:21 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.41 2015/04/08 14:08:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.42 2015/04/08 14:11:21 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -444,22 +444,18 @@
 rnd_skew_enable(krndsource_t *rs, bool enabled)
 {
 
-       mutex_spin_enter(&rnd_skew.lock);
        if (enabled) {
                rnd_skew_intr(rs);
        } else {
                callout_stop(&rnd_skew.callout);
        }
-       mutex_spin_exit(&rnd_skew.lock);
 }
 
 static void
 rnd_skew_stop_intr(void *arg)
 {
 
-       mutex_spin_enter(&rnd_skew.lock);
        callout_stop(&rnd_skew.callout);
-       mutex_spin_exit(&rnd_skew.lock);
 }
 
 static void
@@ -470,11 +466,8 @@
        KASSERT(skewsrcp == &rnd_skew.source);
        if (RND_ENABLED(skewsrcp)) {
                /* Measure for 30s */
-               if (mutex_tryenter(&rnd_skew.lock)) {
-                       callout_schedule(&rnd_skew.stop_callout, hz * 30);
-                       callout_schedule(&rnd_skew.callout, 1);
-                       mutex_spin_exit(&rnd_skew.lock);
-               }
+               callout_schedule(&rnd_skew.stop_callout, hz * 30);
+               callout_schedule(&rnd_skew.callout, 1);
        }
 }
 



Home | Main Index | Thread Index | Old Index