netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sedat Dilek <sedat.dilek@gmail.com>
To: Willy Tarreau <w@1wt.eu>
Cc: George Spelvin <lkml@sdf.org>, Amit Klein <aksecurity@gmail.com>,
	Eric Dumazet <edumazet@google.com>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Andy Lutomirski <luto@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	netdev@vger.kernel.org
Subject: Re: [DRAFT PATCH] random32: make prandom_u32() output unpredictable
Date: Fri, 14 Aug 2020 17:32:32 +0200	[thread overview]
Message-ID: <CA+icZUW8oD6BLnyFUzXHS8fFciLaLQAZnus7GgUdCuSZcMg+MQ@mail.gmail.com> (raw)
In-Reply-To: <20200813080646.GB10907@1wt.eu>

[-- Attachment #1: Type: text/plain, Size: 2163 bytes --]

On Thu, Aug 13, 2020 at 10:06 AM Willy Tarreau <w@1wt.eu> wrote:
>
> On Thu, Aug 13, 2020 at 09:53:11AM +0200, Sedat Dilek wrote:
> > On Wed, Aug 12, 2020 at 5:21 AM Willy Tarreau <w@1wt.eu> wrote:
> > >
> > > On Tue, Aug 11, 2020 at 12:51:43PM +0200, Sedat Dilek wrote:
> > > > Can you share this "rebased to mainline" version of George's patch?
> > >
> > > You can pick it from there if that helps, but keep in mind that
> > > it's just experimental code that we use to explain our ideas and
> > > that we really don't care a single second what kernel it's applied
> > > to:
> > >
> > >    https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/cleanups.git/log/?h=20200811-prandom-1
> > >
> >
> > Thanks Willy.
> >
> > I disagree: the base for testing should be clear(ly communicated).
>
> It is. As you can see on the log above, this was applied on top of
> fc80c51fd4b2, there's nothing special here. In addition we're not even
> talking about testing nor calling for testers, just trying to find a
> reasonable solution. Maybe today I'll be able to re-run a few tests by
> the way.
>
> > There are two diffs from Eric to #1: add a trace event for
> > prandom_u32() and #2: a removal of prandom_u32() call in
> > tcp_conn_request().
> > In case you have not seen.
>
> I've seen, just not had the time to test yet.
>

Now with Eric' patch (see [1]) in mainline...

commit 94c7eb54c4b8e81618ec79f414fe1ca5767f9720
"random32: add a tracepoint for prandom_u32()"

...I gave Willy's patches a try and used the Linux Test Project (LTP)
for testing.

[ PERF SESSION #2 ]

Link: https://github.com/linux-test-project/ltp/blob/master/doc/mini-howto-building-ltp-from-git.txt

cd /opt/ltp

/home/dileks/bin/perf record -a -g -e random:prandom_u32 ./runltp -f
net.features -s tcp_fastopen

/home/dileks/bin/perf report --no-children --stdio > ./perf-report.txt
/home/dileks/bin/perf script > ./perf-script.txt

du -h perf*
34M     perf.data
20K     perf-report.txt
134M    perf-script.txt

Note: For a first test I used net.features::tcp_fastopen.

Attached is my perf-report.txt.

- Sedat -

[1] https://git.kernel.org/linus/94c7eb54c4b8e81618ec79f414fe1ca5767f9720

[-- Attachment #2: perf-report.txt --]
[-- Type: text/plain, Size: 20177 bytes --]

# To display the perf.data header info, please use --header/--header-only options.
#
#
# Total Lost Samples: 0
#
# Samples: 120K of event 'random:prandom_u32'
# Event count (approx.): 120452
#
# Overhead  Command          Shared Object      Symbol         
# ........  ...............  .................  ...............
#
    58.22%  netstress        [kernel.kallsyms]  [k] prandom_u32
            |
            ---prandom_u32
               prandom_u32
               |          
               |--33.22%--tcp_v4_connect
               |          __inet_stream_connect
               |          |          
               |          |--22.15%--inet_stream_connect
               |          |          __sys_connect
               |          |          __x64_sys_connect
               |          |          do_syscall_64
               |          |          entry_SYSCALL_64_after_hwframe
               |          |          __libc_connect
               |          |          0x65736e7500632e73
               |          |          
               |           --11.07%--tcp_sendmsg_locked
               |                     tcp_sendmsg
               |                     sock_sendmsg
               |                     __sys_sendto
               |                     __x64_sys_sendto
               |                     do_syscall_64
               |                     entry_SYSCALL_64_after_hwframe
               |                     __libc_sendto
               |          
               |--16.61%--tcp_v6_connect
               |          __inet_stream_connect
               |          |          
               |          |--11.07%--inet_stream_connect
               |          |          __sys_connect
               |          |          __x64_sys_connect
               |          |          do_syscall_64
               |          |          entry_SYSCALL_64_after_hwframe
               |          |          __libc_connect
               |          |          0x65736e7500632e73
               |          |          
               |           --5.54%--tcp_sendmsg_locked
               |                     tcp_sendmsg
               |                     sock_sendmsg
               |                     __sys_sendto
               |                     __x64_sys_sendto
               |                     do_syscall_64
               |                     entry_SYSCALL_64_after_hwframe
               |                     __libc_sendto
               |          
               |--5.24%--tcp_conn_request
               |          tcp_rcv_state_process
               |          |          
               |          |--3.26%--tcp_v4_do_rcv
               |          |          tcp_v4_rcv
               |          |          ip_protocol_deliver_rcu
               |          |          ip_local_deliver_finish
               |          |          __netif_receive_skb_one_core
               |          |          process_backlog
               |          |          net_rx_action
               |          |          __softirqentry_text_start
               |          |          asm_call_on_stack
               |          |          do_softirq_own_stack
               |          |          |          
               |          |          |--2.03%--irq_exit_rcu
               |          |          |          sysvec_apic_timer_interrupt
               |          |          |          asm_sysvec_apic_timer_interrupt
               |          |          |          
               |          |           --1.23%--do_softirq
               |          |                     __local_bh_enable_ip
               |          |                     |          
               |          |                      --1.19%--ip_finish_output2
               |          |                                __ip_queue_xmit
               |          |                                __tcp_transmit_skb
               |          |                                |          
               |          |                                 --1.13%--tcp_write_xmit
               |          |                                           __tcp_push_pending_frames
               |          |                                           |          
               |          |                                            --0.95%--tcp_sendmsg_locked
               |          |                                                      tcp_sendmsg
               |          |                                                      sock_sendmsg
               |          |                                                      |          
               |          |                                                       --0.59%--__sys_sendto
               |          |                                                                 __x64_sys_sendto
               |          |                                                                 do_syscall_64
               |          |                                                                 entry_SYSCALL_64_after_hwframe
               |          |          
               |           --1.99%--tcp_v6_do_rcv
               |                     tcp_v6_rcv
               |                     ip6_protocol_deliver_rcu
               |                     ip6_input
               |                     __netif_receive_skb_one_core
               |                     process_backlog
               |                     net_rx_action
               |                     __softirqentry_text_start
               |                     asm_call_on_stack
               |                     do_softirq_own_stack
               |                     |          
               |                     |--1.27%--irq_exit_rcu
               |                     |          sysvec_apic_timer_interrupt
               |                     |          asm_sysvec_apic_timer_interrupt
               |                     |          
               |                      --0.71%--do_softirq
               |                                __local_bh_enable_ip
               |                                |          
               |                                 --0.68%--ip6_finish_output2
               |                                           ip6_xmit
               |                                           inet6_csk_xmit
               |                                           __tcp_transmit_skb
               |                                           |          
               |                                            --0.62%--tcp_write_xmit
               |                                                      __tcp_push_pending_frames
               |                                                      |          
               |                                                       --0.53%--tcp_sendmsg_locked
               |                                                                 tcp_sendmsg
               |                                                                 sock_sendmsg
               |          
                --3.13%--tcp_v4_syn_recv_sock
                          tcp_v6_syn_recv_sock
                          |          
                          |--2.61%--tcp_try_fastopen
                          |          tcp_conn_request
                          |          tcp_rcv_state_process
                          |          tcp_v4_do_rcv
                          |          tcp_v4_rcv
                          |          ip_protocol_deliver_rcu
                          |          ip_local_deliver_finish
                          |          __netif_receive_skb_one_core
                          |          process_backlog
                          |          net_rx_action
                          |          __softirqentry_text_start
                          |          asm_call_on_stack
                          |          do_softirq_own_stack
                          |          |          
                          |          |--1.66%--irq_exit_rcu
                          |          |          sysvec_apic_timer_interrupt
                          |          |          asm_sysvec_apic_timer_interrupt
                          |          |          
                          |           --0.95%--do_softirq
                          |                     __local_bh_enable_ip
                          |                     |          
                          |                      --0.92%--ip_finish_output2
                          |                                __ip_queue_xmit
                          |                                __tcp_transmit_skb
                          |                                |          
                          |                                 --0.87%--tcp_write_xmit
                          |                                           __tcp_push_pending_frames
                          |                                           |          
                          |                                            --0.72%--tcp_sendmsg_locked
                          |                                                      tcp_sendmsg
                          |                                                      sock_sendmsg
                          |          
                           --0.52%--tcp_check_req
                                     tcp_v4_rcv
                                     ip_protocol_deliver_rcu
                                     ip_local_deliver_finish
                                     __netif_receive_skb_one_core
                                     process_backlog
                                     net_rx_action
                                     __softirqentry_text_start
                                     asm_call_on_stack
                                     do_softirq_own_stack

    37.93%  swapper          [kernel.kallsyms]  [k] prandom_u32
            |
            ---prandom_u32
               prandom_u32
               |          
               |--25.55%--tcp_conn_request
               |          tcp_rcv_state_process
               |          |          
               |          |--13.54%--tcp_v6_do_rcv
               |          |          tcp_v6_rcv
               |          |          ip6_protocol_deliver_rcu
               |          |          ip6_input
               |          |          __netif_receive_skb_one_core
               |          |          process_backlog
               |          |          net_rx_action
               |          |          __softirqentry_text_start
               |          |          asm_call_on_stack
               |          |          do_softirq_own_stack
               |          |          irq_exit_rcu
               |          |          sysvec_apic_timer_interrupt
               |          |          asm_sysvec_apic_timer_interrupt
               |          |          |          
               |          |          |--12.41%--cpuidle_enter_state
               |          |          |          cpuidle_enter
               |          |          |          do_idle
               |          |          |          cpu_startup_entry
               |          |          |          |          
               |          |          |          |--9.59%--start_secondary
               |          |          |          |          secondary_startup_64
               |          |          |          |          
               |          |          |           --2.82%--start_kernel
               |          |          |                     secondary_startup_64
               |          |          |          
               |          |           --0.68%--poll_idle
               |          |                     cpuidle_enter_state
               |          |                     cpuidle_enter
               |          |                     do_idle
               |          |                     cpu_startup_entry
               |          |                     |          
               |          |                      --0.52%--start_secondary
               |          |                                secondary_startup_64
               |          |          
               |           --12.02%--tcp_v4_do_rcv
               |                     tcp_v4_rcv
               |                     ip_protocol_deliver_rcu
               |                     ip_local_deliver_finish
               |                     __netif_receive_skb_one_core
               |                     process_backlog
               |                     net_rx_action
               |                     __softirqentry_text_start
               |                     asm_call_on_stack
               |                     do_softirq_own_stack
               |                     irq_exit_rcu
               |                     sysvec_apic_timer_interrupt
               |                     asm_sysvec_apic_timer_interrupt
               |                     |          
               |                     |--10.71%--cpuidle_enter_state
               |                     |          cpuidle_enter
               |                     |          do_idle
               |                     |          cpu_startup_entry
               |                     |          |          
               |                     |          |--8.21%--start_secondary
               |                     |          |          secondary_startup_64
               |                     |          |          
               |                     |           --2.50%--start_kernel
               |                     |                     secondary_startup_64
               |                     |          
               |                      --0.77%--poll_idle
               |                                cpuidle_enter_state
               |                                cpuidle_enter
               |                                do_idle
               |                                cpu_startup_entry
               |                                |          
               |                                 --0.60%--start_secondary
               |                                           secondary_startup_64
               |          
                --12.36%--tcp_v4_syn_recv_sock
                          tcp_v6_syn_recv_sock
                          |          
                          |--7.54%--tcp_try_fastopen
                          |          tcp_conn_request
                          |          tcp_rcv_state_process
                          |          tcp_v4_do_rcv
                          |          tcp_v4_rcv
                          |          ip_protocol_deliver_rcu
                          |          ip_local_deliver_finish
                          |          __netif_receive_skb_one_core
                          |          process_backlog
                          |          net_rx_action
                          |          __softirqentry_text_start
                          |          asm_call_on_stack
                          |          do_softirq_own_stack
                          |          irq_exit_rcu
                          |          sysvec_apic_timer_interrupt
                          |          asm_sysvec_apic_timer_interrupt
                          |          |          
                          |           --6.76%--cpuidle_enter_state
                          |                     cpuidle_enter
                          |                     do_idle
                          |                     cpu_startup_entry
                          |                     |          
                          |                     |--5.11%--start_secondary
                          |                     |          secondary_startup_64
                          |                     |          
                          |                      --1.65%--start_kernel
                          |                                secondary_startup_64
                          |          
                           --4.82%--tcp_check_req
                                     tcp_v4_rcv
                                     ip_protocol_deliver_rcu
                                     ip_local_deliver_finish
                                     __netif_receive_skb_one_core
                                     process_backlog
                                     net_rx_action
                                     __softirqentry_text_start
                                     asm_call_on_stack
                                     do_softirq_own_stack
                                     irq_exit_rcu
                                     sysvec_apic_timer_interrupt
                                     asm_sysvec_apic_timer_interrupt
                                     |          
                                      --4.59%--cpuidle_enter_state
                                                cpuidle_enter
                                                do_idle
                                                cpu_startup_entry
                                                |          
                                                |--3.63%--start_secondary
                                                |          secondary_startup_64
                                                |          
                                                 --0.95%--start_kernel
                                                           secondary_startup_64

     0.78%  ksoftirqd/1      [kernel.kallsyms]  [k] prandom_u32
            |
            ---prandom_u32
               prandom_u32

     0.76%  ksoftirqd/0      [kernel.kallsyms]  [k] prandom_u32
            |
            ---prandom_u32
               prandom_u32

     0.76%  ksoftirqd/3      [kernel.kallsyms]  [k] prandom_u32
            |
            ---prandom_u32
               prandom_u32

     0.71%  ksoftirqd/2      [kernel.kallsyms]  [k] prandom_u32
            |
            ---prandom_u32
               prandom_u32

     0.20%  kworker/3:3-eve  [kernel.kallsyms]  [k] prandom_u32
     0.17%  kworker/1:1-eve  [kernel.kallsyms]  [k] prandom_u32
     0.15%  kworker/2:2-eve  [kernel.kallsyms]  [k] prandom_u32
     0.12%  kworker/0:7-eve  [kernel.kallsyms]  [k] prandom_u32
     0.06%  Xorg             [kernel.kallsyms]  [k] prandom_u32
     0.04%  ip               [kernel.kallsyms]  [k] prandom_u32
     0.03%  avahi-daemon     [kernel.kallsyms]  [k] prandom_u32
     0.02%  perf             [kernel.kallsyms]  [k] prandom_u32
     0.01%  mysqld           [kernel.kallsyms]  [k] prandom_u32
     0.01%  tcp_fastopen_ru  [kernel.kallsyms]  [k] prandom_u32
     0.00%  irq/35-iwlwifi   [kernel.kallsyms]  [k] prandom_u32
     0.00%  rcu_sched        [kernel.kallsyms]  [k] prandom_u32
     0.00%  dbus-daemon      [kernel.kallsyms]  [k] prandom_u32
     0.00%  ltp-pan          [kernel.kallsyms]  [k] prandom_u32
     0.00%  kworker/u16:3-i  [kernel.kallsyms]  [k] prandom_u32
     0.00%  mktemp           [kernel.kallsyms]  [k] prandom_u32
     0.00%  QSGRenderThread  [kernel.kallsyms]  [k] prandom_u32
     0.00%  gdbus            [kernel.kallsyms]  [k] prandom_u32
     0.00%  jbd2/sdc2-8      [kernel.kallsyms]  [k] prandom_u32
     0.00%  kded5            [kernel.kallsyms]  [k] prandom_u32
     0.00%  konsole          [kernel.kallsyms]  [k] prandom_u32
     0.00%  kworker/1:0-eve  [kernel.kallsyms]  [k] prandom_u32
     0.00%  kworker/2:0-eve  [kernel.kallsyms]  [k] prandom_u32
     0.00%  runltp           [kernel.kallsyms]  [k] prandom_u32
     0.00%  systemd-journal  [kernel.kallsyms]  [k] prandom_u32
     0.00%  xdg-desktop-por  [kernel.kallsyms]  [k] prandom_u32
     0.00%  sh               [kernel.kallsyms]  [k] prandom_u32


# Samples: 0  of event 'dummy:HG'
# Event count (approx.): 0
#
# Overhead  Command  Shared Object  Symbol
# ........  .......  .............  ......
#


#
# (Tip: To show assembler sample contexts use perf record -b / perf script -F +brstackinsn --xed)
#

  parent reply	other threads:[~2020-08-14 15:32 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CA+icZUVnsmf1kXPYFYufStQ_MxnLuxL+EWfDS2wQy1VbAEMwkA@mail.gmail.com>
2020-08-09 21:10 ` [DRAFT PATCH] random32: make prandom_u32() output unpredictable Sedat Dilek
     [not found] ` <20200809235412.GD25124@SDF.ORG>
     [not found]   ` <20200810034948.GB8262@1wt.eu>
     [not found]     ` <20200811053455.GH25124@SDF.ORG>
     [not found]       ` <20200811054328.GD9456@1wt.eu>
     [not found]         ` <20200811062814.GI25124@SDF.ORG>
     [not found]           ` <20200811074538.GA9523@1wt.eu>
2020-08-11 10:51             ` Sedat Dilek
2020-08-11 11:01               ` Sedat Dilek
2020-08-12  3:21               ` Willy Tarreau
2020-08-13  7:53                 ` Sedat Dilek
2020-08-13  8:06                   ` Willy Tarreau
2020-08-13  8:13                     ` Sedat Dilek
2020-08-13  8:27                       ` Sedat Dilek
2020-08-13 14:00                         ` Eric Dumazet
2020-08-13 16:02                           ` Sedat Dilek
2020-08-14 15:32                     ` Sedat Dilek [this message]
2020-08-14 16:05                       ` Willy Tarreau
2020-08-14 16:17                         ` Sedat Dilek
2020-08-16 15:01                           ` Willy Tarreau
2020-08-16 16:48                             ` Sedat Dilek
2020-08-20  3:05                               ` Sedat Dilek
2020-08-20  4:33                                 ` Willy Tarreau
2020-08-20  4:42                                   ` Sedat Dilek
2020-08-20  6:08                                     ` Willy Tarreau
2020-08-20  6:58                                       ` Willy Tarreau
2020-08-20  8:05                                         ` Willy Tarreau
2020-08-20 12:08                                           ` Sedat Dilek
     [not found]                                           ` <CANEQ_+L+22Hkdqf38Zr0bfq16fcL1Ax2X9fToXV_niHKXCB8aA@mail.gmail.com>
2020-08-27  1:09                                             ` Willy Tarreau
2020-08-27  7:08                                               ` Sedat Dilek
2020-08-08 15:26 Flaw in "random32: update the net random state on interrupt and activity" George Spelvin
2020-08-09  6:57 ` [DRAFT PATCH] random32: make prandom_u32() output unpredictable George Spelvin
2020-08-09  9:38   ` Willy Tarreau
2020-08-09 17:06     ` George Spelvin
2020-08-09 17:33       ` Willy Tarreau
2020-08-09 18:30         ` George Spelvin
2020-08-09 19:16           ` Willy Tarreau
2020-08-10 11:47           ` Willy Tarreau
2020-08-10 12:01             ` David Laight
2020-08-10 14:48               ` Willy Tarreau
2020-08-10 12:03             ` Florian Westphal
2020-08-10 14:53               ` Willy Tarreau
2020-08-10 16:31             ` Linus Torvalds
2020-08-10 16:58               ` Willy Tarreau
2020-08-10 17:45                 ` Linus Torvalds
2020-08-10 18:01                   ` Willy Tarreau
2020-08-10 21:04                   ` Willy Tarreau
2020-08-11  5:26                     ` George Spelvin
2020-08-11  5:37                       ` Willy Tarreau
2020-08-11  3:47             ` George Spelvin
2020-08-11  3:58               ` Willy Tarreau
     [not found]     ` <fdbc7d7d-cba2-ef94-9bde-b3ccae0cfaac@gmail.com>
2020-08-09 21:10       ` Marc Plumb
2020-08-09 21:48         ` Linus Torvalds
2020-08-09 13:50   ` Randy Dunlap
     [not found]   ` <CANEQ_++a4YcwQQ2XhuguTono9=RxbSRVsMw08zLWBWJ_wxG2AQ@mail.gmail.com>
2020-08-09 16:08     ` George Spelvin

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=CA+icZUW8oD6BLnyFUzXHS8fFciLaLQAZnus7GgUdCuSZcMg+MQ@mail.gmail.com \
    --to=sedat.dilek@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=aksecurity@gmail.com \
    --cc=edumazet@google.com \
    --cc=keescook@chromium.org \
    --cc=lkml@sdf.org \
    --cc=luto@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=w@1wt.eu \
    /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).