mbox series

[net-next,00/35] rxrpc: Increasing SACK size and moving away from softirq, parts 2 & 3

Message ID 166982725699.621383.2358362793992993374.stgit@warthog.procyon.org.uk (mailing list archive)
Headers show
Series rxrpc: Increasing SACK size and moving away from softirq, parts 2 & 3 | expand

Message

David Howells Nov. 30, 2022, 4:54 p.m. UTC
Here are the second and third parts of patches in the process of moving
rxrpc from doing a lot of its stuff in softirq context to doing it in an
I/O thread in process context and thereby making it easier to support a
larger SACK table.

The full description is in the description for the first part[1] which is
already in net-next.

The second part includes some cleanups, adds some testing and overhauls
some tracing:

 (1) Remove declaration of rxrpc_kernel_call_is_complete() as the
     definition is no longer present.

 (2) Remove the knet() and kproto() macros in favour of using tracepoints.

 (3) Remove handling of duplicate packets from recvmsg.  The input side
     isn't now going to insert overlapping/duplicate packets into the
     recvmsg queue.

 (4) Don't use the rxrpc_conn_parameters struct in the rxrpc_connection or
     rxrpc_bundle structs - rather put the members in directly.

 (5) Extract the abort code from a received abort packet right up front
     rather than doing it in multiple places later.

 (6) Use enums and symbol lists rather than __builtin_return_address() to
     indicate where a tracepoint was triggered for local, peer, conn, call
     and skbuff tracing.

 (7) Add a refcount tracepoint for the rxrpc_bundle struct.

 (8) Implement an in-kernel server for the AFS rxperf testing program to
     talk to (enabled by a Kconfig option).

This is tagged as rxrpc-next-20221130-a.

The third part introduces the I/O thread and switches various bits over to
running there:

 (1) Fix call timers and call and connection workqueues to not hold refs on
     the rxrpc_call and rxrpc_connection structs to thereby avoid messy
     cleanup when the last ref is put in softirq mode.

 (2) Split input.c so that the call packet processing bits are separate
     from the received packet distribution bits.  Call packet processing
     gets bumped over to the call event handler.

 (3) Create a per-local endpoint I/O thread.  Barring some tiny bits that
     still get done in softirq context, all packet reception, processing
     and transmission is done in this thread.  That will allow a load of
     locking to be removed.

 (4) Perform packet processing and error processing from the I/O thread.

 (5) Provide a mechanism to process call event notifications in the I/O
     thread rather than queuing a work item for that call.

 (6) Move data and ACK transmission into the I/O thread.  ACKs can then be
     transmitted at the point they're generated rather than getting
     delegated from softirq context to some process context somewhere.

 (7) Move call and local processor event handling into the I/O thread.

 (8) Move cwnd degradation to after packets have been transmitted so that
     they don't shorten the window too quickly.

A bunch of simplifications can then be done:

 (1) The input_lock is no longer necessary as exclusion is achieved by
     running the code in the I/O thread only.

 (2) Don't need to use sk->sk_receive_queue.lock to guard socket state
     changes as the socket mutex should suffice.

 (3) Don't take spinlocks in RCU callback functions as they get run in
     softirq context and thus need _bh annotations.

 (4) RCU is then no longer needed for the peer's error_targets list.

 (5) Simplify the skbuff handling in the receive path by dropping the ref
     in the basic I/O thread loop and getting an extra ref as and when we
     need to queue the packet for recvmsg or another context.

 (6) Get the peer address earlier in the input process and pass it to the
     users so that we only do it once.

This is tagged as rxrpc-next-20221130-b.

Tested-by: Marc Dionne <marc.dionne@auristor.com>
Tested-by: kafs-testing+fedora36_64checkkafs-build-144@auristor.com
Link: https://lore.kernel.org/r/166794587113.2389296.16484814996876530222.stgit@warthog.procyon.org.uk/ [1]

---
The patches are tagged here:

	git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git tags/rxrpc-next-20221130-b

And can be found on this branch:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=rxrpc-next

David
---
David Howells (35):
      rxrpc: Implement an in-kernel rxperf server for testing purposes
      rxrpc: Fix call leak
      rxrpc: Remove decl for rxrpc_kernel_call_is_complete()
      rxrpc: Remove handling of duplicate packets in recvmsg_queue
      rxrpc: Remove the [k_]proto() debugging macros
      rxrpc: Remove the [_k]net() debugging macros
      rxrpc: Drop rxrpc_conn_parameters from rxrpc_connection and rxrpc_bundle
      rxrpc: Extract the code from a received ABORT packet much earlier
      rxrpc: trace: Don't use __builtin_return_address for rxrpc_local tracing
      rxrpc: trace: Don't use __builtin_return_address for rxrpc_peer tracing
      rxrpc: trace: Don't use __builtin_return_address for rxrpc_conn tracing
      rxrpc: trace: Don't use __builtin_return_address for rxrpc_call tracing
      rxrpc: Trace rxrpc_bundle refcount
      rxrpc: trace: Don't use __builtin_return_address for sk_buff tracing
      rxrpc: Don't hold a ref for call timer or workqueue
      rxrpc: Don't hold a ref for connection workqueue
      rxrpc: Split the receive code
      rxrpc: Create a per-local endpoint receive queue and I/O thread
      rxrpc: Move packet reception processing into I/O thread
      rxrpc: Move error processing into the local endpoint I/O thread
      rxrpc: Remove call->input_lock
      rxrpc: Don't use sk->sk_receive_queue.lock to guard socket state changes
      rxrpc: Implement a mechanism to send an event notification to a call
      rxrpc: Copy client call parameters into rxrpc_call earlier
      rxrpc: Move DATA transmission into call processor work item
      rxrpc: Remove RCU from peer->error_targets list
      rxrpc: Simplify skbuff accounting in receive path
      rxrpc: Reduce the use of RCU in packet input
      rxrpc: Extract the peer address from an incoming packet earlier
      rxrpc: Make the I/O thread take over the call and local processor work
      rxrpc: Remove the _bh annotation from all the spinlocks
      rxrpc: Trace/count transmission underflows and cwnd resets
      rxrpc: Move the cwnd degradation after transmitting packets
      rxrpc: Fold __rxrpc_unuse_local() into rxrpc_unuse_local()
      rxrpc: Transmit ACKs at the point of generation


 include/net/af_rxrpc.h       |   2 +-
 include/trace/events/rxrpc.h | 486 +++++++++++++++++++-------
 net/rxrpc/Kconfig            |   7 +
 net/rxrpc/Makefile           |   4 +
 net/rxrpc/af_rxrpc.c         |  18 +-
 net/rxrpc/ar-internal.h      | 211 +++++------
 net/rxrpc/call_accept.c      | 191 +++++-----
 net/rxrpc/call_event.c       | 260 ++++++++------
 net/rxrpc/call_object.c      | 318 ++++++++---------
 net/rxrpc/conn_client.c      | 143 ++++----
 net/rxrpc/conn_event.c       | 128 ++++---
 net/rxrpc/conn_object.c      | 309 ++++++++---------
 net/rxrpc/conn_service.c     |  29 +-
 net/rxrpc/input.c            | 653 +++++------------------------------
 net/rxrpc/io_thread.c        | 496 ++++++++++++++++++++++++++
 net/rxrpc/key.c              |   2 +-
 net/rxrpc/local_event.c      |  46 +--
 net/rxrpc/local_object.c     | 167 +++------
 net/rxrpc/net_ns.c           |   2 +-
 net/rxrpc/output.c           | 227 ++++++------
 net/rxrpc/peer_event.c       | 167 +++------
 net/rxrpc/peer_object.c      |  52 ++-
 net/rxrpc/proc.c             |  67 ++--
 net/rxrpc/recvmsg.c          |  88 ++---
 net/rxrpc/rxkad.c            |  63 ++--
 net/rxrpc/rxperf.c           | 619 +++++++++++++++++++++++++++++++++
 net/rxrpc/security.c         |  34 +-
 net/rxrpc/sendmsg.c          | 105 ++----
 net/rxrpc/server_key.c       |  25 ++
 net/rxrpc/skbuff.c           |  36 +-
 net/rxrpc/txbuf.c            |  15 +-
 31 files changed, 2873 insertions(+), 2097 deletions(-)
 create mode 100644 net/rxrpc/io_thread.c
 create mode 100644 net/rxrpc/rxperf.c