Re: hw_random fixes

From: Ian Molton
Date: Wed Nov 25 2009 - 15:53:55 EST


Matt Mackall wrote:
> [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.

Well, I was hoping to, since it'd mean we accumulate spare bytes from
those drivers that can return more than one at a time but not less than
4 or 8. IMO though its just not worth handling the corner cases this
causes so I agree, just using it as a scratch buffer is best.

One or two drivers are completion based so they'd need to quiesce before
shutdown / change, too.

> You'll probably want to use cacheline alignment on buf to make Via
> Padlock happy,

Noted.

--
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/