[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yhh+IJftHEZcHdEn@owl.dominikbrodowski.net>
Date: Fri, 25 Feb 2022 07:58:40 +0100
From: Dominik Brodowski <linux@...inikbrodowski.net>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: linux-kernel@...r.kernel.org, Theodore Ts'o <tytso@....edu>
Subject: Re: [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
Powered by blists - more mailing lists