Reposting in case any missed it the first time

On Wed, Dec 31, 2008 at 11:07 AM, Asif Iqbal <vad...@gmail.com> wrote:
> Is there a patch for for version 2.0.4?
>
> Tried to apply the patch (both in Linux and Solaris using GNU patch)
> from here http://kerneltrap.org/Linux/Finding_Bugs_With_CFS
>
> iqb...@ghar-iqbala:~/src/iperf-2.0.4$ patch -p1 < ../iperf-cpu-usage-fix-patch
> patching file compat/Thread.c
> Hunk #1 FAILED at 405.
> 1 out of 1 hunk FAILED -- saving rejects to file compat/Thread.c.rej
> patching file src/Reporter.c
> Hunk #1 succeeded at 113 with fuzz 2 (offset 2 lines).
> Hunk #2 succeeded at 341 (offset 2 lines).
> Hunk #3 succeeded at 349 with fuzz 1 (offset 2 lines).
> Hunk #4 succeeded at 568 (offset 14 lines).
> Hunk #5 FAILED at 591.
> 1 out of 5 hunks FAILED -- saving rejects to file src/Reporter.c.rej
> patching file src/main.cpp
> Hunk #2 succeeded at 143 (offset 1 line).
>
>
> Linux: ubuntu 8.10
>
> strace shows it is waiting
>
> # ./src/iperf -s -D -w 256k
> Running Iperf Server as a daemon
> The Iperf daemon process ID : 15812
>
> # strace -p 15812
> Process 15812 attached - interrupt to quit
> accept(3, {sa_family=AF_INET, sin_port=htons(35687),
> sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
> getsockname(0, {sa_family=AF_INET, sin_port=htons(5001),
> sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
> recv(0, "\0\0\0\0\0\0\0\1\0\0\23\211\0\0\0\0\0\0\0\0\377\377\374"...,
> 24, 0) = 24
> mmap2(NULL, 8392704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
> -1, 0) = 0xb6d22000
> mprotect(0xb6d22000, 4096, PROT_NONE)   = 0
> clone(child_stack=0xb75224b4,
> flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,
> parent_tidptr=0xb7522bd8, {entry_number:6, base_addr:0xb7522b90,
> limit:1048575, seg_32bit:1, contents:0, read_exec_only:0,
> limit_in_pages:1, seg_not_present:0, useable:1},
> child_tidptr=0xb7522bd8) = 15829
> accept(3,
>
> Solaris 10:
>
> # /usr/local/bin/iperf -s -D -w 256k
> # pstack 29619
> 29619:  /usr/local/bin/iperf -s -D -w 256k
>  ff0457b0 accept   (3, 32c00, 32d00, 1)
>  00015e2c _ZN8Listener3RunEv (30290, 2f990, 0, 2f800, ffffffff, 30890) + a4
>  00014e94 listener_spawn (2fd58, 0, ff073700, 0, feed0200, 1) + 60
>  0001befc thread_run_wrapper (2fd58, fee7c000, 0, 0, 1be20, 1) + dc
>  ff045238 _lwp_start (0, 0, 0, 0, 0, 0)
>
> (now run the iperf client to do a test and at completion it is now yeilding)
> # pstack 29619
> 29619:  /usr/local/bin/iperf -s -D -w 256k
> -----------------  lwp# 2 / thread# 2  --------------------
>  ff0457b0 accept   (3, 33410, 33510, 1)
>  00015e2c _ZN8Listener3RunEv (30290, 2f990, 0, 2f800, ffffffff, 30890) + a4
>  00014e94 listener_spawn (2fd58, 0, ff073700, 0, feed0200, 1) + 60
>  0001befc thread_run_wrapper (2fd58, fee7c000, 0, 0, 1be20, 1) + dc
>  ff045238 _lwp_start (0, 0, 0, 0, 0, 0)
> -----------------  lwp# 4 / thread# 4  --------------------
>  ff045350 lwp_yield (0, 0, ff073700, 0, feed0a00, 0) + 8
>  00017774 EndReport (36040, 32b88, 0, 0, 0, ff075380) + 28
>  00014edc server_spawn (32b88, 0, 0, 0, feed0a00, 1) + 18
>  0001bec4 thread_run_wrapper (32b88, fed7c000, 0, 0, 1be20, 1) + a4
>  ff045238 _lwp_start (0, 0, 0, 0, 0, 0)
>
> Both Solaris and Linux shows CPU usage to 90% + even there is no iperf
> test going on anymore
>
> On Solaris I did a dtrace probe and got similar data
>
> # dtrace -n 'syscall:::entry {...@[execname] = count();} tick-30s {exit(0);}'
> dtrace: description 'syscall:::entry ' matched 232 probes
> CPU     ID                    FUNCTION:NAME
>  1  51420                        :tick-30s
> [..]
>  iperf                                                       8999610
>
> ouch! 8999610 system calls in 30 secs even though there is no iperf
> test is going on now. iperf gone mad!!
>
> Ok, lets find out what is iperf doing by tracing its pid
> # dtrace -n 'syscall:::entry /pid == $target/ {...@[probefunc] =
> count();} tick-30s {exit(0);}' -p 29995
> dtrace: description 'syscall:::entry ' matched 232 probes
> CPU     ID                    FUNCTION:NAME
>  0  51420                        :tick-30s
>
>  yield                                                       7519587
>
> It yielded (??) 7519587 times in 30 secs.. wow!!
>
> Now probing the usermode stack to see what yeild is doing
>
> (root)@ftp0:~$ dtrace -n 'syscall::yield:entry /pid == $target/
> {...@[ustack()] = count();} tick-30s {exit(0);}' -p 29995
> dtrace: description 'syscall::yield:entry ' matched 2 probes
> CPU     ID                    FUNCTION:NAME
>  0  51420                        :tick-30s
>
>
>              libc.so.1`lwp_yield+0x4
>              iperf`EndReport+0x28
>              iperf`server_spawn+0x18
>              iperf`thread_run_wrapper+0xa4
>              libc.so.1`_lwp_start
>          2931219
>
> in 30 seconds it 2931219 times!!
>
> All these functions were touched by the patch to fix (not sure if that
> fixed it)  version 2.0.2 maybe?!
>
> --
> Asif Iqbal
> PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
>



-- 
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu

------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Iperf-users mailing list
Iperf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iperf-users

Reply via email to