From: Oliver Xymoron <oxymoron@waste.org>
To: johan.adolfsson@axis.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] Improved add_timer_randomness for __CRIS__ (instead of rdtsc())
Date: Tue, 20 Aug 2002 09:03:46 -0500 [thread overview]
Message-ID: <20020820140346.GC19225@waste.org> (raw)
In-Reply-To: <01a301c2482c$51a00e40$b9b270d5@homeip.net>
On Tue, Aug 20, 2002 at 11:31:10AM +0200, johan.adolfsson@axis.com wrote:
> The cris architecture don't have any tsc, but it has a couple of
> timer registers that can be used to get better than jiffie resolution.
>
> I set the time to a 40 us resolution counter with a slight
> "jump" since lower 8 bit only counts from 0 to 249,
> the patch does not take wrapping of the register into account either
> to save some cycles, is that a problem or a good thing?
That should be fine. More important is actually scaling the entropy
count based on the timing granularity of the source. Keyboards and
mice tend to have a granularity of about 1khz so timestamps better
than milliseconds 'invent' entropy in the current code.
> The num is xor:d with the value from 2 timer registers,
> which in turn contains different fields breifly described below.
>
> Does the patch below look sane?
Looks fine, but I think we want to come up with a cleaner scheme of
having per-arch high-res timestamps. I'd hate to have that grow to
several pages of ifdefs and not have it available anywhere else.
> +++ random.c 20 Aug 2002 09:10:04 -0000
> @@ -746,6 +746,15 @@ static void add_timer_randomness(struct
> __u32 high;
> rdtsc(time, high);
> num ^= high;
> +#elif defined (__CRIS__)
> + /* R_TIMER0_DATA, 8 bit, 40 us resolution, counting down from 250 */
> + /* R_TIMER_DATA, 4*8 bit, timer1, timer0, 38.4kHz, 7.3728MHz */
> + /* R_PRESCALE_STATUS, upper 16 bit: 320ns resolution,
> + lower 16 bit: 40 ns resolution, ~10 bits used,
> + counting down from 1000 */
> + time = jiffies << 8;
> + time |= (TIMER0_DIV - *R_TIMER0_DATA);
> + num ^= *R_PRESCALE_STATUS ^ *R_TIMER_DATA;
> #else
> time = jiffies;
> #endif
--
"Love the dolphins," she advised him. "Write by W.A.S.T.E.."
next prev parent reply other threads:[~2002-08-20 13:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-20 9:31 [RFC] Improved add_timer_randomness for __CRIS__ (instead of rdtsc()) johan.adolfsson
2002-08-20 14:03 ` Oliver Xymoron [this message]
2002-08-20 16:32 ` johan.adolfsson
2002-08-20 17:06 ` Oliver Xymoron
2002-08-20 17:34 ` johan.adolfsson
2002-08-20 18:02 ` Oliver Xymoron
2002-08-20 19:20 ` johan.adolfsson
2002-08-20 19:34 ` Oliver Xymoron
2002-08-20 22:17 ` johan.adolfsson
2002-08-20 23:00 ` Oliver Xymoron
2002-08-21 9:11 ` johan.adolfsson
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=20020820140346.GC19225@waste.org \
--to=oxymoron@waste.org \
--cc=johan.adolfsson@axis.com \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.