mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* jitterentropy: `jent_mod_init()` takes 17 ms
@ 2020-11-09 19:31 Paul Menzel
  2020-11-10  9:25 ` Stephan Mueller
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Menzel @ 2020-11-09 19:31 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Stephan Mueller; +Cc: linux-crypto, linux-kernel

Dear Linux folks,


By mistake I built `XFRM_ESP` into the Linux kernel, resulting in

     CONFIG_CRYPTO_SEQIV=y
     CONFIG_CRYPTO_ECHAINIV=y

and also the Jitterentropy RNG to be built in.

     CRYPTO_JITTERENTROPY=y

So, on the Asus F2A85-M PRO starting Linux 4.10-rc3 with 
`initcall_debug`, the init method is run unconditionally, and it takes 
17.5 ms, which is over ten percent of the overall 900 ms the Linux 
kernel needs until loading the init process.

     [    0.300544] calling  jent_mod_init+0x0/0x2c @ 1
     [    0.318438] initcall jent_mod_init+0x0/0x2c returned 0 after 
17471 usecs

Looking at the output of systemd-bootchart, it looks like, that this 
indeed delayed the boot a little, as the other init methods seem to be 
ordered after it.

I am now building it as a module, but am wondering if the time can be 
reduced to below ten milliseconds.


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: jitterentropy: `jent_mod_init()` takes 17 ms
  2020-11-09 19:31 jitterentropy: `jent_mod_init()` takes 17 ms Paul Menzel
@ 2020-11-10  9:25 ` Stephan Mueller
  2020-11-10  9:37   ` Paul Menzel
  0 siblings, 1 reply; 4+ messages in thread
From: Stephan Mueller @ 2020-11-10  9:25 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Paul Menzel; +Cc: linux-crypto, linux-kernel

Am Montag, 9. November 2020, 20:31:02 CET schrieb Paul Menzel:

Hi Paul,

> Dear Linux folks,
> 
> 
> By mistake I built `XFRM_ESP` into the Linux kernel, resulting in
> 
>      CONFIG_CRYPTO_SEQIV=y
>      CONFIG_CRYPTO_ECHAINIV=y
> 
> and also the Jitterentropy RNG to be built in.
> 
>      CRYPTO_JITTERENTROPY=y
> 
> So, on the Asus F2A85-M PRO starting Linux 4.10-rc3 with
> `initcall_debug`, the init method is run unconditionally, and it takes
> 17.5 ms, which is over ten percent of the overall 900 ms the Linux

Hm, 17.5 / 900 = 2%, or am I missing something?

> kernel needs until loading the init process.
> 
>      [    0.300544] calling  jent_mod_init+0x0/0x2c @ 1
>      [    0.318438] initcall jent_mod_init+0x0/0x2c returned 0 after
> 17471 usecs
> 
> Looking at the output of systemd-bootchart, it looks like, that this
> indeed delayed the boot a little, as the other init methods seem to be
> ordered after it.
> 
> I am now building it as a module, but am wondering if the time can be
> reduced to below ten milliseconds.

What you see is the test whether the Jitter RNG has a proper noise source. The 
function jent_entropy_init() is the cause of the operation. It performs 1024 
times a test to validate the appropriateness of the noise source. You can 
adjust that with the TESTLOOPCOUNT in this function. But I am not sure 
adjusting is a wise course of action.

Ciao
Stephan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: jitterentropy: `jent_mod_init()` takes 17 ms
  2020-11-10  9:25 ` Stephan Mueller
@ 2020-11-10  9:37   ` Paul Menzel
  2020-11-10  9:45     ` Stephan Mueller
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Menzel @ 2020-11-10  9:37 UTC (permalink / raw)
  To: Stephan Mueller, Herbert Xu, David S. Miller; +Cc: linux-crypto, linux-kernel

Dear Stephan,


Thank you for the quick reply.

Am 10.11.20 um 10:25 schrieb Stephan Mueller:
> Am Montag, 9. November 2020, 20:31:02 CET schrieb Paul Menzel:

>> By mistake I built `XFRM_ESP` into the Linux kernel, resulting in
>>
>>       CONFIG_CRYPTO_SEQIV=y
>>       CONFIG_CRYPTO_ECHAINIV=y
>>
>> and also the Jitterentropy RNG to be built in.
>>
>>       CRYPTO_JITTERENTROPY=y
>>
>> So, on the Asus F2A85-M PRO starting Linux 4.10-rc3 with
>> `initcall_debug`, the init method is run unconditionally, and it takes
>> 17.5 ms, which is over ten percent of the overall 900 ms the Linux
> 
> Hm, 17.5 / 900 = 2%, or am I missing something?

Indeed, that is embarrassing. My bad.

>> kernel needs until loading the init process.
>>
>>       [    0.300544] calling  jent_mod_init+0x0/0x2c @ 1
>>       [    0.318438] initcall jent_mod_init+0x0/0x2c returned 0 after 17471 usecs
>>
>> Looking at the output of systemd-bootchart, it looks like, that this
>> indeed delayed the boot a little, as the other init methods seem to be
>> ordered after it.
>>
>> I am now building it as a module, but am wondering if the time can be
>> reduced to below ten milliseconds.
> 
> What you see is the test whether the Jitter RNG has a proper noise source. The
> function jent_entropy_init() is the cause of the operation. It performs 1024
> times a test to validate the appropriateness of the noise source. You can
> adjust that with the TESTLOOPCOUNT in this function. But I am not sure
> adjusting is a wise course of action.

Out of curiosity, why 1024 and not, for example, 128 or 2048? Is there 
some statistics behind it?


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: jitterentropy: `jent_mod_init()` takes 17 ms
  2020-11-10  9:37   ` Paul Menzel
@ 2020-11-10  9:45     ` Stephan Mueller
  0 siblings, 0 replies; 4+ messages in thread
From: Stephan Mueller @ 2020-11-10  9:45 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Paul Menzel; +Cc: linux-crypto, linux-kernel

Am Dienstag, 10. November 2020, 10:37:02 CET schrieb Paul Menzel:

Hi Paul,

> Dear Stephan,
> 
> 
> Thank you for the quick reply.
> 
> Am 10.11.20 um 10:25 schrieb Stephan Mueller:
> > Am Montag, 9. November 2020, 20:31:02 CET schrieb Paul Menzel:
> >> By mistake I built `XFRM_ESP` into the Linux kernel, resulting in
> >> 
> >>       CONFIG_CRYPTO_SEQIV=y
> >>       CONFIG_CRYPTO_ECHAINIV=y
> >> 
> >> and also the Jitterentropy RNG to be built in.
> >> 
> >>       CRYPTO_JITTERENTROPY=y
> >> 
> >> So, on the Asus F2A85-M PRO starting Linux 4.10-rc3 with
> >> `initcall_debug`, the init method is run unconditionally, and it takes
> >> 17.5 ms, which is over ten percent of the overall 900 ms the Linux
> > 
> > Hm, 17.5 / 900 = 2%, or am I missing something?
> 
> Indeed, that is embarrassing. My bad.
> 
> >> kernel needs until loading the init process.
> >> 
> >>       [    0.300544] calling  jent_mod_init+0x0/0x2c @ 1
> >>       [    0.318438] initcall jent_mod_init+0x0/0x2c returned 0 after
> >>       17471 usecs
> >> 
> >> Looking at the output of systemd-bootchart, it looks like, that this
> >> indeed delayed the boot a little, as the other init methods seem to be
> >> ordered after it.
> >> 
> >> I am now building it as a module, but am wondering if the time can be
> >> reduced to below ten milliseconds.
> > 
> > What you see is the test whether the Jitter RNG has a proper noise source.
> > The function jent_entropy_init() is the cause of the operation. It
> > performs 1024 times a test to validate the appropriateness of the noise
> > source. You can adjust that with the TESTLOOPCOUNT in this function. But
> > I am not sure adjusting is a wise course of action.
> 
> Out of curiosity, why 1024 and not, for example, 128 or 2048? Is there
> some statistics behind it?

See [1] section 4.3 bullet 4 is the culprit. The startup test includes the 
referenced test logic.

[1] https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90B.pdf
> 
> 
> Kind regards,
> 
> Paul


Ciao
Stephan



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-10  9:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-09 19:31 jitterentropy: `jent_mod_init()` takes 17 ms Paul Menzel
2020-11-10  9:25 ` Stephan Mueller
2020-11-10  9:37   ` Paul Menzel
2020-11-10  9:45     ` Stephan Mueller

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®