Re: [PATCH 01/41] rxrpc: Fix RTT determination to use PING ACKs as a source

From: Jeffrey E Altman
Date: Fri Nov 10 2023 - 12:57:16 EST


On 11/10/2023 9:15 AM, Jeffrey E Altman wrote:

I'm not sure how expanding it internally to 64-bits actually helps since the
upper 32 bits is not visible to the peer.
rxrpc_complete_rtt_probe contains the following logic that relies on after() being able to detect
a serial number wrap.

        /* If a later serial is being acked, then mark this slot as
         * being available.
         */

        if (after(acked_serial, orig_serial)) {
            trace_rxrpc_rtt_rx(call, rxrpc_rtt_rx_obsolete, i,
                       orig_serial, acked_serial, 0, 0);
            clear_bit(i + RXRPC_CALL_RTT_PEND_SHIFT, &call->rtt_avail);
            smp_wmb();
            set_bit(i, &call->rtt_avail);
        }

Otherwise, acked_serial = 0x01 will be considered smaller than orig_serial = 0xfffffffe and the slot will not be marked available.

I will note that there is a similar problem with rxrpc_seq_t values which are u32 on the wire but which will wrap for calls that transmit more than approximately 5.5TB of data. Calls of this size are unlikely for a cache manager but are common for any service transmitting volume dumps.

I misread the definition of after() which is

    static inline bool after(u32 seq1, u32 seq2)
    {
            return (s32)(seq1 - seq2) > 0;
    }

This is sufficient to detect the serial number and sequence number wrapping.

What it doesn't provide is a method for rxrpc tracing and /proc file to report on the total number of packets that have been sent or received on a call or connection which might or might not be important depending upon the use case.

Jeffrey Altman

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature