mbox series

[v2,net-next,0/7] ipv4 ipv6: Move location of pcpu route cache and exceptions

Message ID 20190428022734.21965-1-dsahern@kernel.org
Headers show
Series ipv4 ipv6: Move location of pcpu route cache and exceptions | expand

Message

David Ahern April 28, 2019, 2:27 a.m. UTC
From: David Ahern <dsahern@gmail.com>

This series moves IPv4 pcpu cached routes from fib_nh to fib_nh_common
to make the caches avaialable for IPv6 nexthops (fib6_nh) with IPv4
routes. This allows a fib6_nh struct to be used with both IPv4 and
and IPv6 routes.

In addition pcpu caches and exception entries for IPv6 routes are
moved from fib6_info to fib6_nh since they are really a function of
the device and gateway. During the move of each, functions are
refactored such that the core logic is in new helpers that take
a fib6_nh versus a fib6_info.

v2
- reverted patch 2 to use ifdef CONFIG_IP_ROUTE_CLASSID instead
  of IS_ENABLED(CONFIG_IP_ROUTE_CLASSID) to fix compile issues
  reported by kbuild test robot

David Ahern (7):
  ipv4: Move cached routes to fib_nh_common
  ipv4: Pass fib_nh_common to rt_cache_route
  ipv4: Move exception bucket to nh_common
  ipv6: Move pcpu cached routes to fib6_nh
  ipv6: Refactor fib6_drop_pcpu_from
  ipv6: Refactor exception functions
  ipv6: Move exception bucket to fib6_nh

 include/net/ip6_fib.h    |  11 +-
 include/net/ip_fib.h     |   8 +-
 net/ipv4/fib_semantics.c |  45 +++----
 net/ipv4/route.c         |  75 ++++++------
 net/ipv6/addrconf.c      |   6 +-
 net/ipv6/ip6_fib.c       |  62 ++++------
 net/ipv6/route.c         | 302 +++++++++++++++++++++++++++++++++--------------
 7 files changed, 305 insertions(+), 204 deletions(-)

Comments

Eric Dumazet April 28, 2019, 3:06 p.m. UTC | #1
On 4/27/19 7:27 PM, David Ahern wrote:
> From: David Ahern <dsahern@gmail.com>
> 
> This series moves IPv4 pcpu cached routes from fib_nh to fib_nh_common
> to make the caches avaialable for IPv6 nexthops (fib6_nh) with IPv4
> routes. This allows a fib6_nh struct to be used with both IPv4 and
> and IPv6 routes.
> 
> In addition pcpu caches and exception entries for IPv6 routes are
> moved from fib6_info to fib6_nh since they are really a function of
> the device and gateway. During the move of each, functions are
> refactored such that the core logic is in new helpers that take
> a fib6_nh versus a fib6_info.
>

I would prefer we fix the existing bugs before moving the code around,
otherwise stable teams work is going to be tough.

We have dozens of syzbot reports involving all this stuff.
Alexei Starovoitov April 28, 2019, 5:53 p.m. UTC | #2
On Sun, Apr 28, 2019 at 8:10 AM Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
>
> On 4/27/19 7:27 PM, David Ahern wrote:
> > From: David Ahern <dsahern@gmail.com>
> >
> > This series moves IPv4 pcpu cached routes from fib_nh to fib_nh_common
> > to make the caches avaialable for IPv6 nexthops (fib6_nh) with IPv4
> > routes. This allows a fib6_nh struct to be used with both IPv4 and
> > and IPv6 routes.
> >
> > In addition pcpu caches and exception entries for IPv6 routes are
> > moved from fib6_info to fib6_nh since they are really a function of
> > the device and gateway. During the move of each, functions are
> > refactored such that the core logic is in new helpers that take
> > a fib6_nh versus a fib6_info.
> >
>
> I would prefer we fix the existing bugs before moving the code around,
> otherwise stable teams work is going to be tough.
>
> We have dozens of syzbot reports involving all this stuff.

+1
Adding tests as we go along would immensely help too.
Unfortunately afaik there is no test infra to use for it.
Anyone has ideas?
David Ahern April 28, 2019, 8:41 p.m. UTC | #3
On 4/28/19 9:06 AM, Eric Dumazet wrote:
> 
> I would prefer we fix the existing bugs before moving the code around,
> otherwise stable teams work is going to be tough.
> 

fair enough. I'll drop the ipv6 patches and re-send just the v4 ones.
David Ahern April 28, 2019, 8:54 p.m. UTC | #4
On 4/28/19 11:53 AM, Alexei Starovoitov wrote:
> Adding tests as we go along would immensely help too.
> Unfortunately afaik there is no test infra to use for it.


pcpu routes are the predominant ones used for traffic. We have a number
of existing tests in selftests - fib_tests.sh - that exercise the code
paths touched by this set. That includes their entire life cycle - from
FIB entry create, to running traffic or 'ip route get' to cleanup.

For the exception code paths selftests has pmtu.sh which covers creation
of entries, updates and deletes.

Both of those cover IPv4 and IPv6.


I have a vrf test suite which covers functional tests under a lot of
permutations (ie., sysctls, APIs, remote traffic, local traffic,
negative tests, ...) as well as some runtime tests (e.g., active and
passive socket with device kills). All of these are run using namespaces
which are created and destroyed 100's of times during a run which covers
cleanup of resources (eg, netdev refcnts). While the tests were started
for VRF they cover non-VRF tests too as 1 namespace uses VRF and other
does not. I run this suite with a performance focused kernel config and
one with rculock debugging and kmemleak enabled. I am currently
re-working the script into something suitable for selftests. I might get
it out this dev cycle, if not the beginning of the next.

I am also reworking a lot of the above to handle nexthop objects in
addition to its own standalone set of functional tests.