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

From: Ingo Molnar
Date: Tue Aug 31 2004 - 01:56:21 EST



* Lee Revell <rlrevell@xxxxxxxxxxx> 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++;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/