Module Name:    src
Committed By:   riastradh
Date:           Thu Apr 30 03:41:20 UTC 2020

Modified Files:
        src/sys/rump/librump/rumpkern: hyperentropy.c

Log Message:
No need for a lock around rnd_add_data any more.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/rump/librump/rumpkern/hyperentropy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/rump/librump/rumpkern/hyperentropy.c
diff -u src/sys/rump/librump/rumpkern/hyperentropy.c:1.16 src/sys/rump/librump/rumpkern/hyperentropy.c:1.17
--- src/sys/rump/librump/rumpkern/hyperentropy.c:1.16	Thu Apr 30 03:40:53 2020
+++ src/sys/rump/librump/rumpkern/hyperentropy.c	Thu Apr 30 03:41:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperentropy.c,v 1.16 2020/04/30 03:40:53 riastradh Exp $	*/
+/*	$NetBSD: hyperentropy.c,v 1.17 2020/04/30 03:41:20 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
@@ -26,18 +26,16 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.16 2020/04/30 03:40:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.17 2020/04/30 03:41:20 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
-#include <sys/mutex.h>
 #include <sys/rndsource.h>
 
 #include <rump-sys/kern.h>
 
 #include <rump/rumpuser.h>
 
-static kmutex_t rndsrc_lock;
 static krndsource_t rndsrc;
 
 static void
@@ -56,9 +54,7 @@ feedrandom(size_t bytes, void *cookie __
 		n += MIN(nread, bytes - n);
 	}
 	if (n) {
-		mutex_enter(&rndsrc_lock);
 		rnd_add_data_sync(&rndsrc, rnddata, n, NBBY*n);
-		mutex_exit(&rndsrc_lock);
 	}
 	kmem_intr_free(rnddata, bytes);
 }
@@ -67,8 +63,6 @@ void
 rump_hyperentropy_init(void)
 {
 
-	mutex_init(&rndsrc_lock, MUTEX_DEFAULT, IPL_VM);
-
 	rndsource_setcb(&rndsrc, &feedrandom, NULL);
 	rnd_attach_source(&rndsrc, "rump_hyperent", RND_TYPE_VM,
 	    RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);

Reply via email to