]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Widen NET_EPOCH coverage.
authorGleb Smirnoff <glebius@FreeBSD.org>
Mon, 7 Oct 2019 22:40:05 +0000 (22:40 +0000)
committerGleb Smirnoff <glebius@FreeBSD.org>
Mon, 7 Oct 2019 22:40:05 +0000 (22:40 +0000)
commitb8a6e03fac922677455d8e0977831506cf8212e8
tree28fc099c8daca3278068766b2863e110876865ce
parent746c7ae563142eaae423b0e6c0077ef2013c2435
Widen NET_EPOCH coverage.

When epoch(9) was introduced to network stack, it was basically
dropped in place of existing locking, which was mutexes and
rwlocks. For the sake of performance mutex covered areas were
as small as possible, so became epoch covered areas.

However, epoch doesn't introduce any contention, it just delays
memory reclaim. So, there is no point to minimise epoch covered
areas in sense of performance. Meanwhile entering/exiting epoch
also has non-zero CPU usage, so doing this less often is a win.

Not the least is also code maintainability. In the new paradigm
we can assume that at any stage of processing a packet, we are
inside network epoch. This makes coding both input and output
path way easier.

On output path we already enter epoch quite early - in the
ip_output(), in the ip6_output().

This patch does the same for the input path. All ISR processing,
network related callouts, other ways of packet injection to the
network stack shall be performed in net_epoch. Any leaf function
that walks network configuration now asserts epoch.

Tricky part is configuration code paths - ioctls, sysctls. They
also call into leaf functions, so some need to be changed.

This patch would introduce more epoch recursions (see EPOCH_TRACE)
than we had before. They will be cleaned up separately, as several
of them aren't trivial. Note, that unlike a lock recursion the
epoch recursion is safe and just wastes a bit of resources.

Reviewed by: gallatin, hselasky, cy, adrian, kristof
Differential Revision: https://reviews.freebsd.org/D19111
49 files changed:
sys/contrib/ipfilter/netinet/ip_fil_freebsd.c
sys/dev/firewire/if_fwip.c
sys/dev/iicbus/if_ic.c
sys/dev/usb/net/if_usie.c
sys/dev/usb/net/uhso.c
sys/dev/usb/net/usb_ethernet.c
sys/kern/uipc_socket.c
sys/net/if.c
sys/net/if_ethersubr.c
sys/net/if_gif.c
sys/net/if_me.c
sys/net/if_stf.c
sys/net/if_tuntap.c
sys/net/if_vlan.c
sys/net/netisr.c
sys/net/route.c
sys/net/rtsock.c
sys/netgraph/ng_ether.c
sys/netgraph/ng_iface.c
sys/netgraph/ng_ip_input.c
sys/netinet/if_ether.c
sys/netinet/igmp.c
sys/netinet/in.c
sys/netinet/in_mcast.c
sys/netinet/in_rmx.c
sys/netinet/in_var.h
sys/netinet/ip_carp.c
sys/netinet/ip_encap.c
sys/netinet/ip_icmp.c
sys/netinet/ip_input.c
sys/netinet/ip_mroute.c
sys/netinet/ip_options.c
sys/netinet/ip_output.c
sys/netinet/sctp_bsd_addr.c
sys/netinet6/icmp6.c
sys/netinet6/in6.c
sys/netinet6/in6_ifattach.c
sys/netinet6/in6_mcast.c
sys/netinet6/in6_var.h
sys/netinet6/ip6_output.c
sys/netinet6/mld6.c
sys/netinet6/nd6.c
sys/netinet6/nd6_nbr.c
sys/netinet6/nd6_rtr.c
sys/netinet6/raw_ip6.c
sys/netipsec/xform_ipcomp.c
sys/netpfil/ipfw/ip_dn_io.c
sys/netpfil/pf/pf_if.c
sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c