lkml.org 
[lkml]   [2022]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] random: unify cycles_t and jiffies usage and types
Am Thu, Feb 24, 2022 at 10:30:30PM +0100 schrieb Jason A. Donenfeld:
> @@ -1016,19 +1010,26 @@ struct timer_rand_state {
> */
> void add_device_randomness(const void *buf, size_t size)
> {
> - unsigned long time = random_get_entropy() ^ jiffies;
> - unsigned long flags;
> + cycles_t cycles = random_get_entropy();
> + unsigned long now = jiffies, flags;

maybe "flags, now = jiffies" is a bit more reader-friendly?

> static void add_timer_randomness(struct timer_rand_state *state, unsigned int num)
> {
> - struct {
> - long jiffies;
> - unsigned int cycles;
> - unsigned int num;
> - } sample;
> + cycles_t cycles = random_get_entropy();
> + unsigned long now = jiffies, flags;

Same here.

> @@ -1291,10 +1289,10 @@ static void mix_interrupt_randomness(struct work_struct *work)
> void add_interrupt_randomness(int irq)
> {
> enum { MIX_INFLIGHT = 1U << 31 };
> + cycles_t cycles = random_get_entropy();
> + unsigned long now = jiffies;
> struct fast_pool *fast_pool = this_cpu_ptr(&irq_randomness);
> struct pt_regs *regs = get_irq_regs();
> - unsigned long now = jiffies;
> - cycles_t cycles = random_get_entropy();
> unsigned int new_count;
>
> if (cycles == 0)


Why do you change the ordering here?

Thanks,
Dominik

\
 
 \ /
  Last update: 2022-02-25 08:07    [W:0.201 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site