Subject: Re: [PATCH net-next] net: dqs: add NIC stall detector based on BQL

From: kernel test robot <[email-masked]>
Date: Sat, 17 Jun 2023 08:55:46 +0800

Hi Jakub,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Jakub-Kicinski/net-dqs-add-NIC-stall-detector-based-on-BQL/20230617-053320
base:   net-next/main
patch link:    https://lore.kernel.org/r/20230616213236.2379935-1-kuba%40kernel.org
patch subject: [PATCH net-next] net: dqs: add NIC stall detector based on BQL
config: arm-randconfig-r025-20230616 (https://download.01.org/0day-ci/archive/20230617/[email-masked]/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce: (https://download.01.org/0day-ci/archive/20230617/[email-masked]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email-masked]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email-masked]/

All warnings (new ones prefixed by >>):

>> lib/dynamic_queue_limits.c:18:6: warning: no previous prototype for function 'dql_check_stall' [-Wmissing-prototypes]
   void dql_check_stall(struct dql *dql)
        ^
   lib/dynamic_queue_limits.c:18:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void dql_check_stall(struct dql *dql)
   ^
   static 
   1 warning generated.

vim +/dql_check_stall +18 lib/dynamic_queue_limits.c

    17	
  > 18	void dql_check_stall(struct dql *dql)
    19	{
    20		unsigned long stall_thrs, now;
    21	
    22		/* If we detect a stall see if anything was queued */
    23		stall_thrs = READ_ONCE(dql->stall_thrs);
    24		if (!stall_thrs)
    25			return;
    26	
    27		now = jiffies;
    28		if (time_after_eq(now, dql->last_reap + stall_thrs)) {
    29			unsigned long hist_head, t, start, end;
    30	
    31			/* We are trying to detect a period of at least @stall_thrs
    32			 * jiffies without any Tx completions, but during first half
    33			 * of which some Tx was posted.
    34			 */
    35	dqs_again:
    36			hist_head = READ_ONCE(dql->history_head);
    37			smp_rmb();
    38			/* oldest sample since last reap */
    39			start = (hist_head - DQL_HIST_LEN + 1) * BITS_PER_LONG;
    40			if (time_before(start, dql->last_reap + 1))
    41				start = dql->last_reap + 1;
    42			/* newest sample we should have already seen a completion for */
    43			end = hist_head * BITS_PER_LONG + (BITS_PER_LONG - 1);
    44			if (time_before(now, end + stall_thrs / 2))
    45				end = now - stall_thrs / 2;
    46	
    47			for (t = start; time_before_eq(t, end); t++)
    48				if (test_bit(t % (DQL_HIST_LEN * BITS_PER_LONG),
    49					     dql->history))
    50					break;
    51			if (!time_before_eq(t, end))
    52				goto no_stall;
    53			if (hist_head != READ_ONCE(dql->history_head))
    54				goto dqs_again;
    55	
    56			dql->stall_cnt++;
    57			dql->stall_max = max_t(unsigned int, dql->stall_max, now - t);
    58	
    59			trace_dql_stall_detected(dql->stall_thrs, now - t,
    60						 dql->last_reap, dql->history_head,
    61						 now, dql->history);
    62		}
    63	no_stall:
    64		dql->last_reap = now;
    65	}
    66	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki