linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Hannes Frederic Sowa <hannes@stressinduktion.org>,
	Andy Lutomirski <luto@amacapital.net>
Subject: Re: [PATCH 1/2] random: use chacha20 for get_random_int/long
Date: Fri, 20 Jan 2017 19:10:13 -0500	[thread overview]
Message-ID: <20170121001013.6vtxpuaqplwnvwaz@thunk.org> (raw)
In-Reply-To: <CAHmME9oRZ-uNy-p5EMOULcQd9iz1i+FHhTtTB8czQqF=ZKxt3A@mail.gmail.com>

On Fri, Jan 20, 2017 at 04:38:59PM +0100, Jason A. Donenfeld wrote:
> I was thinking that the issue isn't merely cache line and a slow down,
> but that on some platforms, this could be an _illegal unaligned
> access_. That means we'd need to rewrite the code to use the unaligned
> access helpers or memcpy, and then it's really suboptimal, not to
> mention ugly, since just indexing into an array like we do now is so
> clean.

Why would there be an unaligned access?  What I was suggesting was an
array of u32, and we just do two separate u32 accesses with a shift in
the case of get_random_u64.  There's nothing illegal about that.

    u64 retval;

    retval = (array[pointer] << 32) + array[pointer+1];
    pointer += 2;

This is not terribly suboptimal nor terribly ugly.

						- Ted

  reply	other threads:[~2017-01-21  0:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06 18:32 [PATCH 1/2] random: use chacha20 for get_random_int/long Jason A. Donenfeld
2017-01-06 18:32 ` [PATCH 2/2] random: convert get_random_int/long into get_random_u32/u64 Jason A. Donenfeld
2017-01-18  3:49 ` [PATCH 1/2] random: use chacha20 for get_random_int/long Theodore Ts'o
2017-01-20  5:27   ` Jason A. Donenfeld
2017-01-20 14:28     ` Theodore Ts'o
2017-01-20 15:38       ` Jason A. Donenfeld
2017-01-21  0:10         ` Theodore Ts'o [this message]
2017-01-21  0:13           ` Jason A. Donenfeld
2017-01-20 15:47       ` Jason A. Donenfeld
2017-01-21  0:15         ` Theodore Ts'o
2017-01-21  0:16           ` Jason A. Donenfeld
2017-01-21  6:24             ` Theodore Ts'o
2017-01-21 14:08               ` Jason A. Donenfeld
2017-01-22 11:24                 ` Greg Kroah-Hartman
2017-01-22 12:21                   ` Jason A. Donenfeld
2017-01-22 15:20                     ` Greg Kroah-Hartman
2017-01-22 15:34                       ` Jason A. Donenfeld
2017-01-22 15:34                         ` [PATCH 2/2] random: convert get_random_int/long into get_random_u32/u64 Jason A. Donenfeld
2017-01-22 22:28                       ` [PATCH 1/2] random: use chacha20 for get_random_int/long Theodore Ts'o
2017-01-22 22:49                         ` Jason A. Donenfeld
2017-01-23  0:33                           ` Theodore Ts'o
2017-01-23  8:12                         ` Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2016-12-22 18:07 Jason A. Donenfeld

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=20170121001013.6vtxpuaqplwnvwaz@thunk.org \
    --to=tytso@mit.edu \
    --cc=Jason@zx2c4.com \
    --cc=hannes@stressinduktion.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    /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;
as well as URLs for NNTP newsgroup(s).