Source-Changes-HG archive

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

[src/trunk]: src/sys/dev splvm should be enough to protect rnd sample queue a...



details:   https://anonhg.NetBSD.org/src/rev/7c1416050fc2
branches:  trunk
changeset: 571525:7c1416050fc2
user:      yamt <yamt%NetBSD.org@localhost>
date:      Mon Nov 29 13:33:37 2004 +0000

description:
splvm should be enough to protect rnd sample queue and rnd_mempool
as you can't use rnd_add_uint32 safely with >IPL_VM anyway.

diffstat:

 sys/dev/rnd.c |  28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diffs (113 lines):

diff -r 5d231dde5a7c -r 7c1416050fc2 sys/dev/rnd.c
--- a/sys/dev/rnd.c     Mon Nov 29 09:48:03 2004 +0000
+++ b/sys/dev/rnd.c     Mon Nov 29 13:33:37 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rnd.c,v 1.43 2004/04/25 16:42:40 simonb Exp $  */
+/*     $NetBSD: rnd.c,v 1.44 2004/11/29 13:33:37 yamt Exp $    */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.43 2004/04/25 16:42:40 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.44 2004/11/29 13:33:37 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -109,7 +109,7 @@
 
 /*
  * The event queue.  Fields are altered at an interrupt level.
- * All accesses must be protected at splhigh().
+ * All accesses must be protected at splvm().
  */
 volatile int                   rnd_timeout_pending;
 SIMPLEQ_HEAD(, _rnd_sample_t)  rnd_samples;
@@ -126,7 +126,7 @@
 volatile u_int32_t rnd_status;
 
 /*
- * Memory pool; accessed only at splhigh().
+ * Memory pool; accessed only at splvm().
  */
 POOL_INIT(rnd_mempool, sizeof(rnd_sample_t), 0, 0, 0, "rndsample", NULL);
 
@@ -134,7 +134,7 @@
  * Our random pool.  This is defined here rather than using the general
  * purpose one defined in rndpool.c.
  *
- * Samples are collected and queued at splhigh() into a separate queue
+ * Samples are collected and queued at splvm() into a separate queue
  * (rnd_samples, see above), and processed in a timeout routine; therefore,
  * all other accesses to the random pool must be at splsoftclock() as well.
  */
@@ -772,7 +772,7 @@
        rnd_sample_t *c;
        int s;
 
-       s = splhigh();
+       s = splvm();
        c = pool_get(&rnd_mempool, PR_WAITOK);
        splx(s);
        if (c == NULL)
@@ -794,7 +794,7 @@
        rnd_sample_t *c;
        int s;
 
-       s = splhigh();
+       s = splvm();
        c = pool_get(&rnd_mempool, 0);
        splx(s);
        if (c == NULL)
@@ -813,7 +813,7 @@
        int s;
 
        memset(c, 0, sizeof(rnd_sample_t));
-       s = splhigh();
+       s = splvm();
        pool_put(&rnd_mempool, c);
        splx(s);
 }
@@ -878,7 +878,7 @@
        rndsource_t *source;
        int s;
 
-       s = splhigh();
+       s = splvm();
 
        LIST_REMOVE(rs, list);
 
@@ -970,7 +970,7 @@
        /*
         * State arrays are full.  Queue this chunk on the processing queue.
         */
-       s = splhigh();
+       s = splvm();
        SIMPLEQ_INSERT_HEAD(&rnd_samples, state, next);
        rst->state = NULL;
 
@@ -1027,9 +1027,9 @@
        int s;
 
        /*
-        * Sample queue is protected at splhigh(); go there briefly to dequeue.
+        * Sample queue is protected at splvm(); go there briefly to dequeue.
         */
-       s = splhigh();
+       s = splvm();
        rnd_timeout_pending = 0;
 
        sample = SIMPLEQ_FIRST(&rnd_samples);
@@ -1061,8 +1061,8 @@
 
                rnd_sample_free(sample);
 
-               /* Go back to splhigh to dequeue the next one.. */
-               s = splhigh();
+               /* Go back to splvm to dequeue the next one.. */
+               s = splvm();
                sample = SIMPLEQ_FIRST(&rnd_samples);
        }
        splx(s);



Home | Main Index | Thread Index | Old Index