1. 01 Dec, 2022 24 commits
    • David Howells's avatar
      rxrpc: Implement a mechanism to send an event notification to a call · 15f661dc
      David Howells authored
      Provide a means by which an event notification can be sent to a call such
      that the I/O thread can process it rather than it being done in a separate
      workqueue.  This will allow a lot of locking to be removed.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      15f661dc
    • David Howells's avatar
      rxrpc: Don't use sk->sk_receive_queue.lock to guard socket state changes · 81f2e8ad
      David Howells authored
      Don't use sk->sk_receive_queue.lock to guard socket state changes as the
      socket mutex is sufficient.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      81f2e8ad
    • David Howells's avatar
      rxrpc: Remove call->input_lock · 4041a8ff
      David Howells authored
      Remove call->input_lock as it was only necessary to serialise access to the
      state stored in the rxrpc_call struct by simultaneous softirq handlers
      presenting received packets.  They now dump the packets in a queue and a
      single process-context handler now processes them.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      4041a8ff
    • David Howells's avatar
      rxrpc: Move error processing into the local endpoint I/O thread · ff734825
      David Howells authored
      Move the processing of error packets into the local endpoint I/O thread,
      leaving the handover from UDP to merely transfer them into the local
      endpoint queue.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      ff734825
    • David Howells's avatar
      rxrpc: Move packet reception processing into I/O thread · 446b3e14
      David Howells authored
      Split the packet input handler to make the softirq side just dump the
      received packet into the local endpoint receive queue and then call the
      remainder of the input function from the I/O thread.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      446b3e14
    • David Howells's avatar
      rxrpc: Create a per-local endpoint receive queue and I/O thread · a275da62
      David Howells authored
      Create a per-local receive queue to which, in a future patch, all incoming
      packets will be directed and an I/O thread that will process those packets
      and perform all transmission of packets.
      
      Destruction of the local endpoint is also moved from the local processor
      work item (which will be absorbed) to the thread.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      a275da62
    • David Howells's avatar
      rxrpc: Split the receive code · 96b2d69b
      David Howells authored
      Split the code that handles packet reception in softirq mode as a prelude
      to moving all the packet processing beyond routing to the appropriate call
      and setting up of a new call out into process context.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      96b2d69b
    • David Howells's avatar
      rxrpc: Don't hold a ref for connection workqueue · 3cec055c
      David Howells authored
      Currently, rxrpc gives the connection's work item a ref on the connection
      when it queues it - and this is called from the timer expiration function.
      The problem comes when queue_work() fails (ie. the work item is already
      queued): the timer routine must put the ref - but this may cause the
      cleanup code to run.
      
      This has the unfortunate effect that the cleanup code may then be run in
      softirq context - which means that any spinlocks it might need to touch
      have to be guarded to disable softirqs (ie. they need a "_bh" suffix).
      
       (1) Don't give a ref to the work item.
      
       (2) Simplify handling of service connections by adding a separate active
           count so that the refcount isn't also used for this.
      
       (3) Connection destruction for both client and service connections can
           then be cleaned up by putting rxrpc_put_connection() out of line and
           making a tidy progression through the destruction code (offloaded to a
           workqueue if put from softirq or processor function context).  The RCU
           part of the cleanup then only deals with the freeing at the end.
      
       (4) Make rxrpc_queue_conn() return immediately if it sees the active count
           is -1 rather then queuing the connection.
      
       (5) Make sure that the cleanup routine waits for the work item to
           complete.
      
       (6) Stash the rxrpc_net pointer in the conn struct so that the rcu free
           routine can use it, even if the local endpoint has been freed.
      
      Unfortunately, neither the timer nor the work item can simply get around
      the problem by just using refcount_inc_not_zero() as the waits would still
      have to be done, and there would still be the possibility of having to put
      the ref in the expiration function.
      
      Note the connection work item is mostly going to go away with the main
      event work being transferred to the I/O thread, so the wait in (6) will
      become obsolete.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      3cec055c
    • David Howells's avatar
      rxrpc: Don't hold a ref for call timer or workqueue · 3feda9d6
      David Howells authored
      Currently, rxrpc gives the call timer a ref on the call when it starts it
      and this is passed along to the workqueue by the timer expiration function.
      The problem comes when queue_work() fails (ie. the work item is already
      queued): the timer routine must put the ref - but this may cause the
      cleanup code to run.
      
      This has the unfortunate effect that the cleanup code may then be run in
      softirq context - which means that any spinlocks it might need to touch
      have to be guarded to disable softirqs (ie. they need a "_bh" suffix).
      
      Fix this by:
      
       (1) Don't give a ref to the timer.
      
       (2) Making the expiration function not do anything if the refcount is 0.
           Note that this is more of an optimisation.
      
       (3) Make sure that the cleanup routine waits for timer to complete.
      
      However, this has a consequence that timer cannot give a ref to the work
      item.  Therefore the following fixes are also necessary:
      
       (4) Don't give a ref to the work item.
      
       (5) Make the work item return asap if it sees the ref count is 0.
      
       (6) Make sure that the cleanup routine waits for the work item to
           complete.
      
      Unfortunately, neither the timer nor the work item can simply get around
      the problem by just using refcount_inc_not_zero() as the waits would still
      have to be done, and there would still be the possibility of having to put
      the ref in the expiration function.
      
      Note the call work item is going to go away with the work being transferred
      to the I/O thread, so the wait in (6) will become obsolete.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      3feda9d6
    • David Howells's avatar
      rxrpc: trace: Don't use __builtin_return_address for sk_buff tracing · 9a36a6bc
      David Howells authored
      In rxrpc tracing, use enums to generate lists of points of interest rather
      than __builtin_return_address() for the sk_buff tracepoint.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      9a36a6bc
    • David Howells's avatar
      rxrpc: Trace rxrpc_bundle refcount · fa3492ab
      David Howells authored
      Add a tracepoint for the rxrpc_bundle refcounting.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      fa3492ab
    • David Howells's avatar
      rxrpc: trace: Don't use __builtin_return_address for rxrpc_call tracing · cb0fc0c9
      David Howells authored
      In rxrpc tracing, use enums to generate lists of points of interest rather
      than __builtin_return_address() for the rxrpc_call tracepoint
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      cb0fc0c9
    • David Howells's avatar
      rxrpc: trace: Don't use __builtin_return_address for rxrpc_conn tracing · 7fa25105
      David Howells authored
      In rxrpc tracing, use enums to generate lists of points of interest rather
      than __builtin_return_address() for the rxrpc_conn tracepoint
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      7fa25105
    • David Howells's avatar
      rxrpc: trace: Don't use __builtin_return_address for rxrpc_peer tracing · 47c810a7
      David Howells authored
      In rxrpc tracing, use enums to generate lists of points of interest rather
      than __builtin_return_address() for the rxrpc_peer tracepoint
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      47c810a7
    • David Howells's avatar
      rxrpc: trace: Don't use __builtin_return_address for rxrpc_local tracing · 0fde882f
      David Howells authored
      In rxrpc tracing, use enums to generate lists of points of interest rather
      than __builtin_return_address() for the rxrpc_local tracepoint
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      0fde882f
    • David Howells's avatar
      rxrpc: Extract the code from a received ABORT packet much earlier · f14febd8
      David Howells authored
      Extract the code from a received rx ABORT packet much earlier and in a
      single place and harmonise the responses to malformed ABORT packets.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      f14febd8
    • David Howells's avatar
      rxrpc: Drop rxrpc_conn_parameters from rxrpc_connection and rxrpc_bundle · 2cc80086
      David Howells authored
      Remove the rxrpc_conn_parameters struct from the rxrpc_connection and
      rxrpc_bundle structs and emplace the members directly.  These are going to
      get filled in from the rxrpc_call struct in future.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      2cc80086
    • David Howells's avatar
      rxrpc: Remove the [_k]net() debugging macros · e969c92c
      David Howells authored
      Remove the _net() and knet() debugging macros in favour of tracepoints.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      e969c92c
    • David Howells's avatar
      rxrpc: Remove the [k_]proto() debugging macros · 2ebdb26e
      David Howells authored
      Remove the kproto() and _proto() debugging macros in preference to using
      tracepoints for this.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      2ebdb26e
    • David Howells's avatar
      rxrpc: Remove handling of duplicate packets in recvmsg_queue · 30efa3ce
      David Howells authored
      We should not now see duplicate packets in the recvmsg_queue.  At one
      point, jumbo packets that overlapped with already queued data would be
      added to the queue and dealt with in recvmsg rather than in the softirq
      input code, but now jumbo packets are split/cloned before being processed
      by the input code and the subpackets can be discarded individually.
      
      So remove the recvmsg-side code for handling this.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      30efa3ce
    • David Howells's avatar
      rxrpc: Remove decl for rxrpc_kernel_call_is_complete() · 2ed83ed2
      David Howells authored
      rxrpc_kernel_call_is_complete() has been removed, so remove its declaration
      too.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      2ed83ed2
    • David Howells's avatar
      rxrpc: Fix call leak · 49df54a6
      David Howells authored
      When retransmitting a packet, rxrpc_resend() shouldn't be attaching a ref
      to the call to the txbuf as that pins the call and prevents the call from
      clearing the packet buffer.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Fixes: d57a3a15 ("rxrpc: Save last ACK's SACK table rather than marking txbufs")
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      49df54a6
    • David Howells's avatar
      rxrpc: Implement an in-kernel rxperf server for testing purposes · 75bfdbf2
      David Howells authored
      Implement an in-kernel rxperf server to allow kernel-based rxrpc services
      to be tested directly, unlike with AFS where they're accessed by the
      fileserver when the latter decides it wants to.
      
      This is implemented as a module that, if loaded, opens UDP port 7009
      (afs3-rmtsys) and listens on it for incoming calls.  Calls can be generated
      using the rxperf command shipped with OpenAFS, for example.
      
      Changes
      =======
      ver #2)
       - Use min_t() instead of min().
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      cc: Jakub Kicinski <kuba@kernel.org>
      75bfdbf2
    • David Howells's avatar
      rxrpc: Fix checker warning · 84924aac
      David Howells authored
      Fix the following checker warning:
      
      ../net/rxrpc/key.c:692:9: error: subtraction of different types can't work (different address spaces)
      
      Checker is wrong in this case, but cast the pointers to unsigned long to
      avoid the warning.
      
      Whilst we're at it, reduce the assertions to WARN_ON() and return an error.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      84924aac
  2. 30 Nov, 2022 15 commits
  3. 29 Nov, 2022 1 commit