NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
PR/52790 CVS commit: [netbsd-8] src/sys
The following reply was made to PR kern/52790; it has been noted by GNATS.
From: "Soren Jacobsen" <snj%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc:
Subject: PR/52790 CVS commit: [netbsd-8] src/sys
Date: Tue, 2 Jan 2018 10:20:35 +0000
Module Name: src
Committed By: snj
Date: Tue Jan 2 10:20:34 UTC 2018
Modified Files:
src/sys/arch/arm/sunxi [netbsd-8]: sunxi_emac.c
src/sys/dev/ic [netbsd-8]: dwc_gmac.c
src/sys/dev/pci [netbsd-8]: if_iwm.c if_wm.c
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c ixv.c
src/sys/kern [netbsd-8]: sys_socket.c
src/sys/net [netbsd-8]: bpf.c if.c if.h if_bridge.c if_etherip.c
if_ethersubr.c if_faith.c if_gif.c if_l2tp.c if_loop.c if_media.c
if_pppoe.c if_spppsubr.c if_tun.c if_vlan.c rtsock.c
src/sys/net/agr [netbsd-8]: if_agr.c
src/sys/net/npf [netbsd-8]: npf_ifaddr.c npf_os.c
src/sys/netcan [netbsd-8]: if_canloop.c
src/sys/netinet [netbsd-8]: if_arp.c igmp.c in.c in_pcb.c ip_carp.c
ip_flow.c ip_input.c ip_mroute.c ip_output.c
src/sys/netinet6 [netbsd-8]: frag6.c in6.c in6_pcb.c ip6_flow.c
ip6_input.c ip6_output.c mld6.c nd6.c nd6_nbr.c nd6_rtr.c
src/sys/netipsec [netbsd-8]: ipsec_output.c
src/sys/rump/net/lib/libnetinet [netbsd-8]: netinet_component.c
Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #456):
sys/arch/arm/sunxi/sunxi_emac.c: 1.9
sys/dev/ic/dwc_gmac.c: 1.43-1.44
sys/dev/pci/if_iwm.c: 1.75
sys/dev/pci/if_wm.c: 1.543
sys/dev/pci/ixgbe/ixgbe.c: 1.112
sys/dev/pci/ixgbe/ixv.c: 1.74
sys/kern/sys_socket.c: 1.75
sys/net/agr/if_agr.c: 1.43
sys/net/bpf.c: 1.219
sys/net/if.c: 1.397, 1.399, 1.401-1.403, 1.406-1.410, 1.412-1.416
sys/net/if.h: 1.242-1.247, 1.250, 1.252-1.257
sys/net/if_bridge.c: 1.140 via patch, 1.142-1.146
sys/net/if_etherip.c: 1.40
sys/net/if_ethersubr.c: 1.243, 1.246
sys/net/if_faith.c: 1.57
sys/net/if_gif.c: 1.132
sys/net/if_l2tp.c: 1.15, 1.17
sys/net/if_loop.c: 1.98-1.101
sys/net/if_media.c: 1.35
sys/net/if_pppoe.c: 1.131-1.132
sys/net/if_spppsubr.c: 1.176-1.177
sys/net/if_tun.c: 1.142
sys/net/if_vlan.c: 1.107, 1.109, 1.114-1.121
sys/net/npf/npf_ifaddr.c: 1.3
sys/net/npf/npf_os.c: 1.8-1.9
sys/net/rtsock.c: 1.230
sys/netcan/if_canloop.c: 1.3-1.5
sys/netinet/if_arp.c: 1.255
sys/netinet/igmp.c: 1.65
sys/netinet/in.c: 1.210-1.211
sys/netinet/in_pcb.c: 1.180
sys/netinet/ip_carp.c: 1.92, 1.94
sys/netinet/ip_flow.c: 1.81
sys/netinet/ip_input.c: 1.362
sys/netinet/ip_mroute.c: 1.147
sys/netinet/ip_output.c: 1.283, 1.285, 1.287
sys/netinet6/frag6.c: 1.61
sys/netinet6/in6.c: 1.251, 1.255
sys/netinet6/in6_pcb.c: 1.162
sys/netinet6/ip6_flow.c: 1.35
sys/netinet6/ip6_input.c: 1.183
sys/netinet6/ip6_output.c: 1.196
sys/netinet6/mld6.c: 1.90
sys/netinet6/nd6.c: 1.239-1.240
sys/netinet6/nd6_nbr.c: 1.139
sys/netinet6/nd6_rtr.c: 1.136
sys/netipsec/ipsec_output.c: 1.65
sys/rump/net/lib/libnetinet/netinet_component.c: 1.9-1.10
kmem_intr_free kmem_intr_[z]alloced memory
the underlying pools are the same but api-wise those should match
Unify IFEF_*_MPSAFE into IFEF_MPSAFE
There are already two flags for if_output and if_start, however, it seems such
MPSAFE flags are eventually needed for all if_XXX operations. Having discrete
flags for each operation is wasteful of if_extflags bits. So let's unify
the flags into one: IFEF_MPSAFE.
Fortunately IFEF_*_MPSAFE flags have never been included in any releases, so
we can change them without breaking backward compatibility of the releases
(though the kernel version of -current should be bumped).
Note that if an interface have both MP-safe and non-MP-safe operations at a
time, we have to set the IFEF_MPSAFE flag and let callees of non-MP-safe
opeartions take the kernel lock.
Proposed on tech-kern@ and tech-net@
Provide macros for softnet_lock and KERNEL_LOCK hiding NET_MPSAFE switch
It reduces C&P codes such as "#ifndef NET_MPSAFE KERNEL_LOCK(1, NULL); ..."
scattered all over the source code and makes it easy to identify remaining
KERNEL_LOCK and/or softnet_lock that are held even if NET_MPSAFE.
No functional change
Hold KERNEL_LOCK on if_ioctl selectively based on IFEF_MPSAFE
If IFEF_MPSAFE is set, hold the lock and otherwise don't hold.
This change requires additions of KERNEL_LOCK to subsequence functions from
if_ioctl such as ifmedia_ioctl and ifioctl_common to protect non-MP-safe
components.
Proposed on tech-kern@ and tech-net@
Ensure to hold if_ioctl_lock when calling if_flags_set
Fix locking against myself on ifpromisc
vlan_unconfig_locked could be called with holding if_ioctl_lock.
Ensure to not turn on IFF_RUNNING of an interface until its initialization completes
And ensure to turn off it before destruction as per IFF_RUNNING's description
"resource allocated". (The description is a bit doubtful though, I believe the
change is still proper.)
Ensure to hold if_ioctl_lock on if_up and if_down
One exception for if_down is if_detach; in the case the lock isn't needed
because it's guaranteed that no other one can access ifp at that point.
Make if_link_queue MP-safe if IFEF_MPSAFE
if_link_queue is a queue to store events of link state changes, which is
used to pass events from (typically) an interrupt handler to
if_link_state_change softint. The queue was protected by KERNEL_LOCK so far,
but if IFEF_MPSAFE is enabled, it becomes unsafe because (perhaps) an interrupt
handler of an interface with IFEF_MPSAFE doesn't take KERNEL_LOCK. Protect it
by a spin mutex.
Additionally with this change KERNEL_LOCK of if_link_state_change softint is
omitted if NET_MPSAFE is enabled.
Note that the spin mutex is now ifp->if_snd.ifq_lock as well as the case of
if_timer (see the comment).
Use IFADDR_WRITER_FOREACH instead of IFADDR_READER_FOREACH
At that point no other one modifies the list so IFADDR_READER_FOREACH
is unnecessary. Use of IFADDR_READER_FOREACH is harmless in general though,
if we try to detect contract violations of pserialize, using it violates
the contract. So avoid using it makes life easy.
Ensure to call if_addr_init with holding if_ioctl_lock
Get rid of outdated comments
Fix build of kernels without ether
By throwing out if_enable_vlan_mtu and if_disable_vlan_mtu that
created a unnecessary dependency from if.c to if_ethersubr.c.
PR kern/52790
Rename IFNET_LOCK to IFNET_GLOBAL_LOCK
IFNET_LOCK will be used in another lock, if_ioctl_lock (might be renamed then).
Wrap if_ioctl_lock with IFNET_* macros (NFC)
Also if_ioctl_lock perhaps needs to be renamed to something because it's now
not just for ioctl...
Reorder some destruction routines in if_detach
- Destroy if_ioctl_lock at the end of the if_detach because it's used in various
destruction routines
- Move psref_target_destroy after pr_purgeif because we want to use psref in
pr_purgeif (otherwise destruction procedures can be tricky)
Ensure to call if_mcast_op with holding IFNET_LOCK
Note that CARP doesn't deal with IFNET_LOCK yet.
Remove IFNET_GLOBAL_LOCK where it's unnecessary because IFNET_LOCK is held
Describe which lock is used to protect each member variable of struct ifnet
Requested by skrll@
Write a guideline for converting an interface to IFEF_MPSAFE
Requested by skrll@
Note that IFNET_LOCK must not be held in softint
Don't set IFEF_MPSAFE unless NET_MPSAFE at this point
Because recent investigations show that interfaces with IFEF_MPSAFE need to
follow additional restrictions to work with the flag safely. We should enable it
on an interface by default only if the interface surely satisfies the
restrictions, which are described in if.h.
Note that enabling IFEF_MPSAFE solely gains a few benefit on performance because
the network stack is still serialized by the big kernel locks by default.
To generate a diff of this commit:
cvs rdiff -u -r1.4.4.3 -r1.4.4.4 src/sys/arch/arm/sunxi/sunxi_emac.c
cvs rdiff -u -r1.40.6.1 -r1.40.6.2 src/sys/dev/ic/dwc_gmac.c
cvs rdiff -u -r1.73.2.2 -r1.73.2.3 src/sys/dev/pci/if_iwm.c
cvs rdiff -u -r1.508.4.10 -r1.508.4.11 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.88.2.6 -r1.88.2.7 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.3 -r1.56.2.4 src/sys/dev/pci/ixgbe/ixv.c
cvs rdiff -u -r1.74 -r1.74.10.1 src/sys/kern/sys_socket.c
cvs rdiff -u -r1.216.6.3 -r1.216.6.4 src/sys/net/bpf.c
cvs rdiff -u -r1.394.2.3 -r1.394.2.4 src/sys/net/if.c
cvs rdiff -u -r1.239.2.2 -r1.239.2.3 src/sys/net/if.h
cvs rdiff -u -r1.134.6.4 -r1.134.6.5 src/sys/net/if_bridge.c
cvs rdiff -u -r1.38.10.1 -r1.38.10.2 src/sys/net/if_etherip.c
cvs rdiff -u -r1.242.6.1 -r1.242.6.2 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.55.8.1 -r1.55.8.2 src/sys/net/if_faith.c
cvs rdiff -u -r1.126.2.5 -r1.126.2.6 src/sys/net/if_gif.c
cvs rdiff -u -r1.11.2.2 -r1.11.2.3 src/sys/net/if_l2tp.c
cvs rdiff -u -r1.94.6.3 -r1.94.6.4 src/sys/net/if_loop.c
cvs rdiff -u -r1.32.6.1 -r1.32.6.2 src/sys/net/if_media.c
cvs rdiff -u -r1.125.6.4 -r1.125.6.5 src/sys/net/if_pppoe.c
cvs rdiff -u -r1.169.6.2 -r1.169.6.3 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.139.2.1 -r1.139.2.2 src/sys/net/if_tun.c
cvs rdiff -u -r1.97.2.10 -r1.97.2.11 src/sys/net/if_vlan.c
cvs rdiff -u -r1.213.2.3 -r1.213.2.4 src/sys/net/rtsock.c
cvs rdiff -u -r1.41 -r1.41.6.1 src/sys/net/agr/if_agr.c
cvs rdiff -u -r1.2 -r1.2.12.1 src/sys/net/npf/npf_ifaddr.c
cvs rdiff -u -r1.6.8.1 -r1.6.8.2 src/sys/net/npf/npf_os.c
cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/netcan/if_canloop.c
cvs rdiff -u -r1.250.2.3 -r1.250.2.4 src/sys/netinet/if_arp.c
cvs rdiff -u -r1.64 -r1.64.6.1 src/sys/netinet/igmp.c
cvs rdiff -u -r1.203.2.3 -r1.203.2.4 src/sys/netinet/in.c
cvs rdiff -u -r1.178.4.1 -r1.178.4.2 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.90.2.2 -r1.90.2.3 src/sys/netinet/ip_carp.c
cvs rdiff -u -r1.80 -r1.80.6.1 src/sys/netinet/ip_flow.c
cvs rdiff -u -r1.355.2.2 -r1.355.2.3 src/sys/netinet/ip_input.c
cvs rdiff -u -r1.146.6.1 -r1.146.6.2 src/sys/netinet/ip_mroute.c
cvs rdiff -u -r1.279.2.2 -r1.279.2.3 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.60 -r1.60.6.1 src/sys/netinet6/frag6.c
cvs rdiff -u -r1.245.2.3 -r1.245.2.4 src/sys/netinet6/in6.c
cvs rdiff -u -r1.161 -r1.161.4.1 src/sys/netinet6/in6_pcb.c
cvs rdiff -u -r1.34 -r1.34.8.1 src/sys/netinet6/ip6_flow.c
cvs rdiff -u -r1.178.2.2 -r1.178.2.3 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.191.6.3 -r1.191.6.4 src/sys/netinet6/ip6_output.c
cvs rdiff -u -r1.89 -r1.89.2.1 src/sys/netinet6/mld6.c
cvs rdiff -u -r1.232.2.4 -r1.232.2.5 src/sys/netinet6/nd6.c
cvs rdiff -u -r1.138 -r1.138.6.1 src/sys/netinet6/nd6_nbr.c
cvs rdiff -u -r1.135 -r1.135.6.1 src/sys/netinet6/nd6_rtr.c
cvs rdiff -u -r1.48.2.1 -r1.48.2.2 src/sys/netipsec/ipsec_output.c
cvs rdiff -u -r1.8 -r1.8.6.1 \
src/sys/rump/net/lib/libnetinet/netinet_component.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index