Re: [PATCH] random: set fast pool count to zero in cpuhp teardown

From: Jason A. Donenfeld
Date: Mon Feb 14 2022 - 08:28:57 EST


Hey Sebastian,

Thanks for your pointers.

I actually think that rollback is less of an issue than:

> - should a CPU already contribute entropy and schedule a worker then we
> reset the FAST_POOL_MIX_INFLIGHT bit.

If a CPU is going down, and we zero out count, and then it rolls back,
I'm fine with it having to acquire 64 more interrupts. In contrast, if
a CPU comes back online, I'd rather not potentially throw out the
fresh entropy. So I think I will go with your suggestion of:

> - move it to CPUHP_OFFLINE … CPUHP_BRINGUP_CPU. This is invoked on
> another CPU once the is dead / before it comes up.
> - in that case the function can remain as-is. But we have "rollback".

This seems like the best compromise. Also, executing in that phase
will let us do other things with that handler later (setting the crng
generation counter to ULONG_MAX), where it also would make sense.

I'll give this a shot and send you a v+1.

Jason