public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Noah Goldstein <goldstein.w.n@gmail.com>
Cc: GNU C Library <libc-alpha@sourceware.org>,
	Florian Weimer <fweimer@redhat.com>,
	Yann Droneaud <ydroneaud@opteya.com>
Subject: Re: [PATCH v8 9/9] manual: Add documentation for arc4random functions
Date: Thu, 30 Jun 2022 16:37:40 -0300	[thread overview]
Message-ID: <31849D69-B9BC-466E-A972-6BCE8DCAC0C3@linaro.org> (raw)
In-Reply-To: <CAFUsyfKjXPg5GtQjkwdLyth1025NMwLntzKC3w=eCuDCR5S+Dg@mail.gmail.com>



> On 29 Jun 2022, at 19:05, Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> 
> On Wed, Jun 29, 2022 at 2:53 PM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>> 
>> 
>> 
>>> On 29 Jun 2022, at 18:45, Noah Goldstein <goldstein.w.n@gmail.com> wrote:
>>> 
>>> On Wed, Jun 29, 2022 at 2:36 PM Adhemerval Zanella via Libc-alpha
>>> <libc-alpha@sourceware.org> wrote:
>>>> 
>>>> ---
>>>> manual/math.texi | 45 +++++++++++++++++++++++++++++++++++++++++++++
>>>> 1 file changed, 45 insertions(+)
>>>> 
>>>> diff --git a/manual/math.texi b/manual/math.texi
>>>> index 477a18b6d1..ab96726e57 100644
>>>> --- a/manual/math.texi
>>>> +++ b/manual/math.texi
>>>> @@ -1447,6 +1447,7 @@ systems.
>>>> * ISO Random:: @code{rand} and friends.
>>>> * BSD Random:: @code{random} and friends.
>>>> * SVID Random:: @code{drand48} and friends.
>>>> +* High Quality Random:: @code{arc4random} and friends.
>>>> @end menu
>>>> 
>>>> @node ISO Random
>>>> @@ -1985,6 +1986,50 @@ This function is a GNU extension and should not be used in portable
>>>> programs.
>>>> @end deftypefun
>>>> 
>>>> +@node High Quality Random
>>>> +@subsection High Quality Random Number Functions
>>>> +
>>>> +This section describes the random number functions provided as a GNU
>>>> +extension, based on OpenBSD interfaces.
>>>> +
>>>> +@Theglibc{} uses kernel entropy obtained either through @code{getrandom}
>>>> +or by reading @file{/dev/urandom} to seed and periodically re-seed the
>>>> +internal state. A per-thread data pool is used, which allows fast output
>>>> +generation.
>>>> +
>>> 
>>> Are we committing to per-thread data pools? I thought there were ideas to
>>> use rseq.
>> 
>> For this version yes, since it works on all supported kernels (even for the
>> ones without getentropy support) and on all architectures.  I do not know how
>> feasible it would be to implement per-cpu caches along with rseq and it would
>> require a fallback for older kernel (most likely a per-thread cache as this
>> version), although it might be future improvement.
> 
> I guess do we want to explicitly say per-thread buffer if we may want
> to experiment
> with something else?
> 
> Just seems like the kind of thing that might make it impossible to re-implement
> another way.
> 
> What about something like:
> 
> "The data-pool is implemented to minimize cross-core contention
> allowing fast output generation”?

I take the idea is to avoid adding too much implementation detail to manual,
although I take that documentation and arc4random specification does not
define performance or complexity details (as for some STL containers for
instance). If we even change the arc4random implementation I would expect
to update this documentation description.

But iIt does make sense to define expectations, so I will update with your
suggestion (and Yann remarks).



  parent reply	other threads:[~2022-06-30 19:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29 21:34 [PATCH v8 0/9] Add arc4random support Adhemerval Zanella
2022-06-29 21:34 ` [PATCH v8 1/9] stdlib: Add arc4random, arc4random_buf, and arc4random_uniform (BZ #4417) Adhemerval Zanella
2022-07-12  8:57   ` Florian Weimer
2022-07-12 16:57     ` Adhemerval Zanella Netto
2022-07-12 17:15       ` Florian Weimer
2022-07-12 17:21         ` Adhemerval Zanella Netto
2022-06-29 21:34 ` [PATCH v8 2/9] stdlib: Add arc4random tests Adhemerval Zanella
2022-07-12  9:20   ` Florian Weimer
2022-07-12 17:17     ` Adhemerval Zanella Netto
2022-06-29 21:34 ` [PATCH v8 3/9] benchtests: Add arc4random benchtest Adhemerval Zanella
2022-07-12  9:29   ` Florian Weimer
2022-07-12 17:26     ` Adhemerval Zanella Netto
2022-06-29 21:34 ` [PATCH v8 4/9] aarch64: Add optimized chacha20 Adhemerval Zanella
2022-07-12  9:30   ` Florian Weimer
2022-06-29 21:34 ` [PATCH v8 5/9] x86: Add SSE2 " Adhemerval Zanella
2022-06-29 21:34 ` [PATCH v8 6/9] x86: Add AVX2 " Adhemerval Zanella
2022-06-29 21:34 ` [PATCH v8 7/9] powerpc64: Add " Adhemerval Zanella
2022-06-29 21:34 ` [PATCH v8 8/9] s390x: " Adhemerval Zanella
2022-06-29 21:34 ` [PATCH v8 9/9] manual: Add documentation for arc4random functions Adhemerval Zanella
2022-06-29 21:45   ` Noah Goldstein
2022-06-29 21:53     ` Adhemerval Zanella
2022-06-29 22:05       ` Noah Goldstein
2022-06-30  7:58         ` Yann Droneaud
2022-06-30 19:37         ` Adhemerval Zanella [this message]
2022-06-29 21:55   ` Adhemerval Zanella
2022-07-12  9:31 ` [PATCH v8 0/9] Add arc4random support Florian Weimer
2022-07-12 17:36   ` Adhemerval Zanella Netto

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=31849D69-B9BC-466E-A972-6BCE8DCAC0C3@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=goldstein.w.n@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=ydroneaud@opteya.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).