Revert "kernel: add a RPS balancer"

This reverts commit 7af1fb9faa.

With the RPS balancer patch, both my APU2s are crashing, sometimes just
after a few minutes of uptime.

[ 6241.170132] BUG: unable to handle kernel paging request at ffffffffa20a75a8
[ 6241.177248] IP: get_rps_cpu+0x41c/0x440
[ 6241.181140] PGD 2012067 P4D 2012067 PUD 2013063 PMD 0
[ 6241.186370] Oops: 0000 [#1] SMP NOPTI
[ 6241.190080] Modules linked in: pppoe ppp_async pptp pppox ppp_mppe ppp_generic nf_nat_pptp nf_flow_table_ipv6 nf_flow_table_ipv4 nf_flow_table_inet nf_conntrack_pptp lzo iptable_nat ipt_REJECT ipt_MASQUERADE ftdi_sio xt_time xt_tcpudp xt_tcpmss xt_string xt_statistic xt_state xt_recent xt_quota xt_policy xt_pkttype xt_owner xt_nat xt_multiport xt_mark xt_mac xt_limit xt_length xt_hl xt_helper xt_esp xt_ecn xt_dscp xt_conntrack xt_connmark xt_connlimit xt_connbytes xt_comment xt_bpf xt_addrtype xt_TCPMSS xt_REDIRECT xt_NFQUEUE xt_LOG xt_HL xt_FLOWOFFLOAD xt_DSCP xt_CT xt_CLASSIFY wireguard usbserial ts_fsm ts_bm spidev slhc rfcomm nft_set_rbtree nft_set_hash nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject nft_redir_ipv4 nft_redir nft_quota nft_numgen nft_nat nft_meta nft_masq_ipv4 nft_masq
[ 6241.261735]  nft_log nft_limit nft_flow_offload nft_exthdr nft_ct nft_counter nft_chain_route_ipv6 nft_chain_route_ipv4 nft_chain_nat_ipv4 nfnetlink_queue nf_tables_ipv6 nf_tables_ipv4 nf_tables_inet nf_tables nf_reject_ipv4 nf_nat_tftp nf_nat_snmp_basic nf_nat_sip nf_nat_redirect nf_nat_proto_gre nf_nat_masquerade_ipv6 nf_nat_masquerade_ipv4 nf_nat_irc nf_conntrack_ipv6 nf_nat_ipv6 nf_conntrack_ipv4 nf_nat_ipv4 nf_nat_h323 nf_nat_ftp nf_nat_amanda nf_nat nf_log_ipv4 nf_flow_table_hw nf_flow_table nf_defrag_ipv6 nf_defrag_ipv4 nf_conntrack_tftp nf_conntrack_snmp nf_conntrack_sip nf_conntrack_rtcache nf_conntrack_proto_gre nf_conntrack_netlink nf_conntrack_irc nf_conntrack_h323 nf_conntrack_ftp nf_conntrack_broadcast ts_kmp nf_conntrack_amanda macvlan lzo_decompress lzo_compress libcrc32c kvm irqbypass
[ 6241.333427]  iptable_raw iptable_mangle iptable_filter ipt_ah ipt_ECN ip_tables hidp hci_uart crc_ccitt cdc_acm btusb btintel br_netfilter bnep bluetooth sch_cake tcp_bbr sch_teql em_nbyte sch_codel sch_prio sch_pie act_ipt em_meta sch_gred sch_dsmark cls_basic em_cmp em_text act_police sch_sfq sch_fq sch_multiq sch_red act_connmark nf_conntrack act_skbedit act_mirred em_u32 cls_u32 cls_tcindex cls_flow cls_route cls_fw sch_tbf sch_htb sch_hfsc sch_ingress configs evdev i2c_piix4 kfifo_buf industrialio i2c_dev xt_set ip_set_list_set ip_set_hash_netiface ip_set_hash_netport ip_set_hash_netnet ip_set_hash_net ip_set_hash_netportnet ip_set_hash_mac ip_set_hash_ipportnet ip_set_hash_ipportip ip_set_hash_ipport ip_set_hash_ipmark ip_set_hash_ip ip_set_bitmap_port ip_set_bitmap_ipmac ip_set_bitmap_ip ip_set
[ 6241.405252]  nfnetlink ip6t_REJECT nf_reject_ipv6 nf_log_ipv6 nf_log_common ip6table_mangle ip6table_filter ip6_tables x_tables ip_gre gre igb i2c_algo_bit ifb ip6_vti ip_vti sit l2tp_netlink l2tp_core ipcomp6 xfrm6_tunnel xfrm6_mode_tunnel xfrm6_mode_transport xfrm6_mode_beet esp6 ah6 ipcomp xfrm4_tunnel xfrm4_mode_tunnel xfrm4_mode_transport xfrm4_mode_beet esp4 ah4 ip6_tunnel tunnel6 tunnel4 ip_tunnel veth snd_compress snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_rawmidi snd_seq_device snd_hwdep snd soundcore mpls_gso mpls_iptunnel mpls_router af_key xfrm_user xfrm_ipcomp xfrm_algo br2684 atm regmap_mmio vxlan udp_tunnel ip6_udp_tunnel ecdh_generic sha512_ssse3 sha512_generic sha256_ssse3 sha1_ssse3 seqiv jitterentropy_rng drbg md5 kpp ccp_crypto rsa_generic mpi asn1_decoder akcipher ccp sha256_generic
[ 6241.477726]  sha1_generic hmac ghash_generic gcm echainiv des_generic deflate zlib_deflate ctr cmac ccm cbc authenc crypto_acompress sdhci_pltfm pf_ring sp5100_tco leds_apu2 gpio_nct5104d button_hotplug ptp pps_core
[ 6241.497122] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 4.14.73 #0
[ 6241.503198] Hardware name: PC Engines apu2/apu2, BIOS v4.8.0.2 20180705
[ 6241.509858] task: ffff88012a0d8000 task.stack: ffffc90000070000
[ 6241.515841] RIP: 0010:get_rps_cpu+0x41c/0x440
[ 6241.520246] RSP: 0018:ffff88012ed83db0 EFLAGS: 00010286
[ 6241.525511] RAX: 00000000ffffffff RBX: 0000000000011ae8 RCX: 0000000000000001
[ 6241.532737] RDX: 00000000ffffffff RSI: ffff88012a0d8788 RDI: 0000000000000282
[ 6241.539956] RBP: ffff88012ed83e00 R08: 0000000000000001 R09: 0000000000000000
[ 6241.547183] R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff82dae2e0
[ 6241.554403] R13: ffff880124de4480 R14: 0000000000000000 R15: ffff880128120000
[ 6241.561625] FS:  0000000000000000(0000) GS:ffff88012ed80000(0000) knlGS:0000000000000000
[ 6241.569820] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 6241.575651] CR2: ffffffffa20a75a8 CR3: 00000001251da000 CR4: 00000000000406e0
[ 6241.582830] Call Trace:
[ 6241.585322]  <IRQ>
[ 6241.587372]  ? lock_acquire+0x59/0x80
[ 6241.591102]  netif_receive_skb_internal+0x1e4/0x2d0
[ 6241.596037]  napi_gro_receive+0x48/0x90
[ 6241.599948]  igb_alloc_rx_buffers+0xc97/0x1b60 [igb]
[ 6241.604981]  ? note_gp_changes+0x76/0xc0
[ 6241.608963]  net_rx_action+0x10c/0x280
[ 6241.612752]  __do_softirq+0xf0/0x22d
[ 6241.616375]  irq_exit+0x5e/0xa0
[ 6241.619573]  do_IRQ+0xee/0x110
[ 6241.622682]  common_interrupt+0x8b/0x8b
[ 6241.626556]  </IRQ>
[ 6241.628699] RIP: 0010:native_safe_halt+0x6/0x10
[ 6241.633260] RSP: 0018:ffffc90000073e10 EFLAGS: 00000202 ORIG_RAX: ffffffffffffff3d
[ 6241.640910] RAX: ffff88012a0d8000 RBX: ffff88012a190c00 RCX: 0000000000000000
[ 6241.648110] RDX: ffff88012a0d8000 RSI: 0000000000000001 RDI: ffff88012a0d8000
[ 6241.655354] RBP: ffffc90000073e10 R08: 0000000000000006 R09: 0000000000000000
[ 6241.662554] R10: 0000000000000000 R11: 0000000000000000 R12: ffff88012a190c64
[ 6241.669791] R13: 0000000000000001 R14: 0000000000000001 R15: 0000000000000001
[ 6241.676986]  acpi_safe_halt.part.9+0xe/0x20
[ 6241.681226]  acpi_idle_do_entry+0x2c/0x40
[ 6241.685325]  acpi_idle_enter+0x1ee/0x2b0
[ 6241.689298]  ? sched_clock+0x9/0x10
[ 6241.692839]  cpuidle_enter_state+0x1f2/0x230
[ 6241.697162]  cpuidle_enter+0x12/0x20
[ 6241.700803]  call_cpuidle+0x38/0x40
[ 6241.704335]  do_idle+0xed/0x160
[ 6241.707557]  cpu_startup_entry+0x6e/0x70
[ 6241.711557]  start_secondary+0x1b4/0x1d0
[ 6241.715536]  secondary_startup_64+0xa5/0xb0
[ 6241.719777] Code: d4 48 8d 04 9b 48 8b 35 53 a7 ac 00 48 8d 1c 43 48 83 c6 64 48 c1 e3 03 48 8d bb e8 e2 da 82 e8 cb a9 ba ff 41 8b 14 1c 48 89 d0 <48> 0f a3 15 dc dc b6 00 0f 83 46 fc ff ff 48 83 c4 28 5b 41 5c
[ 6241.739100] RIP: get_rps_cpu+0x41c/0x440 RSP: ffff88012ed83db0
[ 6241.744993] CR2: ffffffffa20a75a8
[ 6241.748373] ---[ end trace 77367d9f9830d5bc ]---

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
master
Stijn Tintel 6 years ago
parent 0308385d1d
commit b134b3299c
  1. 93
      target/linux/generic/hack-4.14/600-net-core-add-RPS-balancer.patch

@ -1,93 +0,0 @@
From 3e969c9695b45e1a052d43b367096ec99f2f0aac Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 10 Aug 2017 15:58:29 +0200
Subject: [PATCH] net: core: add RPS balancer
This patch adds a hash bucket based rps hash balancer.
Signed-off-by: John Crispin <john@phrozen.org>
---
net/core/dev.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3626,6 +3626,58 @@ set_rps_cpu(struct net_device *dev, stru
return rflow;
}
+#define RPS_TBL_SIZE_SHIFT 10
+#define RPS_TBL_SIZE (1 << RPS_TBL_SIZE_SHIFT)
+struct rps_table {
+ int core;
+ struct timer_list expire;
+};
+static struct rps_table rps_table[RPS_TBL_SIZE];
+static int rps_table_last_core;
+
+static void rps_table_expire(unsigned long data)
+{
+ struct rps_table *entry = (struct rps_table *) data;
+
+ entry->core = -1;
+}
+
+static int rps_table_core(struct rps_map *map)
+{
+ int i;
+
+ for (i = 0; i < map->len; i++) {
+ int cpu = map->cpus[(rps_table_last_core + i + 1) % map->len];
+ if (cpu_online(cpu)) {
+ rps_table_last_core = cpu;
+ return cpu;
+ }
+ }
+ return map->cpus[0];
+}
+
+static int rps_table_lookup(struct rps_map *map, u32 hash)
+{
+ int bucket = hash & 0x3ff;
+
+ if (rps_table[bucket].core < 0)
+ rps_table[bucket].core = rps_table_core(map);
+ mod_timer(&rps_table[bucket].expire, jiffies + HZ);
+
+ return rps_table[bucket].core;
+}
+
+static void rps_table_init(void)
+{
+ int i;
+
+ for (i = 0; i < RPS_TBL_SIZE; i++) {
+ rps_table[i].core = -1;
+ setup_timer(&rps_table[i].expire, rps_table_expire,
+ (unsigned long) &rps_table[i]);
+ }
+}
+
/*
* get_rps_cpu is called from netif_receive_skb and returns the target
* CPU from the RPS map of the receiving queue for a given skb.
@@ -3715,7 +3767,7 @@ static int get_rps_cpu(struct net_device
try_rps:
if (map) {
- tcpu = map->cpus[reciprocal_scale(hash, map->len)];
+ tcpu = rps_table_lookup(map, hash);
if (cpu_online(tcpu)) {
cpu = tcpu;
goto done;
@@ -8800,6 +8852,10 @@ static int __init net_dev_init(void)
sd->backlog.weight = weight_p;
}
+#ifdef CONFIG_RPS
+ rps_table_init();
+#endif
+
dev_boot_phase = 0;
/* The loopback device is special if any other network devices
Loading…
Cancel
Save