Messages in this thread | ![/](/images/icornerl.gif) | | From | "Jason A. Donenfeld" <> | Date | Sat, 5 Feb 2022 13:50:42 +0100 | Subject | Re: [PATCH RFC v1] random: do not take spinlocks in irq handler |
| |
Hi Sultan,
On Sat, Feb 5, 2022 at 5:02 AM Sultan Alsawaf <sultan@kerneltoast.com> wrote: > The __this_cpu_{ATOMIC_OP}() functions are for atomically performing a single > per-CPU operation for the current CPU from contexts that permit CPU migration. > Since this code is safe from CPU migrations (add_interrupt_randomness() runs in > hardirq context), the atomic per-CPU helpers are unneeded. Instead of using > __this_cpu_inc_return() and __this_cpu_or(), we can operate on the per-CPU > pointer directly without any extra safety (e.g., `++fast_pool->count` can be > used in place of `__this_cpu_inc_return(irq_randomness.count)`).
Oh, right, thanks. We're already in irq so we don't have to worried about load,add,store being cut up in any way. I'll go back to simple increments for v3.
Jason
| ![\](/images/icornerr.gif) |