Skip to contentSkip to conversation

x86/rdrand change for v3.3

GIT PULL Ingo Molnar 1 participant 1 message Jan 5, 2012 Random number driver

lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest x86-rdrand-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-rdrand-for-linus

out-of-topic modifications in x86-rdrand-for-linus:
---------------------------------------------------
drivers/char/random.c # cf833d0: random: Use arch_get_random_int i

Thanks,

Ingo

------------------>
Linus Torvalds (1):
random: Use arch_get_random_int instead of cycle counter if avail

 drivers/char/random.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/char/random.c +6 -2
index 6035ab8..85da874 100644
@@ -624,8 +624,8 @@ static struct timer_rand_state input_timer_state;
 static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
 {
 	struct {
-		cycles_t cycles;
 		long jiffies;
+		unsigned cycles;
 		unsigned num;
 	} sample;
 	long delta, delta2, delta3;
@@ -637,7 +637,11 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
 		goto out;
 
 	sample.jiffies = jiffies;
-	sample.cycles = get_cycles();
+
+	/* Use arch random value, fall back to cycles */
+	if (!arch_get_random_int(&sample.cycles))
+		sample.cycles = get_cycles();
+
 	sample.num = num;
 	mix_pool_bytes(&input_pool, &sample, sizeof(sample));