Re: [OpenWrt-Devel] [PATCH] replace CONFIG_PREEMPT_NONE with CONFIG_PREEMPT

2011-09-02 Thread Florian Fainelli
Hello,

On Friday 02 September 2011 00:55:54 Luka Perkov wrote:
> I also had this issue on my sx763 lantiq based board:
> 
> https://dev.openwrt.org/ticket/9440
> 
> With symbol table I got this oops:
> 
> Unhandled kernel unaligned access[#1]:
> ... bla bla bla (to keep it short) ...
> Call Trace:
> [<80cb8968>] nf_nat_setup_info+0x2e0/0x6e8 [nf_nat]
> [<80d1e158>] masquerade_tg+0xc0/0xe8 [ipt_MASQUERADE]
> [<80c646a8>] ipt_do_table+0x3e0/0x484 [ip_tables]
> [<80dee0c0>] nf_nat_rule_find+0x28/0x9c [iptable_nat]
> [<80dee290>] nf_nat_fn+0x120/0x1a0 [iptable_nat]
> [<801baa34>] nf_iterate+0x8c/0xfc
> [<801bab34>] nf_hook_slow+0x90/0x17c
> [<801c76c8>] ip_output+0xd8/0x104
> [<8019a224>] __netif_receive_skb+0x4d4/0x578
> [<80210128>] br_handle_frame+0x280/0x2b8
> [<80199f9c>] __netif_receive_skb+0x24c/0x578
> [<8019a370>] process_backlog+0xa8/0x188
> [<8019a778>] net_rx_action+0x8c/0x1b8
> [<800215f0>] __do_softirq+0xa8/0x154
> [<800217f0>] do_softirq+0x48/0x68
> [<800031c0>] plat_irq_dispatch+0xf4/0x164
> [<800059ec>] ret_from_irq+0x0/0x4
> [<80005be0>] r4k_wait+0x20/0x40
> [<80007690>] cpu_idle+0x28/0x4c
> [<802a58d0>] start_kernel+0x35c/0x378
> 
> It's easy to reproduce with nmap:
> 
> # nmap -sT -p 1-1 -T insane -Pn -n some.public.ip.address/24
> 
> After some time I discovered that the issue is in this lines:
> 
> % sed -n '320,326p' linux-2.6.39.4/net/ipv4/netfilter/nf_nat_core.c
>   spin_lock_bh(&nf_nat_lock);
>   /* nf_conntrack_alter_reply might re-allocate exntension aera */
>   nat = nfct_nat(ct);
>   nat->ct = ct;
>   hlist_add_head_rcu(&nat->bysource,
>  &net->ipv4.nat_bysource[srchash]);
>   spin_unlock_bh(&nf_nat_lock);
> 
> Long story short - enable CONFIG_PREEMPT to have functional spin locks:
> 
> http://www.kernel.org/pub/linux/kernel/people/rusty/kernel-locking/x109.htm
> l
> 
> Also in linux-2.6.39.4/kernel/Kconfig.preempt you will see for
> CONFIG_PREEMPT:
> 
>   Select this if you are building a kernel for a desktop or
>   embedded system with latency requirements in the milliseconds
>   range
> 
> Because of that I made changes to all kernel config files.
> 
> Signed-off-by: Luka Perkov < openwrt ->-to->- lukaperkov.net >

I am not opposed to enabling CONFIG_PREEMPT on a global basis, but I am afraid 
this might reveal new locking problems that we have not had so far. At least 
trunk should be the place where to experiment this.
-- 
Florian
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] replace CONFIG_PREEMPT_NONE with CONFIG_PREEMPT

2011-09-02 Thread Luka Perkov
Hi,

On Fri, Sep 02, 2011 at 10:46:37AM +0200, Florian Fainelli wrote:
> On Friday 02 September 2011 00:55:54 Luka Perkov wrote:
> > Also in linux-2.6.39.4/kernel/Kconfig.preempt you will see for
> > CONFIG_PREEMPT:
> > 
> > Select this if you are building a kernel for a desktop or
> > embedded system with latency requirements in the milliseconds
> > range

Please look at the kernel config file above. You will see that
CONFIG_PREEMPT should be used on embedded systems...
 
> I am not opposed to enabling CONFIG_PREEMPT on a global basis, but I am 
> afraid 
> this might reveal new locking problems that we have not had so far. At least 
> trunk should be the place where to experiment this.

I agree. If it causes new problems we can revert.

Luka
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] replace CONFIG_PREEMPT_NONE with CONFIG_PREEMPT

2011-09-02 Thread Geert Uytterhoeven
On Fri, Sep 2, 2011 at 12:39, Luka Perkov  wrote:

> On Fri, Sep 02, 2011 at 10:46:37AM +0200, Florian Fainelli wrote:
>> On Friday 02 September 2011 00:55:54 Luka Perkov wrote:
>> > Also in linux-2.6.39.4/kernel/Kconfig.preempt you will see for
>> > CONFIG_PREEMPT:
>> >
>> >     Select this if you are building a kernel for a desktop or
>> >     embedded system with latency requirements in the milliseconds
>> >     range
>
> Please look at the kernel config file above. You will see that
> CONFIG_PREEMPT should be used on embedded systems...

... with latency requirements in the milliseconds range.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] replace CONFIG_PREEMPT_NONE with CONFIG_PREEMPT

2011-09-02 Thread edgar . soldin
On 02.09.2011 12:39, Luka Perkov wrote:
> Hi,
> 
> On Fri, Sep 02, 2011 at 10:46:37AM +0200, Florian Fainelli wrote:
>> On Friday 02 September 2011 00:55:54 Luka Perkov wrote:
>>> Also in linux-2.6.39.4/kernel/Kconfig.preempt you will see for
>>> CONFIG_PREEMPT:
>>>
>>> Select this if you are building a kernel for a desktop or
>>> embedded system with latency requirements in the milliseconds
>>> range
> 
> Please look at the kernel config file above. You will see that
> CONFIG_PREEMPT should be used on embedded systems...
>  

actually it says 

"system with latency requirements in the milliseconds range"

;9 .. but that's no reason not to use it if it might fix issues.

ede
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Image command line hack question

2011-09-02 Thread jason duhamell
As promised, here is the official realtek bsp with documentation.
http://d01.megashares.com/dl/abc0f5c/rtl819x-sdk-v2%5B1%5D.2.tar.gz

Jason

On Sat, Aug 27, 2011 at 9:51 PM, Florian Fainelli wrote:

> Hello,
>
> On Saturday 27 August 2011 15:14:51 Andrew wrote:
> > Hello again,
> > I looked through the patches, and think of rebasing my current work on
> top
> > of them.
> > Still, one question persists:
> > Is your work on RT856X abandoned? Why wasn't it included in the OpenWRT
> > trunk.
>
> At the time it was written, it was not tested on enough hardware to be
> included.
>
> > I'll try to forward-port your RT856X work, some things look similar. But
> > since I do not have any RT865X board, it might be buggy.
>
> I have some RTL865x boards that I can test on.
>
> >
> > And what conserns those realtek's imgtools (cvimg and mgbin), will it be
> > OK if I make a script that either downloads the official GPL sources
> from,
> > say TRENDnet's site and rips the reuired stuff from it (or asks the user
> to
> > do that manually). (I have a strange feeling it isn't worth the effort
> > asking realtek for license clarification)
>
> Since the sourcecode was published, let's just say that we can use the
> version
> as-is, but a rewrite by someone else and with proper license would be
> better.
> --
> Florian
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] replace CONFIG_PREEMPT_NONE with CONFIG_PREEMPT

2011-09-02 Thread Florian Fainelli
On Friday 02 September 2011 12:55:08 Geert Uytterhoeven wrote:
> On Fri, Sep 2, 2011 at 12:39, Luka Perkov  wrote:
> > On Fri, Sep 02, 2011 at 10:46:37AM +0200, Florian Fainelli wrote:
> >> On Friday 02 September 2011 00:55:54 Luka Perkov wrote:
> >> > Also in linux-2.6.39.4/kernel/Kconfig.preempt you will see for
> >> > CONFIG_PREEMPT:
> >> > 
> >> > Select this if you are building a kernel for a desktop or
> >> > embedded system with latency requirements in the milliseconds
> >> > range
> > 
> > Please look at the kernel config file above. You will see that
> > CONFIG_PREEMPT should be used on embedded systems...
> 
> ... with latency requirements in the milliseconds range.

Indeed, that's the part I am concerned with, along with the memory footprint. 
Any code should be able to work with and without Preemption enabled. Your 
patch remains a workaround for now.
-- 
Florian
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] replace CONFIG_PREEMPT_NONE with CONFIG_PREEMPT

2011-09-02 Thread Luka Perkov
On Fri, Sep 02, 2011 at 01:32:18PM +0200, Florian Fainelli wrote:
> On Friday 02 September 2011 12:55:08 Geert Uytterhoeven wrote:
> > On Fri, Sep 2, 2011 at 12:39, Luka Perkov  wrote:
> > > On Fri, Sep 02, 2011 at 10:46:37AM +0200, Florian Fainelli wrote:
> > >> On Friday 02 September 2011 00:55:54 Luka Perkov wrote:
> > >> > Also in linux-2.6.39.4/kernel/Kconfig.preempt you will see for
> > >> > CONFIG_PREEMPT:
> > >> > 
> > >> > Select this if you are building a kernel for a desktop or
> > >> > embedded system with latency requirements in the milliseconds
> > >> > range
> > > 
> > > Please look at the kernel config file above. You will see that
> > > CONFIG_PREEMPT should be used on embedded systems...
> > 
> > ... with latency requirements in the milliseconds range.
> 
> Indeed, that's the part I am concerned with, along with the memory footprint. 
> Any code should be able to work with and without Preemption enabled. Your 
> patch remains a workaround for now.

Please try to reproduce the issue with nmap on your devices. Run nmap
like I wrote on your PC and see what will your router do (you are
testing it's ability to handle many nat connections).

Try it with and without my patch and post what happened.

Luka
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] replace CONFIG_PREEMPT_NONE with CONFIG_PREEMPT

2011-09-02 Thread Florian Fainelli
On Friday 02 September 2011 15:10:47 Luka Perkov wrote:
> On Fri, Sep 02, 2011 at 01:32:18PM +0200, Florian Fainelli wrote:
> > On Friday 02 September 2011 12:55:08 Geert Uytterhoeven wrote:
> > > On Fri, Sep 2, 2011 at 12:39, Luka Perkov  
wrote:
> > > > On Fri, Sep 02, 2011 at 10:46:37AM +0200, Florian Fainelli wrote:
> > > >> On Friday 02 September 2011 00:55:54 Luka Perkov wrote:
> > > >> > Also in linux-2.6.39.4/kernel/Kconfig.preempt you will see for
> > > >> > 
> > > >> > CONFIG_PREEMPT:
> > > >> > Select this if you are building a kernel for a desktop or
> > > >> > embedded system with latency requirements in the milliseconds
> > > >> > range
> > > > 
> > > > Please look at the kernel config file above. You will see that
> > > > CONFIG_PREEMPT should be used on embedded systems...
> > > 
> > > ... with latency requirements in the milliseconds range.
> > 
> > Indeed, that's the part I am concerned with, along with the memory
> > footprint. Any code should be able to work with and without Preemption
> > enabled. Your patch remains a workaround for now.
> 
> Please try to reproduce the issue with nmap on your devices. Run nmap
> like I wrote on your PC and see what will your router do (you are
> testing it's ability to handle many nat connections).
> 

I will try to reproduce the error, but you cannot argue that code should be 
able to work fine with PREEMPT enabled or not, I have seen crappy drivers only 
working with preemption enabled too, but this is not an excuse.

> Try it with and without my patch and post what happened.

This has a net impact on the resulting kernel size, here is what I get for 
ar7:

- without preempt: 887 KB vmlinux.lzma
- with preempt: 902 KB vmlinux.lzma

this is quite a big increase.
-- 
Florian
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] replace CONFIG_PREEMPT_NONE with CONFIG_PREEMPT

2011-09-02 Thread Otto Solares Cabrera
On Fri, Sep 02, 2011 at 12:39:38PM +0200, Luka Perkov wrote:
> Please look at the kernel config file above. You will see that
> CONFIG_PREEMPT should be used on embedded systems...

Doesn't CONFIG_PREEMPT will add userspace scheduling overhead which
in turn harm kernelspace workloads such as packet routing,
firewalling, NAT, etc.?

I had done some tests in the past with the scheduling priority of the
hostapd daemon (with nice and schedtools) but never spot a gain in
bandwith or latency with iperf.
-
 Otto
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] replace CONFIG_PREEMPT_NONE with CONFIG_PREEMPT

2011-09-02 Thread Michael Büsch
On Fri, 2 Sep 2011 00:55:54 +0200
Luka Perkov  wrote:

> Also in linux-2.6.39.4/kernel/Kconfig.preempt you will see for
> CONFIG_PREEMPT:
> 
>   Select this if you are building a kernel for a desktop or
>   embedded system with latency requirements in the milliseconds
>   range
> 
> Because of that I made changes to all kernel config files.
> 
> Signed-off-by: Luka Perkov < openwrt ->-to->- lukaperkov.net >

Uhm, wait a second.
What are you actually trying to fix with enabling preemption? I didn't
really get it by reading your mail.

Some random text in a kernel config file is _not_ a reason to make
a change with a scope like this one.
Enabling preemption _does_ have negative effects. For one it increases
the kernel size. And it also increases the runtime overhead (especially on UP).

And finally, I'm not really convinced that any of the routers/APs
that OpenWRT supports have "latency requirements in the milliseconds range".
I'd rather say throughput matters a _lot_ more than a millisecond of latency
for these devices.

-- 
Greetings, Michael.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel