Date: Mon, 12 Mar 2001 11:32:06 -0800 (PST) From: Matt Dillon <dillon@earth.backplane.com> To: Mark Murray <mark@grondar.za> Cc: Bruce Evans <bde@zeta.org.au>, Maxim Sobolev <sobomax@FreeBSD.ORG>, current@FreeBSD.ORG Subject: Re: Ethernet entropy harvesting seriously pessimizes performance Message-ID: <200103121932.f2CJW6972075@earth.backplane.com> References: <Pine.BSF.4.21.0103130357490.719-100000@besplex.bde.org> <200103121854.f2CIsff91075@gratis.grondar.za>
next in thread | previous in thread | raw e-mail | index | archive | help
Sorry, the last patch won't patch cleanly, I forget to update my
-current source before diffing. A new patch is attached, and it
also includes reducing the sdize of the entropy ring from 1024 to a
more reasonable 64.
Mark, what I said last month still holds... you need to make the random
code less intrusive to the rest of the system. You need to do it as a
matter of course, not as an afterthought. A better hashing algorithm
is all well and fine, but doesn't really solve the lots-of-interrupts
problem, it just moves the bar a little. It doesn't scale, whereas
a hard limit on interrupt seeds per second does scale.
If you need a larger ring for initial seeding, then I recommend adding
a flag to the harvester. e.g. manual reseeding would use
the whole ring, but interrupt seeding would only operate if the current
number of entries in the ring is < 32 and be a NOP otherwise. Or
something like that. Even 32 could be too large... that would be
32 x 10 or 320 interrupt seeds a second, which is overkill. Perhaps
something like 8 would be better (8 x 10 = maximum of 80 interrupt
reseeds a second).
-Matt
Index: yarrow.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/random/yarrow.c,v
retrieving revision 1.31
diff -u -r1.31 yarrow.c
--- yarrow.c 2001/02/11 16:21:35 1.31
+++ yarrow.c 2001/03/12 19:27:02
@@ -104,11 +104,9 @@
for (;;) {
- if (harvestring.tail == harvestring.head)
- tsleep(&harvestring, PUSER, "rndslp", hz/10);
+ tsleep(&harvestring, PUSER, "rndslp", hz/10);
- else {
-
+ if (harvestring.tail != harvestring.head) {
/* Suck the harvested entropy out of the queue and hash
* it into the appropriate pool.
*/
Index: yarrow.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/random/yarrow.h,v
retrieving revision 1.15
diff -u -r1.15 yarrow.h
--- yarrow.h 2001/02/11 16:21:35 1.15
+++ yarrow.h 2001/03/12 19:27:20
@@ -32,7 +32,7 @@
*/
/* The ring size _MUST_ be a power of 2 */
-#define HARVEST_RING_SIZE 1024 /* harvest ring buffer size */
+#define HARVEST_RING_SIZE 64 /* harvest ring buffer size */
#define HARVEST_RING_MASK (HARVEST_RING_SIZE - 1)
#define TIMEBIN 16 /* max value for Pt/t */
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103121932.f2CJW6972075>
