]> www.infradead.org Git - users/hch/misc.git/commitdiff
rxrpc: peer->mtu_lock is redundant
authorDavid Howells <dhowells@redhat.com>
Tue, 18 Feb 2025 19:22:45 +0000 (19:22 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 21 Feb 2025 23:06:29 +0000 (15:06 -0800)
The peer->mtu_lock is only used to lock around writes to peer->max_data -
and nothing else; further, all such writes take place in the I/O thread and
the lock is only ever write-locked and never read-locked.

In a couple of places, the write_seqcount_begin() is wrapped in
preempt_disable/enable(), but not in all places.  This can cause lockdep to
complain:

WARNING: CPU: 0 PID: 1549 at include/linux/seqlock.h:221 rxrpc_input_ack_trailer+0x305/0x430
...
RIP: 0010:rxrpc_input_ack_trailer+0x305/0x430

Fix this by just getting rid of the lock.

Fixes: eeaedc5449d9 ("rxrpc: Implement path-MTU probing using padded PING ACKs (RFC8899)")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
Link: https://patch.msgid.link/20250218192250.296870-3-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/rxrpc/ar-internal.h
net/rxrpc/input.c
net/rxrpc/peer_event.c
net/rxrpc/peer_object.c

index 5e740c48620349868980bfb3d24f8e206e965475..a64a0cab1bf7f92a89bbc4fd14987ad335b1ff9f 100644 (file)
@@ -360,7 +360,6 @@ struct rxrpc_peer {
        u8                      pmtud_jumbo;    /* Max jumbo packets for the MTU */
        bool                    ackr_adv_pmtud; /* T if the peer advertises path-MTU */
        unsigned int            ackr_max_data;  /* Maximum data advertised by peer */
-       seqcount_t              mtu_lock;       /* Lockless MTU access management */
        unsigned int            if_mtu;         /* Local interface MTU (- hdrsize) for this peer */
        unsigned int            max_data;       /* Maximum packet data capacity for this peer */
        unsigned short          hdrsize;        /* header size (IP + UDP + RxRPC) */
index 9047ba13bd31eb68ea73a877a3155058a266e42d..24aceb183c2c3009268273b79d820b9cc48f79d2 100644 (file)
@@ -810,9 +810,7 @@ static void rxrpc_input_ack_trailer(struct rxrpc_call *call, struct sk_buff *skb
        if (max_mtu < peer->max_data) {
                trace_rxrpc_pmtud_reduce(peer, sp->hdr.serial, max_mtu,
                                         rxrpc_pmtud_reduce_ack);
-               write_seqcount_begin(&peer->mtu_lock);
                peer->max_data = max_mtu;
-               write_seqcount_end(&peer->mtu_lock);
        }
 
        max_data = umin(max_mtu, peer->max_data);
index bc283da9ee40246ba276b500be399522b09c1045..7f4729234957e818abf652ccff97d24650518401 100644 (file)
@@ -130,9 +130,7 @@ static void rxrpc_adjust_mtu(struct rxrpc_peer *peer, unsigned int mtu)
                        peer->pmtud_bad = max_data + 1;
 
                trace_rxrpc_pmtud_reduce(peer, 0, max_data, rxrpc_pmtud_reduce_icmp);
-               write_seqcount_begin(&peer->mtu_lock);
                peer->max_data = max_data;
-               write_seqcount_end(&peer->mtu_lock);
        }
 }
 
@@ -408,13 +406,8 @@ void rxrpc_input_probe_for_pmtud(struct rxrpc_connection *conn, rxrpc_serial_t a
        }
 
        max_data = umin(max_data, peer->ackr_max_data);
-       if (max_data != peer->max_data) {
-               preempt_disable();
-               write_seqcount_begin(&peer->mtu_lock);
+       if (max_data != peer->max_data)
                peer->max_data = max_data;
-               write_seqcount_end(&peer->mtu_lock);
-               preempt_enable();
-       }
 
        jumbo = max_data + sizeof(struct rxrpc_jumbo_header);
        jumbo /= RXRPC_JUMBO_SUBPKTLEN;
index 0fcc87f0409f908e7f3741738bf02e8c75d35367..2ddc8ed68742924dc83dc3cce89af95896a42b74 100644 (file)
@@ -235,7 +235,6 @@ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp,
                peer->service_conns = RB_ROOT;
                seqlock_init(&peer->service_conn_lock);
                spin_lock_init(&peer->lock);
-               seqcount_init(&peer->mtu_lock);
                peer->debug_id = atomic_inc_return(&rxrpc_debug_id);
                peer->recent_srtt_us = UINT_MAX;
                peer->cong_ssthresh = RXRPC_TX_MAX_WINDOW;