public inbox for [email protected]
 help / color / mirror / Atom feed
From: kernel test robot <[email protected]>
To: David Howells <[email protected]>
Cc: [email protected], [email protected],
	GNU/Weeb Mailing List <[email protected]>,
	[email protected]
Subject: [ammarfaizi2-block:dhowells/linux-fs/rxrpc-ringless 30/30] net/rxrpc/call_event.c:157:6: warning: variable 'oldest' is used uninitialized whenever 'if' condition is true
Date: Tue, 10 May 2022 03:22:35 +0800	[thread overview]
Message-ID: <[email protected]> (raw)

tree:   https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/rxrpc-ringless
head:   6c602b75eb616db42db08a634ed6e17ecd3a20d0
commit: 6c602b75eb616db42db08a634ed6e17ecd3a20d0 [30/30] rxrpc: Fix Tx resend by saving last ACK packet rather than marking packet ring
config: x86_64-randconfig-a004-20220509 (https://download.01.org/0day-ci/archive/20220510/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a385645b470e2d3a1534aae618ea56b31177639f)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/ammarfaizi2/linux-block/commit/6c602b75eb616db42db08a634ed6e17ecd3a20d0
        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
        git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/rxrpc-ringless
        git checkout 6c602b75eb616db42db08a634ed6e17ecd3a20d0
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash net/rxrpc/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

>> net/rxrpc/call_event.c:157:6: warning: variable 'oldest' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if (list_empty(&call->tx_queue))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/rxrpc/call_event.c:247:58: note: uninitialized use occurs here
           resend_at = nsecs_to_jiffies(ktime_to_ns(ktime_sub(now, oldest)));
                                                                   ^~~~~~
   include/linux/ktime.h:47:39: note: expanded from macro 'ktime_sub'
   #define ktime_sub(lhs, rhs)     ((lhs) - (rhs))
                                             ^~~
   net/rxrpc/call_event.c:157:2: note: remove the 'if' if its condition is always false
           if (list_empty(&call->tx_queue))
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/rxrpc/call_event.c:134:30: note: initialize the variable 'oldest' to silence this warning
           ktime_t now, max_age, oldest, ack_ts;
                                       ^
                                        = 0
   1 warning generated.


vim +157 net/rxrpc/call_event.c

   122	
   123	/*
   124	 * Perform retransmission of NAK'd and unack'd packets.
   125	 */
   126	static void rxrpc_resend(struct rxrpc_call *call, unsigned long now_j)
   127	{
   128		struct rxrpc_ackpacket *ack = NULL;
   129		struct rxrpc_local *local = call->peer->local;
   130		struct rxrpc_txbuf *txb;
   131		struct sk_buff *ack_skb = NULL;
   132		unsigned long resend_at;
   133		rxrpc_seq_t transmitted = READ_ONCE(call->tx_transmitted);
   134		ktime_t now, max_age, oldest, ack_ts;
   135		bool unacked = false;
   136		unsigned int i;
   137		LIST_HEAD(retrans_queue);
   138	
   139		_enter("{%d,%d}", call->acks_hard_ack, call->tx_top);
   140	
   141		now = ktime_get_real();
   142		max_age = ktime_sub_us(now, jiffies_to_usecs(call->peer->rto_j));
   143	
   144		/* See if there's an ACK saved with a soft-ACK table in it. */
   145		if (call->acks_soft_tbl) {
   146			spin_lock_bh(&call->acks_ack_lock);
   147			ack_skb = call->acks_soft_tbl;
   148			if (ack_skb) {
   149				rxrpc_get_skb(ack_skb, rxrpc_skb_ack);
   150				ack = (void *)ack_skb->data + sizeof(struct rxrpc_wire_header);
   151			}
   152			spin_unlock_bh(&call->acks_ack_lock);
   153		}
   154	
   155		spin_lock(&call->tx_lock);
   156	
 > 157		if (list_empty(&call->tx_queue))
   158			goto no_resend;
   159	
   160		trace_rxrpc_resend(call);
   161		txb = list_first_entry(&call->tx_queue, struct rxrpc_txbuf, call_link);
   162		oldest = now;
   163	
   164		/* Scan the soft ACK table without dropping the lock and resend any
   165		 * explicitly NAK'd packets.
   166		 */
   167		if (ack) {
   168			for (i = 0; i < ack->nAcks; i++) {
   169				rxrpc_seq_t seq;
   170	
   171				if (ack->acks[i] & 1)
   172					continue;
   173				seq = ntohl(ack->firstPacket) + i;
   174				if (after(txb->seq, transmitted))
   175					break;
   176				if (after(txb->seq, seq))
   177					continue; /* A new hard ACK probably came in */
   178				if (before(txb->seq, seq)) {
   179					list_for_each_entry_continue(txb, &call->tx_queue, call_link) {
   180						if (txb->seq == seq)
   181							goto found_txb;
   182					}
   183					goto no_resend;
   184				}
   185	
   186			found_txb:
   187				if (after(ntohl(txb->wire.serial), call->acks_highest_serial))
   188					continue; /* Ack point not yet reached */
   189	
   190				rxrpc_see_txbuf(txb, rxrpc_txbuf_see_unacked);
   191	
   192				if (list_empty(&txb->tx_link)) {
   193					rxrpc_get_txbuf(txb, rxrpc_txbuf_get_retrans);
   194					rxrpc_get_call(call, rxrpc_call_got_tx);
   195					list_add_tail(&txb->tx_link, &retrans_queue);
   196					set_bit(RXRPC_TXBUF_RESENT, &txb->flags);
   197				}
   198	
   199				trace_rxrpc_retransmit(call, txb->seq,
   200						       ktime_to_ns(ktime_sub(txb->last_sent,
   201									     max_age)));
   202			}
   203		}
   204	
   205		/* Fast-forward through the Tx queue to the point the peer says it has
   206		 * seen.  Anything between the soft-ACK table and that point will get
   207		 * ACK'd or NACK'd in due course, so don't worry about it here; here we
   208		 * need to consider retransmitting anything beyond that point.
   209		 *
   210		 * Note that ACK for a packet can beat the update of tx_transmitted.
   211		 */
   212		if (after_eq(READ_ONCE(call->acks_prev_seq), READ_ONCE(call->tx_transmitted)))
   213			goto no_resend;
   214	
   215		list_for_each_entry_continue(txb, &call->tx_queue, call_link) {
   216			if (before_eq(txb->seq, READ_ONCE(call->acks_prev_seq)))
   217				continue;
   218			if (after(txb->seq, READ_ONCE(call->tx_transmitted)))
   219				break; /* Not transmitted yet */
   220	
   221			if (ack && ack->reason == RXRPC_ACK_PING_RESPONSE &&
   222			    before(htonl(txb->wire.serial), htonl(ack->serial)))
   223				goto do_resend; /* Wasn't accounted for by a more recent ping. */
   224	
   225			if (ktime_after(txb->last_sent, max_age)) {
   226				if (ktime_before(txb->last_sent, oldest))
   227					oldest = txb->last_sent;
   228				continue;
   229			}
   230	
   231		do_resend:
   232			unacked = true;
   233			if (list_empty(&txb->tx_link)) {
   234				rxrpc_get_txbuf(txb, rxrpc_txbuf_get_retrans);
   235				rxrpc_get_call(call, rxrpc_call_got_tx);
   236				list_add_tail(&txb->tx_link, &retrans_queue);
   237				set_bit(RXRPC_TXBUF_RESENT, &txb->flags);
   238			}
   239		}
   240	
   241	
   242	
   243	no_resend:
   244		spin_unlock(&call->tx_lock);
   245		rxrpc_free_skb(ack_skb, rxrpc_skb_freed);
   246	
   247		resend_at = nsecs_to_jiffies(ktime_to_ns(ktime_sub(now, oldest)));
   248		resend_at += jiffies + rxrpc_get_rto_backoff(call->peer,
   249							     !list_empty(&retrans_queue));
   250		WRITE_ONCE(call->resend_at, resend_at);
   251	
   252		if (unacked)
   253			rxrpc_congestion_timeout(call);
   254	
   255		/* If there was nothing that needed retransmission then it's likely
   256		 * that an ACK got lost somewhere.  Send a ping to find out instead of
   257		 * retransmitting data.
   258		 */
   259		if (list_empty(&retrans_queue)) {
   260			rxrpc_reduce_call_timer(call, resend_at, now_j,
   261						rxrpc_timer_set_for_resend);
   262			ack_ts = ktime_sub(now, call->acks_latest_ts);
   263			if (ktime_to_us(ack_ts) < (call->peer->srtt_us >> 3))
   264				goto out;
   265			rxrpc_send_ACK(call, RXRPC_ACK_PING, 0,
   266				       rxrpc_propose_ack_ping_for_lost_ack);
   267			goto out;
   268		}
   269	
   270		/* Push the packets to be retransmitted onto the transmission queue and
   271		 * wake up the transmitter worker.  Note that it's possible that an ACK
   272		 * might come in whilst a packet is on the queue.
   273		 */
   274		spin_lock(&local->tx_lock);
   275		if (rxrpc_is_client_call(call))
   276			rxrpc_expose_client_call(call);
   277		list_splice_tail(&retrans_queue, &local->tx_queue);
   278		spin_unlock(&local->tx_lock);
   279		rxrpc_wake_up_transmitter(local);
   280	
   281	out:
   282		_leave("");
   283	}
   284	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

                 reply	other threads:[~2022-05-09 19:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox