From owner-freebsd-current Mon Mar 12 11:32:27 2001 Delivered-To: freebsd-current@freebsd.org Received: from earth.backplane.com (earth-nat-cw.backplane.com [208.161.114.67]) by hub.freebsd.org (Postfix) with ESMTP id 5B7D037B718; Mon, 12 Mar 2001 11:32:22 -0800 (PST) (envelope-from dillon@earth.backplane.com) Received: (from dillon@localhost) by earth.backplane.com (8.11.2/8.9.3) id f2CJW6972075; Mon, 12 Mar 2001 11:32:06 -0800 (PST) (envelope-from dillon) Date: Mon, 12 Mar 2001 11:32:06 -0800 (PST) From: Matt Dillon Message-Id: <200103121932.f2CJW6972075@earth.backplane.com> To: Mark Murray Cc: Bruce Evans , Maxim Sobolev , current@FreeBSD.ORG Subject: Re: Ethernet entropy harvesting seriously pessimizes performance References: <200103121854.f2CIsff91075@gratis.grondar.za> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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