mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: linux-kernel@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH v2] random: unify cycles_t and jiffies usage and types
Date: Fri, 25 Feb 2022 07:58:40 +0100	[thread overview]
Message-ID: <Yhh+IJftHEZcHdEn@owl.dominikbrodowski.net> (raw)
In-Reply-To: <20220224213030.75400-1-Jason@zx2c4.com>

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

  reply	other threads:[~2022-02-25  7:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24 17:39 [PATCH] random: use proper cycle_t type for random_get_entropy() Jason A. Donenfeld
2022-02-24 21:30 ` [PATCH v2] random: unify cycles_t and jiffies usage and types Jason A. Donenfeld
2022-02-25  6:58   ` Dominik Brodowski [this message]
2022-02-25 13:39     ` Jason A. Donenfeld
2022-02-25 13:44       ` [PATCH v3] " Jason A. Donenfeld
2022-02-25 14:16         ` Dominik Brodowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yhh+IJftHEZcHdEn@owl.dominikbrodowski.net \
    --to=linux@dominikbrodowski.net \
    --cc=Jason@zx2c4.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®