Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Dec 2012 11:49:32 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r244254 - projects/calloutng/sys/dev/random
Message-ID:  <201212151149.qBFBnWJR054387@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Dec 15 11:49:32 2012
New Revision: 244254
URL: http://svnweb.freebsd.org/changeset/base/244254

Log:
  Specify that wakeup rate of 7.5-10Hz is OK for yarrow harvesting thread.

Modified:
  projects/calloutng/sys/dev/random/randomdev_soft.c

Modified: projects/calloutng/sys/dev/random/randomdev_soft.c
==============================================================================
--- projects/calloutng/sys/dev/random/randomdev_soft.c	Sat Dec 15 11:44:04 2012	(r244253)
+++ projects/calloutng/sys/dev/random/randomdev_soft.c	Sat Dec 15 11:49:32 2012	(r244254)
@@ -242,10 +242,10 @@ random_kthread(void *arg __unused)
 	local_count = 0;
 
 	/* Process until told to stop */
+	mtx_lock_spin(&harvest_mtx);
 	for (; random_kthread_control >= 0;) {
 
 		/* Cycle through all the entropy sources */
-		mtx_lock_spin(&harvest_mtx);
 		for (source = RANDOM_START; source < ENTROPYSOURCE; source++) {
 			/*
 			 * Drain entropy source records into a thread-local
@@ -270,7 +270,6 @@ random_kthread(void *arg __unused)
 			emptyfifo.count += local_count;
 			local_count = 0;
 		}
-		mtx_unlock_spin(&harvest_mtx);
 
 		KASSERT(local_count == 0, ("random_kthread: local_count %d",
 		    local_count));
@@ -283,9 +282,11 @@ random_kthread(void *arg __unused)
 			random_kthread_control = 0;
 
 		/* Work done, so don't belabour the issue */
-		pause("-", hz / 10);
+		msleep_spin_flags(&random_kthread_control, &harvest_mtx,
+		    "-", hz / 10, C_PRELSET(1));
 
 	}
+	mtx_unlock_spin(&harvest_mtx);
 
 	random_set_wakeup_exit(&random_kthread_control);
 	/* NOTREACHED */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212151149.qBFBnWJR054387>