Skip to content

inet: socket lock and data-races avoidance

Eric Dumazet mptcp netdev 4 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest15 patches 3 repliesApplied 15/15
  2. v315 patches 1 replySuperseded
  3. v215 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v115 patches1 replySuperseded

Patches in v4 All 15 applied

#Subject and filesSizeRepliesApplied
1/15inet: introduce inet->inet_flagsinclude/net/inet_sock.h net/ipv4/ip_sockglue.c net/ipv4/ping.c +5 more+83 -710 repliesApplied
2/15inet: set/get simple options locklesslynet/ipv4/ip_sockglue.c+62 -560 repliesApplied
3/15inet: move inet->recverr to inet->inet_flagsinclude/net/inet_sock.h net/dccp/ipv4.c net/ipv4/inet_diag.c +6 more+30 -320 repliesApplied
4/15inet: move inet->recverr_rfc4884 to inet->inet_flagsinclude/net/inet_sock.h net/ipv4/inet_diag.c net/ipv4/ip_sockglue.c+11 -110 repliesApplied
5/15inet: move inet->freebind to inet->inet_flagsinclude/net/inet_sock.h include/net/ipv6.h net/ipv4/inet_diag.c +4 more+22 -221 replyApplied
6/15inet: move inet->hdrincl to inet->inet_flagsinclude/net/inet_sock.h net/ipv4/af_inet.c net/ipv4/inet_diag.c +7 more+31 -410 repliesApplied
7/15inet: move inet->mc_loop to inet->inet_fragsinclude/net/inet_sock.h net/core/sock.c net/ipv4/af_inet.c +6 more+16 -180 repliesApplied
8/15inet: move inet->mc_all to inet->inet_fragsinclude/net/inet_sock.h net/ipv4/af_inet.c net/ipv4/igmp.c +2 more+15 -150 repliesApplied
9/15inet: move inet->transparent to inet->inet_flagsinclude/net/inet_sock.h include/net/ipv6.h include/net/route.h +8 more+30 -341 replyApplied
10/15inet: move inet->is_icsk to inet->inet_flagsinclude/net/inet_connection_sock.h include/net/inet_sock.h net/ipv4/af_inet.c +5 more+13 -140 repliesApplied
11/15inet: move inet->nodefrag to inet->inet_flagsinclude/net/inet_sock.h net/ipv4/af_inet.c net/ipv4/inet_diag.c +3 more+14 -160 repliesApplied
12/15inet: move inet->bind_address_no_port to inet->inet_flagsinclude/net/inet_sock.h net/ipv4/af_inet.c net/ipv4/inet_diag.c +2 more+11 -110 repliesApplied
13/15inet: move inet->defer_connect to inet->inet_flagsinclude/net/inet_sock.h net/ipv4/af_inet.c net/ipv4/inet_diag.c +3 more+21 -191 replyApplied
14/15inet: implement lockless IP_TTLnet/ipv4/ip_output.c net/ipv4/ip_sockglue.c+13 -160 repliesApplied
15/15inet: implement lockless IP_MINTTLnet/ipv4/ip_sockglue.c+14 -180 repliesApplied

Reviews trailers per patch

All 15 patches have a Reviewed-by or Acked-by.

PatchSoheil Hassas YeganehSimon HormanMatthieu Baerts
1/15A-b R-b
2/15A-b R-b
3/15A-b R-b
4/15A-b R-b
5/15A-b R-b R-b
6/15A-b R-b
7/15A-b R-b
8/15A-b R-b
9/15A-b R-b R-b
10/15A-b R-b
11/15A-b R-b
12/15A-b R-b
13/15A-b R-b R-b
14/15A-b R-b
15/15A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 net-next 00/15] inet: socket lock and data-races avoidance

In this series, I converted 20 bits in "struct inet_sock" and made them truly atomic.

This allows to implement many IP_ socket options in a lockless fashion (no need to acquire socket lock), and fixes data-races that were showing up in various KCSAN reports.

I also took care of IP_TTL/IP_MINTTL, but left few other options for another series.

v4: Rebased after recent mptcp changes.
Added Reviewed-by: tags from Simon (thanks !)

v3: fixed patch 7, feedback from build bot about ipvs set_mcast_loop()

v2: addressed a feedback from a build bot in patch 9 by removing
unused issk variable in mptcp_setsockopt_sol_ip_set_transparent() Added Acked-by: tags from Soheil (thanks !)

Eric Dumazet (15):
inet: introduce inet->inet_flags
inet: set/get simple options locklessly
inet: move inet->recverr to inet->inet_flags
inet: move inet->recverr_rfc4884 to inet->inet_flags
inet: move inet->freebind to inet->inet_flags
inet: move inet->hdrincl to inet->inet_flags
inet: move inet->mc_loop to inet->inet_frags
inet: move inet->mc_all to inet->inet_frags
inet: move inet->transparent to inet->inet_flags
inet: move inet->is_icsk to inet->inet_flags
inet: move inet->nodefrag to inet->inet_flags
inet: move inet->bind_address_no_port to inet->inet_flags
inet: move inet->defer_connect to inet->inet_flags
inet: implement lockless IP_TTL
inet: implement lockless IP_MINTTL

 include/net/inet_connection_sock.h  |   4 +-
 include/net/inet_sock.h             |  92 ++++---
 include/net/ipv6.h                  |   3 +-
 include/net/route.h                 |   2 +-
 include/net/tcp.h                   |   2 +-
 net/core/sock.c                     |   2 +-
 net/dccp/ipv4.c                     |   4 +-
 net/ipv4/af_inet.c                  |  16 +-
 net/ipv4/cipso_ipv4.c               |   4 +-
 net/ipv4/igmp.c                     |   2 +-
 net/ipv4/inet_diag.c                |  22 +-
 net/ipv4/inet_timewait_sock.c       |   2 +-
 net/ipv4/ip_output.c                |   7 +-
 net/ipv4/ip_sockglue.c              | 405 +++++++++++++---------------
 net/ipv4/netfilter/nf_defrag_ipv4.c |   2 +-
 net/ipv4/ping.c                     |   7 +-
 net/ipv4/raw.c                      |  26 +-
 net/ipv4/route.c                    |   8 +-
 net/ipv4/tcp.c                      |  12 +-
 net/ipv4/tcp_fastopen.c             |   2 +-
 net/ipv4/tcp_input.c                |   2 +-
 net/ipv4/tcp_ipv4.c                 |   5 +-
 net/ipv4/tcp_minisocks.c            |   3 +-
 net/ipv4/udp.c                      |   7 +-
 net/ipv4/udp_tunnel_core.c          |   2 +-
 net/ipv6/af_inet6.c                 |   8 +-
 net/ipv6/datagram.c                 |   2 +-
 net/ipv6/ip6_output.c               |   5 +-
 net/ipv6/ipv6_sockglue.c            |  12 +-
 net/ipv6/raw.c                      |  16 +-
 net/ipv6/udp.c                      |   2 +-
 net/l2tp/l2tp_ip.c                  |   2 +-
 net/mptcp/protocol.c                |  10 +-
 net/mptcp/sockopt.c                 |  18 +-
 net/netfilter/ipvs/ip_vs_core.c     |   4 +-
 net/netfilter/ipvs/ip_vs_sync.c     |   4 +-
 net/sctp/input.c                    |   2 +-
 net/sctp/protocol.c                 |   2 +-
 net/sctp/socket.c                   |   2 +-
 39 files changed, 362 insertions(+), 370 deletions(-)
Signature · 1 line
2.41.0.694.ge786442a9b-goog