From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-iw0-f171.google.com (mail-iw0-f171.google.com [209.85.214.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by huchra.bufferbloat.net (Postfix) with ESMTPS id 49ADF20016F for ; Fri, 3 Jun 2011 20:35:53 -0700 (PDT) Received: by iwn8 with SMTP id 8so2918983iwn.16 for ; Fri, 03 Jun 2011 20:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=4MkwtGJSX/4DEKmop2a9F6/fD0Z3HUyl1C5kX/VFu2g=; b=mbW+5H5mEmDoEwF6b4n+4oYRSisdZ6ahwhR0FaRQyZwk8C1FjSlN/ErA30zOh8wGt/ rVap+zV2vDMs/wXsOOUc//cGqekOkcQaxPM198cM33Iq+BpPAOXB4i0hxXp2NBEdfion zrHDztkoTvUeHoRQxpMUzgTVmyMC9UaEjknIc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=OmwESuFodI/qVkUvWnKHDIFfQ9Ok79B6Z2at8N1RTXKdSuBev2HQuIRpLbkHgYg0NY ODZS4+/h4x/5EBFVKwhaJzy5NYsPimRm8l474CxOdrBxAVHX0dX/F8Mtq0v94CvndSng W+MDJjjw9W4bKafEHQPGI+Ky/y6HzcXRkZs9w= MIME-Version: 1.0 Received: by 10.231.1.14 with SMTP id 14mr3793666ibd.13.1307159656858; Fri, 03 Jun 2011 20:54:16 -0700 (PDT) Received: by 10.231.13.76 with HTTP; Fri, 3 Jun 2011 20:54:16 -0700 (PDT) In-Reply-To: References: <7i39jr3x3a.fsf@lanthane.pps.jussieu.fr> Date: Fri, 3 Jun 2011 21:54:16 -0600 Message-ID: Subject: Re: Hacking on the rtl8366S From: Dave Taht To: Juliusz Chroboczek Content-Type: multipart/alternative; boundary=001517741a9e03067e04a4dad316 Cc: Gabor Juhos , bloat-devel@lists.bufferbloat.net X-BeenThere: bloat-devel@lists.bufferbloat.net X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Developers working on AQM, device drivers, and networking stacks" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jun 2011 03:35:53 -0000 --001517741a9e03067e04a4dad316 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable If anyone cares, a copy of this build is at: http://huchra.bufferbloat.net/~cerowrt/cerowrt-wndr3700-dbg/ and the kernel is at: http://huchra.bufferbloat.net/~cerowrt/vmlinux On Fri, Jun 3, 2011 at 9:49 PM, Dave Taht wrote: > So I built a fresh build of openwrt from git head, patched in my > preliminary patch to the switch, compiled it with oprofile support, and > turned on -O2 rather than -Os, in my usual approach to all-up testing tha= t > makes it hard to track down what's really going on without backtracking. > > The net result with iperf was better than before, > with iptables and qos turned entirely off, no nat, etc. > pings stayed very flat and well below 8ms, down from 100ms. > > elara: [ 3] 0.0-60.0 sec 435 MBytes 60.7 Mbits/sec > io: [ 3] 0.0-60.0 sec 495 MBytes 69.2 Mbits/sec > leda: [ 3] 0.0-60.9 sec 226 MBytes 31.1 Mbits/sec > thebe: [ 3] 0.0-60.0 sec 105 MBytes 14.7 Mbits/sec > > (how all this stuff is routed is beyond the scope of this, but only > partially explains the discrepancies above) > > Oprofiling a later run, we're spending a lot of time in an unaligned trap= , > and I have no idea why iptables and conntrack even register. > > I am not sure at the moment how to track down the source of the alignment > fault, I assume I can look at the performance counter somehow, and backtr= ack > that to a given function or functions. It's late... > > samples cum. samples % cum. % app name symbo= l > name > 14992 14992 22.7158 22.7158 vmlinux do_ad= e > 10054 25046 15.2338 37.9496 ip_tables > /ip_tables > 7257 32303 10.9958 48.9454 nf_conntrack > /nf_conntrack > 3398 35701 5.1486 54.0941 vmlinux > handle_adel_int > 2613 38314 3.9592 58.0533 vmlinux ip_rc= v > 2356 40670 3.5698 61.6231 vmlinux > nf_iterate > 1869 42539 2.8319 64.4550 iptable_nat > /iptable_nat > 1626 44165 2.4637 66.9187 vmlinux > r4k_dma_cache_inv > 1544 45709 2.3395 69.2582 nf_conntrack_ipv4 > /nf_conntrack_ipv4 > 1331 47040 2.0167 71.2749 vmlinux > ag71xx_poll > 1011 48051 1.5319 72.8068 vmlinux > ip_route_input_common > 988 49039 1.4970 74.3038 vmlinux > ret_from_exception > > > > asmlinkage void do_ade(struct pt_regs *regs) > { > unsigned int __user *pc; > mm_segment_t seg; > > perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, > 1, 0, regs, regs->cp0_badvaddr); > /* > * Did we catch a fault trying to load an instruction? > * Or are we running in MIPS16 mode? > */ > if ((regs->cp0_badvaddr =3D=3D regs->cp0_epc) || (regs->cp0_epc &= 0x1)) > goto sigbus; > > pc =3D (unsigned int __user *) exception_epc(regs); > if (user_mode(regs) && !test_thread_flag(TIF_FIXADE)) > goto sigbus; > if (unaligned_action =3D=3D UNALIGNED_ACTION_SIGNAL) > goto sigbus; > else if (unaligned_action =3D=3D UNALIGNED_ACTION_SHOW) > show_registers(regs); > > /* > * Do branch emulation only if we didn't forward the exception. > * This is all so but ugly ... > */ > seg =3D get_fs(); > if (!user_mode(regs)) > set_fs(KERNEL_DS); > emulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, > pc); > set_fs(seg); > > return; > > > > -- > Dave T=E4ht > SKYPE: davetaht > US Tel: 1-239-829-5608 > http://the-edge.blogspot.com > --=20 Dave T=E4ht SKYPE: davetaht US Tel: 1-239-829-5608 http://the-edge.blogspot.com --001517741a9e03067e04a4dad316 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable If anyone cares, a copy of this build is at:

http://huchra.bufferbloat= .net/~cerowrt/cerowrt-wndr3700-dbg/

and the kernel is at:
http://huchra.bu= fferbloat.net/~cerowrt/vmlinux



On Fri, Jun 3, 2011 at 9:49 PM, Dave Taht <dave.taht@gmail.com> wrote:
So I built a fres= h build of openwrt from git head, patched in my preliminary patch to the sw= itch, compiled it with oprofile support, and turned on -O2 rather than -Os,= in my usual approach to all-up testing that makes it hard to track down wh= at's really going on without backtracking.

The net result with iperf was better than before,
with iptables and = qos turned entirely off, no nat, etc.
pings stayed very flat and well b= elow 8ms, down from 100ms.

elara: [=A0 3]=A0 0.0-60.0 sec=A0=A0 435 = MBytes=A0 60.7 Mbits/sec
io: [=A0 3]=A0 0.0-60.0 sec=A0=A0 495 MBytes=A0 69.2 Mbits/sec
leda: [= =A0 3]=A0 0.0-60.9 sec=A0=A0 226 MBytes=A0 31.1 Mbits/sec
thebe: [=A0 3]= =A0 0.0-60.0 sec=A0=A0 105 MBytes=A0 14.7 Mbits/sec

(h= ow all this stuff is routed is beyond the scope of this, but only partially= explains the discrepancies above)

Oprofiling a later run, we're spending a lot of time in an unaligne= d trap, and I have no idea why iptables and conntrack even register.
I am not sure at the moment how to track down the source of the alignment= fault, I assume I can look at the performance counter somehow, and backtra= ck that to a given function or functions. It's late...

samples=A0 cum. samples=A0 %=A0=A0=A0=A0=A0=A0=A0 cum. %=A0=A0=A0=A0 ap= p name=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 symbol name
14992= =A0=A0=A0 14992=A0=A0=A0=A0=A0=A0=A0=A0 22.7158=A0 22.7158=A0=A0=A0 vmlinux= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 do_ade
10054=A0=A0= =A0 25046=A0=A0=A0=A0=A0=A0=A0=A0 15.2338=A0 37.9496=A0=A0=A0 ip_tables=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 /ip_tables
7257=A0=A0=A0=A0 32303=A0=A0=A0=A0=A0=A0=A0=A0 10.9958=A0 48.9454=A0=A0=A0 = nf_conntrack=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 /nf_conntrack
3398=A0= =A0=A0=A0 35701=A0=A0=A0=A0=A0=A0=A0=A0=A0 5.1486=A0 54.0941=A0=A0=A0 vmlin= ux=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 handle_adel_int
26= 13=A0=A0=A0=A0 38314=A0=A0=A0=A0=A0=A0=A0=A0=A0 3.9592=A0 58.0533=A0=A0=A0 = vmlinux=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ip_rcv
2356=A0=A0=A0=A0 40670=A0=A0=A0=A0=A0=A0=A0=A0=A0 3.5698=A0 61.6231=A0=A0= =A0 vmlinux=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 nf_iterate1869=A0=A0=A0=A0 42539=A0=A0=A0=A0=A0=A0=A0=A0=A0 2.8319=A0 64.4550=A0=A0= =A0 iptable_nat=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 /iptable_nat
1626= =A0=A0=A0=A0 44165=A0=A0=A0=A0=A0=A0=A0=A0=A0 2.4637=A0 66.9187=A0=A0=A0 vm= linux=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 r4k_dma_cache_inv<= br> 1544=A0=A0=A0=A0 45709=A0=A0=A0=A0=A0=A0=A0=A0=A0 2.3395=A0 69.2582=A0=A0= =A0 nf_conntrack_ipv4=A0=A0=A0=A0=A0=A0=A0 /nf_conntrack_ipv4
1331=A0=A0= =A0=A0 47040=A0=A0=A0=A0=A0=A0=A0=A0=A0 2.0167=A0 71.2749=A0=A0=A0 vmlinux= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ag71xx_poll
1011=A0= =A0=A0=A0 48051=A0=A0=A0=A0=A0=A0=A0=A0=A0 1.5319=A0 72.8068=A0=A0= =A0 vmlinux=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ip_route_inp= ut_common
988=A0=A0=A0=A0=A0 49039=A0=A0=A0=A0=A0=A0=A0=A0=A0 1.4970=A0 74.3038=A0=A0= =A0 vmlinux=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret_from_exc= eption



asmlinkage void do_ade(struct pt_regs *regs)
{
= =A0=A0=A0=A0=A0=A0=A0 unsigned int __user *pc;
=A0=A0=A0=A0=A0=A0=A0 mm_= segment_t seg;

=A0=A0=A0=A0=A0=A0=A0 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS,
=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 1, 0, re= gs, regs->cp0_badvaddr);
=A0=A0=A0=A0=A0=A0=A0 /*
=A0=A0=A0=A0=A0= =A0=A0=A0 * Did we catch a fault trying to load an instruction?
=A0=A0= =A0=A0=A0=A0=A0=A0 * Or are we running in MIPS16 mode?
=A0=A0=A0=A0=A0=A0=A0=A0 */
=A0=A0=A0=A0=A0=A0=A0 if ((regs->cp0_badv= addr =3D=3D regs->cp0_epc) || (regs->cp0_epc & 0x1))
=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 goto sigbus;

=A0=A0=A0=A0=A0=A0= =A0 pc =3D (unsigned int __user *) exception_epc(regs);
=A0=A0=A0=A0=A0= =A0=A0 if (user_mode(regs) && !test_thread_flag(TIF_FIXADE))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 goto sigbus;
=A0=A0=A0=A0= =A0=A0=A0 if (unaligned_action =3D=3D UNALIGNED_ACTION_SIGNAL)
=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 goto sigbus;
=A0=A0=A0=A0=A0=A0=A0 = else if (unaligned_action =3D=3D UNALIGNED_ACTION_SHOW)
=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 show_registers(regs);

=A0=A0=A0=A0=A0=A0=A0 /*
=A0=A0=A0=A0=A0=A0=A0=A0 * Do branch emulat= ion only if we didn't forward the exception.
=A0=A0=A0=A0=A0=A0=A0= =A0 * This is all so but ugly ...
=A0=A0=A0=A0=A0=A0=A0=A0 */
=A0=A0= =A0=A0=A0=A0=A0 seg =3D get_fs();
=A0=A0=A0=A0=A0=A0=A0 if (!user_mode(r= egs))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 set_fs(KERNEL_DS); =A0=A0=A0=A0=A0=A0=A0 emulate_load_store_insn(regs, (void __user *)regs->= ;cp0_badvaddr, pc);
=A0=A0=A0=A0=A0=A0=A0 set_fs(seg);

=A0=A0=A0= =A0=A0=A0=A0 return;



--
Da= ve T=E4ht
SKYPE: davetaht
US Tel: 1-239-829-5608
http://the-edge.= blogspot.com



--
Dave T=E4ht=
SKYPE: davetaht
US Tel: 1-239-829-5608
http://the-edge.blogspot.com
--001517741a9e03067e04a4dad316--