Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q5

Ingo Molnar
2004-08-31T06:53:14Z

* Lee Revell <rlrevell@joe-job.com> wrote:

> On Mon, 2004-08-30 at 05:06, Ingo Molnar wrote:
> > i've uploaded -Q5 to:
> >
> > http://redhat.com/~mingo/voluntary-preempt/voluntary-preempt-2.6.9-rc1-bk4-Q5
>
> This fixes the PS/2 issue. Entropy rekeying is still a big problem:
>
> http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-bk4-Q5#/var/www/2.6.9-rc1-bk4-Q5/trace3.txt

ok. It seems the random driver is _mostly_ in shape latency-wise, except
the IP rekeying visible in the above trace. To solve this problem, could
you try the patch below, ontop of -Q5? It moves the random seed
generation outside of the spinlock - AFAICS the spinlock is only needed
to protect the IP sequence counter itself.

Ingo

--- linux/drivers/char/random.c.orig
+++ linux/drivers/char/random.c
@@ -2226,17 +2226,18 @@ static unsigned int ip_cnt;

static void rekey_seq_generator(void *private_)
{
- struct keydata *keyptr;
+ struct keydata *keyptr, tmp;
struct timeval tv;

do_gettimeofday(&tv);
+ get_random_bytes(tmp.secret, sizeof(tmp.secret));

spin_lock_bh(&ip_lock);
keyptr = &ip_keydata[ip_cnt&1];

keyptr = &ip_keydata[1^(ip_cnt&1)];
keyptr->rekey_time = tv.tv_sec;
- get_random_bytes(keyptr->secret, sizeof(keyptr->secret));
+ memcpy(keyptr->secret, tmp.secret, sizeof(keyptr->secret));
keyptr->count = (ip_cnt&COUNT_MASK)<<HASH_BITS;
mb();
ip_cnt++;