openwrtv3/target/linux
Koen Vandeputte f3dec44520 cns3xxx: fix ethernet IRQ imbalance in 4.14
Kernel 4.14 contains more warnings regarding NAPI usage, which showed
following warning:

[ 4016.420000] ------------[ cut here ]------------
[ 4016.430000] WARNING: CPU: 1 PID: 14 at kernel/irq/manage.c:525
__enable_irq+0x3c/0x78
[ 4016.440000] Unbalanced enable for IRQ 51
[ 4016.440000] Modules linked in: ath9k ath9k_common pppoe ppp_async
ath9k_hw ath pppox ppp_generic nf_conntrack_ipv6 mac80211 iptable_nat
ipt_REJECT ipt_MASQUERADE cfg80211 xt_time xt_tcpudp xt_state xt_nat
xt_multiport xt_mark xt_mac xt_limit xt_conntrack xt_comment xt_TCPMSS
xt_REDIRECT xt_LOG slhc nf_reject_ipv4 nf_nat_redirs
[ 4016.500000] CPU: 1 PID: 14 Comm: ksoftirqd/1 Tainted: G        W
       4.14.11 #0
[ 4016.500000] Hardware name: Gateworks Corporation Laguna Platform
[ 4016.510000] Backtrace:
[ 4016.510000] [<c010a28c>] (dump_backtrace) from [<c010a56c>]
(show_stack+0x18/0x1c)
[ 4016.520000]  r7:c059df4b r6:00000000 r5:60000093 r4:00000000
[ 4016.530000] [<c010a554>] (show_stack) from [<c048b04c>]
(dump_stack+0x94/0xb4)
[ 4016.530000] [<c048afb8>] (dump_stack) from [<c011760c>]
(__warn+0xc8/0xf8)
[ 4016.540000]  r7:c059df4b r6:c015144c r5:00000000 r4:cf863e08
[ 4016.550000] [<c0117544>] (__warn) from [<c011767c>]
(warn_slowpath_fmt+0x40/0x48)
[ 4016.550000]  r9:cf863eb0 r8:00000036 r7:00000000 r6:c0636360
r5:00000033 r4:cf80a500
[ 4016.560000] [<c0117640>] (warn_slowpath_fmt) from [<c015144c>]
(__enable_irq+0x3c/0x78)
[ 4016.570000]  r3:00000033 r2:c059e0c5
[ 4016.570000] [<c0151410>] (__enable_irq) from [<c01514ec>]
(enable_irq+0x64/0x7c)
[ 4016.580000] [<c0151488>] (enable_irq) from [<c0335c14>]
(eth_poll+0x28c/0x558)
[ 4016.590000]  r5:d08926c0 r4:cf894488
[ 4016.590000] [<c0335988>] (eth_poll) from [<c03b1718>]
(net_rx_action+0xfc/0x2e8)
[ 4016.600000]  r10:cf863eb8 r9:cf863eb0 r8:00000001 r7:0f7b5000
r6:c0636360 r5:cfdeb360
[ 4016.610000]  r4:cf894488
[ 4016.610000] [<c03b161c>] (net_rx_action) from [<c0101510>]
(__do_softirq+0xe0/0x228)
[ 4016.620000]  r10:00000100 r9:c070204c r8:c0702040 r7:00000003
r6:00000008 r5:40000003
[ 4016.620000]  r4:cf862000
[ 4016.630000] [<c0101430>] (__do_softirq) from [<c011ae28>]
(run_ksoftirqd+0x34/0x58)
[ 4016.630000]  r10:c0133964 r9:00000000 r8:00000001 r7:00000000
r6:c070b44c r5:cf862000
[ 4016.640000]  r4:cf8037e0
[ 4016.640000] [<c011adf4>] (run_ksoftirqd) from [<c0133adc>]
(smpboot_thread_fn+0x178/0x190)
[ 4016.650000] [<c0133964>] (smpboot_thread_fn) from [<c013099c>]
(kthread+0x11c/0x138)
[ 4016.660000]  r9:cf8037e0 r8:cf802cdc r7:cf839df8 r6:cf803800
r5:00000000 r4:cf802cc0
[ 4016.670000] [<c0130880>] (kthread) from [<c0107218>]
(ret_from_fork+0x14/0x3c)
[ 4016.680000]  r10:00000000 r9:00000000 r8:00000000 r7:00000000
r6:00000000 r5:c0130880
[ 4016.680000]  r4:cf803800 r3:cf862000
[ 4016.690000] ---[ end trace 51114df08f429115 ]---

This is triggered by calling eth_schedule_poll(sw) after the IRQ has
been re-enabled.

Rework the network code to only enable IRQ's again if NAPI agrees it's
safe to do so.

Also only re-enable IRQ *after* cleaning up the RX ring and re-enabling
DMA, which otherwise resulted in ugly warnings regarding dirty page
fragments.
These popped up nearly immediately when building the kernel with O2 iso
Os.

--> Note that this change fixes stability issues, at the cost of ~8%
throughput performance.

While at it, also change the iface name being used in warning prints,
making it more obvious: "switch%d" --> "cns3xxx_eth"

The changes have been tested on 4 boards, each moving ~30TB of data

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2018-01-17 11:07:17 +01:00
..
adm5120 treewide: populate boardname and model earlier 2017-07-15 23:13:34 +02:00
adm8668
apm821xx apm821xx: remove kernel 4.9 support 2018-01-12 08:00:05 +01:00
ar7 kernel: Update kernel 4.9 to 4.9.70 2017-12-19 22:45:27 +01:00
ar71xx ar71xx: fix format of the 701-MIPS-ath79-add-routerboard-detection patches 2018-01-17 11:07:17 +01:00
arc770 arc770: mark as source-only 2017-10-28 13:59:03 +02:00
archs38 treewide: drop target board_name functions 2017-07-15 23:13:34 +02:00
armvirt armvirt: Resync kernel configuration 2018-01-12 15:14:27 -08:00
at91 at91: create device specific sdcard images 2018-01-11 20:35:33 +01:00
ath25 kernel: cleanup CONFIG_SCHED_HRTICK 2017-06-29 04:46:59 +02:00
au1000
bcm53xx bcm53xx: rename SPI driver fix to use 0xx prefix as it was accepted 2018-01-12 23:29:48 +01:00
brcm47xx brcm47xx: image: build firmware for Asus WL-500g Deluxe 2017-12-29 23:18:19 +01:00
brcm63xx kernel: bump 4.4 to 4.4.107 2017-12-23 15:36:01 +01:00
brcm2708 target: disable CONFIG_PROC_PAGE_MONITOR on most targets 2018-01-13 15:04:15 +01:00
cns3xxx cns3xxx: fix ethernet IRQ imbalance in 4.14 2018-01-17 11:07:17 +01:00
gemini kernel: Update kernel 4.4 to 4.4.100 2017-11-25 19:48:39 +01:00
generic kernel: add missing config symbol 2018-01-14 21:27:33 +02:00
imx6 imx6: add support for the intel gbit driver on GW5520 2018-01-17 11:07:17 +01:00
ipq806x ipq8065: adjust SS USB PHY power settings 2018-01-17 11:05:11 +01:00
ixp4xx kernel: bump 4.4 to 4.4.107 2017-12-23 15:36:01 +01:00
kirkwood kirkwood: sort occurrences of boardame alphabetically 2018-01-09 22:06:55 +01:00
lantiq lantiq: create ATM/PTM interfaces with dsl as netdev name 2018-01-10 08:08:53 +01:00
layerscape target: disable CONFIG_PROC_PAGE_MONITOR on most targets 2018-01-13 15:04:15 +01:00
malta malta: bump tp v4.14 2018-01-09 10:26:16 +01:00
mcs814x merge: targets: update image generation and targets 2017-12-08 19:41:18 +01:00
mediatek kernel: bump 4.9 to 4.9.72 2017-12-26 23:31:00 +01:00
mpc85xx target: disable CONFIG_PROC_PAGE_MONITOR on most targets 2018-01-13 15:04:15 +01:00
mvebu kernel: bump 4.9 to 4.9.76 2018-01-11 20:32:36 +01:00
mxs treewide: drop target board_name functions 2017-07-15 23:13:34 +02:00
octeon target: disable CONFIG_PROC_PAGE_MONITOR on most targets 2018-01-13 15:04:15 +01:00
omap omap: clean up configuration 2017-10-18 21:46:05 +02:00
omap24xx omap24xx: remove referece to not existing kmod-usb-musb-tusb6010 2018-01-15 13:13:34 +01:00
orion orion: Switch to 4.9 kernel 2017-10-24 18:39:17 -07:00
oxnas kernel: bump 4.4 to 4.4.110 2018-01-10 00:11:39 +02:00
pistachio kernel: bump 4.9 to 4.9.67 2017-12-07 01:41:09 +02:00
ppc40x treewide: drop target board_name functions 2017-07-15 23:13:34 +02:00
ppc44x ppc44x: mark as broken 2017-01-10 12:49:34 +01:00
ramips ramips: use blue status LED for Xiaomi Router 3G 2018-01-15 21:45:43 +01:00
rb532 treewide: drop obsolete kernel config options 2017-10-04 20:08:15 +02:00
sunxi target: disable CONFIG_PROC_PAGE_MONITOR on most targets 2018-01-13 15:04:15 +01:00
uml merge: targets: update image generation and targets 2017-12-08 19:41:18 +01:00
x86 kernel: add missing config symbol 2018-01-14 21:27:33 +02:00
xburst target: disable CONFIG_PROC_PAGE_MONITOR on most targets 2018-01-13 15:04:15 +01:00
zynq target: disable CONFIG_PROC_PAGE_MONITOR on most targets 2018-01-13 15:04:15 +01:00
Makefile