From: Stephan Mueller <smueller@chronox.de>
To: Shankari <beingcap11@gmail.com>, Francesco Valla <francesco@valla.it>
Cc: Linux Embedded <linux-embedded@vger.kernel.org>,
"Bird, Tim" <Tim.Bird@sony.com>
Subject: Re: [boot-time] jent_mod_init on beagleplay (was RE: [boot-time] [RFC] analyze-initcall-debug.py - a tool to analyze the initcall debug output
Date: Thu, 02 Jan 2025 13:56:59 +0100 [thread overview]
Message-ID: <2972828.e9J7NaK4W3@tauon> (raw)
In-Reply-To: <2736774.vuYhMxLoTh@fedora.fritz.box>
Am Donnerstag, 2. Januar 2025, 11:33:08 CET schrieb Francesco Valla:
Hi Francesco,
> That would be wonderful! Whenever you have the time, please let me know what
> analysis you need.
>
Ok, some background: the Jitter RNG technically has 2 noise sources which are
sampled concurrently:
1. variations of the execution of CPU instructions
2. variations of memory access times
For (1) the Jitter RNG has a fixed set of instructions it performs the
execution time measurements for: the SHA-3 conditioning operation
(specifically the Keccak sponge function). For that, it performs a given set
of Keccak operations.
For (2) the Jitter RNG allocates a fixed set of memory and simply reads /
writes data there and measures this timing.
For (1), the more instructions are samples, the higher the entropy gathered.
This means more time is required to sample that entropy. I.e. when you
increase the number of measured Keccak operations, you get more entropy.
For (2), when the memory is large enough to "spill over" into the next type of
memory (from L1 to L2 to L3 to RAM), the higher the entropy gathered.
So, for (2), to get more entropy, is invariant from the execution time. But
for (1), the entropy rate depends on the execution time.
Thus, what you want is to try to reduce the time spend for (1).
The key now is that the overall entropy rate the Jitter RNG requires for
functioning must be such that when gathering 256 bits of data from it, it
contains 256 bits of entropy.
Now, there are 2 "knobs" to turn via Kconfig:
- the oversampling rate (OSR): given that the individual number of rounds for
(1) and the number of accesses for (2) are kept the same, the OSR causes the
Jitter RNG to multiply the round counts. For example, the baseline with OSR ==
1 is that for gathering 256 bits of entropy, 256 times both noise sources are
sampled. For an OSR of, say, 3, to get 256 bits of entropy, 3 * 256 = 768
times both noise sources are sampled. This value was changed from 1 to 3 for
6.11 because there were reports on some CPUs that the Jitter RNG did not
produce sufficient entropy - most CPUs, however, can perfectly live with OSR
== 1.
- the amount of memory for (2) can be increased. The default is 2kBytes which
usually means that the L1 can fully handle the accesses.
======
Now given the description, what can you do? I would apply the following steps:
1. measure whether the timer your system has is really a high-res timer (the
higher the resolution, the higher the detected variations and thus the
entropy)
2. assuming that test 1 shows a high res timer, reduce the OSR back to 1
(CRYPTO_JITTERENTROPY_OSR) and measure the entropy rate -
3. if test 2 shows insufficient entropy, increase the amount of memory
(CRYPTO_JITTERENTROPY_MEMSIZE_*) and measure the entropy rate
The tool for measuring the entropy rate is given in [1] - check the README as
you need to enable a kernel config option to get an interface into the Jitter
RNG from user space. As you may not have the analysis tool, you may give the
data to me and I can analyze it.
More details on tuning the Jitter RNG is given in [2] - it discusses to the
user space variant, but applies to kernel as well.
[1] https://github.com/smuellerDD/jitterentropy-library/tree/master/tests/raw-entropy/recording_runtime_kernelspace
[2] https://github.com/smuellerDD/jitterentropy-library/tree/master/tests/raw-entropy#approach-to-solve-insufficient-entropy
Ciao
Stephan
next prev parent reply other threads:[~2025-01-02 12:57 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 23:35 [boot-time] [RFC] analyze-initcall-debug.py - a tool to analyze the initcall debug output Francesco Valla
2024-12-03 20:33 ` Bird, Tim
2024-12-05 12:57 ` Francesco Valla
2024-12-05 14:58 ` Geert Uytterhoeven
2024-12-05 21:36 ` Francesco Valla
2024-12-09 3:10 ` [RFC PATCH] boot-time: instrument probes more Bird, Tim
2024-12-21 14:47 ` Francesco Valla
2024-12-29 17:45 ` Francesco Valla
2024-12-03 21:24 ` [boot-time] jent_mod_init on beagleplay (was RE: [boot-time] [RFC] analyze-initcall-debug.py - a tool to analyze the initcall debug output Bird, Tim
2024-12-05 7:02 ` Stephan Mueller
[not found] ` <CAORPcfUfgNnQb6m0baW9qEGnrGYsnbpvwUUmF5Y9Byh9_iMAZw@mail.gmail.com>
2024-12-30 22:35 ` Francesco Valla
2024-12-31 9:55 ` Stephan Müller
2024-12-31 14:42 ` Francesco Valla
2025-01-02 9:06 ` Stephan Mueller
2025-01-02 10:33 ` Francesco Valla
2025-01-02 12:56 ` Stephan Mueller [this message]
2025-01-03 17:23 ` Francesco Valla
2025-01-04 15:45 ` Stephan Müller
2025-01-07 22:40 ` Bird, Tim
2025-01-07 21:42 ` boot markers ideas (was RE: [boot-time] jent_mod_init on beagleplay) Bird, Tim
2025-01-07 23:40 ` Rob Landley
2025-01-09 16:23 ` Francesco Valla
2024-12-30 22:22 ` [boot-time] jent_mod_init on beagleplay (was RE: [boot-time] [RFC] analyze-initcall-debug.py - a tool to analyze the initcall debug output Francesco Valla
2025-01-07 21:27 ` Bird, Tim
2024-12-04 0:29 ` Bird, Tim
2024-12-05 13:05 ` Francesco Valla
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=2972828.e9J7NaK4W3@tauon \
--to=smueller@chronox.de \
--cc=Tim.Bird@sony.com \
--cc=beingcap11@gmail.com \
--cc=francesco@valla.it \
--cc=linux-embedded@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 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).