Subject: Re: [PATCH net-next 1/4] ipv6: Calculate hash thresholds for IPv6 nexthops

From: Ido Schimmel <[email-masked]>
Date: Wed, 2 May 2018 20:21:06 +0300

On Wed, May 02, 2018 at 09:43:50AM -0700, Eric Dumazet wrote:
> 
> 
> On 01/09/2018 07:43 PM, David Ahern wrote:
> > On 1/9/18 7:40 AM, Ido Schimmel wrote:
> >> Before we convert IPv6 to use hash-threshold instead of modulo-N, we
> >> first need each nexthop to store its region boundary in the hash
> >> function's output space.
> >>
> >> The boundary is calculated by dividing the output space equally between
> >> the different active nexthops. That is, nexthops that are not dead or
> >> linkdown.
> >>
> >> The boundaries are rebalanced whenever a nexthop is added or removed to
> >> a multipath route and whenever a nexthop becomes active or inactive.
> >>
> >> Signed-off-by: Ido Schimmel <[email-masked]>
> >> ---
> >>  include/net/ip6_fib.h   |  1 +
> >>  include/net/ip6_route.h |  7 ++++
> >>  net/ipv6/ip6_fib.c      |  8 ++---
> >>  net/ipv6/route.c        | 96 +++++++++++++++++++++++++++++++++++++++++++++++++
> >>  4 files changed, 106 insertions(+), 6 deletions(-)
> >>
> > 
> > LGTM.
> > Acked-by: David Ahern <[email-masked]>
> > 
> 
> For some reason I have a divide by zero error booting my hosts with latest net tree.
> 
> What guarantee do we have that total is not zero when rt6_upper_bound_set() is called ?

Thanks for the report, Eric. I believe I didn't cover all the cases and
'rt6i_nh_weight' might be 0 is some cases. I'll try to reproduce and
work on a fix.

> 
> 
> 
> [    8.498639] divide error: 0000 [#1] SMP PTI
> [    8.503178] gsmi: Log Shutdown Reason 0x03
> [    8.507270] Modules linked in: bnx2x mdio
> [    8.511276] CPU: 17 PID: 116 Comm: kworker/17:0 Not tainted 4.17.0-smp-DEV #110
> [    8.518571] Hardware name: Intel RML,PCH/Ibis_QC_18, BIOS 2.40.0 06/22/2016
> [    8.525526] Workqueue: ipv6_addrconf addrconf_dad_work
> [    8.530662] RIP: 0010:rt6_multipath_rebalance.part.82+0x1cb/0x1f0
> [    8.536752] RSP: 0018:ffffba72867cbbf8 EFLAGS: 00010246
> [    8.541966] RAX: 0000000000000000 RBX: 0000000000000025 RCX: ffff9d555ab73180
> [    8.549090] RDX: 0000000000000000 RSI: ffff9d4d5a34b1c0 RDI: 0000000000000000
> [    8.556212] RBP: ffffba72867cbc00 R08: 0000000000000000 R09: 0000000000000000
> [    8.563336] R10: 0000000000000000 R11: 0000000000000000 R12: ffff9d5559f95680
> [    8.570457] R13: ffff9d4d5a34b1c0 R14: ffff9d555ab73180 R15: 0000000000000000
> [    8.577579] FS:  0000000000000000(0000) GS:ffff9d4d5fc40000(0000) knlGS:0000000000000000
> [    8.585654] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [    8.591391] CR2: 00007fffe47ff000 CR3: 0000000c39c0a001 CR4: 00000000000606e0
> [    8.598515] Call Trace:
> [    8.600961]  ? rt6_multipath_rebalance+0x21/0x30
> [    8.605579]  fib6_add+0x75f/0xf70
> [    8.608899]  ? __wake_up+0x13/0x20
> [    8.612303]  ? netlink_broadcast_filtered+0x14c/0x3c0
> [    8.617355]  __ip6_ins_rt+0x4c/0x70
> [    8.620847]  ip6_ins_rt+0x6e/0xa0
> [    8.624157]  __ipv6_ifa_notify+0x226/0x2e0
> [    8.628249]  ipv6_ifa_notify+0x2a/0x40
> [    8.631999]  addrconf_dad_completed+0x59/0x360
> [    8.636438]  addrconf_dad_work+0x11c/0x400
> [    8.640536]  ? addrconf_dad_work+0x11c/0x400
> [    8.644810]  process_one_work+0x184/0x370
> [    8.648820]  ? process_one_work+0x184/0x370
> [    8.652996]  worker_thread+0x35/0x3a0
> [    8.656654]  kthread+0x121/0x140
> [    8.659887]  ? process_one_work+0x370/0x370
> [    8.664073]  ? kthread_create_worker_on_cpu+0x70/0x70
> [    8.669118]  ret_from_fork+0x35/0x40
> [    8.672693] Code: c3 8b b9 38 01 00 00 eb aa 48 63 81 38 01 00 00 89 fa 41 89 f8 c1 ea 1f 01 fa d1 fa 48 63 d2 49 89 c2 48 c1 e0 1f 48 01 d0 31 d2 <49> f7 f0 83 e8 01 48 39 ce 89 81 b4 00 00 00 0f 85 e2 fe ff ff 
> [    8.691533] RIP: rt6_multipath_rebalance.part.82+0x1cb/0x1f0 RSP: ffffba72867cbbf8
> [    8.699135] ---[ end trace 9ae26819121cdc3a ]---
> [    8.703760] Kernel panic - not syncing: Fatal exception in interrupt
> [    8.710169] Kernel Offset: 0x3d200000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
> [    8.721256] gsmi: Log Shutdown Reason 0x02
> [    8.725357] Rebooting in 10 seconds..
> 
> 
>