[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1259177252.2858.17.camel@calx>
Date: Wed, 25 Nov 2009 13:27:32 -0600
From: Matt Mackall <mpm@...enic.com>
To: Ian Molton <ian.molton@...labora.co.uk>
Cc: Rusty Russell <rusty@...tcorp.com.au>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: hw_random fixes
[cc:ing to linux-kernel, finally]
On Wed, 2009-11-25 at 10:16 +0000, Ian Molton wrote:
> Rusty Russell wrote:
>
> > Make that:
> >
> > ssize_t (*get_rng_data)(void *buf, size_t max, bool wait);
> >
> > Then, if driver supplies that hook, use it exclusively. Otherwise, use old
> > ones. We can convert them gradually that way.
>
> This doesn't quite solve things neatly, because it means one of:
>
> 1) The core has to wait until there is nothing left before requesting
> more data, because it doesnt know the alignment requirements of the driver.
Hmm, this seems to imply you'd be calling get_rng_data multiple times
with different offsets into buf to accumulate data. I think that's more
complex than is needed. Just use buf as a nicely aligned scratch buffer
and empty it completely into the final output buffer before the next
driver request. If you end up with 1 byte of data hanging around until
the next read, that's not a problem - the next read might be 5 bytes.
You'll probably want to use cacheline alignment on buf to make Via
Padlock happy, if anything needs larger alignment (ie page) it should
handle it internally.
--
http://selenic.com : development and support for Mercurial and Linux
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists