[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+8MBbKyRhipHsxb0nvV11Bvv8ypQ_gq5JR8ihfuG6JfBTnxZw@mail.gmail.com>
Date: Thu, 20 Feb 2020 14:29:32 -0800
From: Tony Luck <tony.luck@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: "Jason A. Donenfeld" <Jason@...c4.com>, "Ted Ts'o" <tytso@....edu>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] random: always use batched entropy for get_random_u{32,64}
Also ... what's the deal with a spin_lock on a per-cpu structure?
batch = raw_cpu_ptr(&batched_entropy_u64);
spin_lock_irqsave(&batch->batch_lock, flags);
if (batch->position % ARRAY_SIZE(batch->entropy_u64) == 0) {
extract_crng((u8 *)batch->entropy_u64);
batch->position = 0;
}
ret = batch->entropy_u64[batch->position++];
spin_unlock_irqrestore(&batch->batch_lock, flags);
Could we just disable interrupts and pre-emption around the entropy extraction?
-Tony
Powered by blists - more mailing lists