svn commit: r230230 - head/sys/dev/random
Andrey Chernov
ache at FreeBSD.ORG
Thu Jan 26 14:38:22 UTC 2012
On Thu, Jan 26, 2012 at 08:39:07AM -0500, John Baldwin wrote:
> What is the purpose of the atomics? Doing atomic_load/atomic_store
> is just as racy as if you had not used atomics at all.
Thanx for a hint.
Protecting comparison itself isn't essential as protecting variable
consitency because random_yarrow_unblock() which triggers operation isn't
called concurrently, but arc4rand() is. I consider your suggested way
a bit later. Yes, it seems acq/rel memory barriers are unneded,
> Should you be
> using atomic_cmpset instead, e.g.:
>
> case ARC4_ENTER_HAVE:
> /* XXX: What does it mean for this to fail? */
It means "Request to have enough entropy, but already have or even already
reseed".
> atomic_cmpset_int(&iniseed_state, ARC4_ENTER_NONE, ARC4_ENTER_HAVE);
> break;
--
http://ache.vniz.net/
More information about the svn-src-head
mailing list