All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/block/rnbd/rnbd-clt.c:247:20: sparse: sparse: context imbalance in 'rnbd_rerun_if_needed' - different lock contexts for basic block
@ 2021-04-07  9:12 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-04-07  9:12 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 7295 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Jack Wang <jinpu.wang@cloud.ionos.com>
CC: Jason Gunthorpe <jgg@mellanox.com>
CC: Danil Kipnis <danil.kipnis@cloud.ionos.com>
CC: Bart Van Assche <bvanassche@acm.org>

Hi Jack,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2d743660786ec51f5c1fefd5782bbdee7b227db0
commit: bc01885342e193e7943d86ccbd7bc3e8fee50a68 block/rnbd: include client and server modules into kernel compilation
date:   11 months ago
:::::: branch date: 13 hours ago
:::::: commit date: 11 months ago
config: powerpc-randconfig-s032-20210407 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-279-g6d5d9b42-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bc01885342e193e7943d86ccbd7bc3e8fee50a68
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout bc01885342e193e7943d86ccbd7bc3e8fee50a68
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/block/rnbd/rnbd-clt.c:247:20: sparse: sparse: context imbalance in 'rnbd_rerun_if_needed' - different lock contexts for basic block

vim +/rnbd_rerun_if_needed +247 drivers/block/rnbd/rnbd-clt.c

f7a7a5c228d45e Jack Wang 2020-05-11  217  
f7a7a5c228d45e Jack Wang 2020-05-11  218  /**
f7a7a5c228d45e Jack Wang 2020-05-11  219   * rnbd_rerun_if_needed() - rerun next queue marked as stopped
f7a7a5c228d45e Jack Wang 2020-05-11  220   * @sess:	Session to rerun a queue on
f7a7a5c228d45e Jack Wang 2020-05-11  221   *
f7a7a5c228d45e Jack Wang 2020-05-11  222   * Description:
f7a7a5c228d45e Jack Wang 2020-05-11  223   *     Each CPU has it's own list of HW queues, which should be rerun.
f7a7a5c228d45e Jack Wang 2020-05-11  224   *     Function finds such list with HW queues, takes a list lock, picks up
f7a7a5c228d45e Jack Wang 2020-05-11  225   *     the first HW queue out of the list and requeues it.
f7a7a5c228d45e Jack Wang 2020-05-11  226   *
f7a7a5c228d45e Jack Wang 2020-05-11  227   * Return:
f7a7a5c228d45e Jack Wang 2020-05-11  228   *     True if the queue was requeued, false otherwise.
f7a7a5c228d45e Jack Wang 2020-05-11  229   *
f7a7a5c228d45e Jack Wang 2020-05-11  230   * Context:
f7a7a5c228d45e Jack Wang 2020-05-11  231   *     Does not matter.
f7a7a5c228d45e Jack Wang 2020-05-11  232   */
f7a7a5c228d45e Jack Wang 2020-05-11  233  static bool rnbd_rerun_if_needed(struct rnbd_clt_session *sess)
f7a7a5c228d45e Jack Wang 2020-05-11  234  {
f7a7a5c228d45e Jack Wang 2020-05-11  235  	struct rnbd_queue *q = NULL;
f7a7a5c228d45e Jack Wang 2020-05-11  236  	struct rnbd_cpu_qlist *cpu_q;
f7a7a5c228d45e Jack Wang 2020-05-11  237  	unsigned long flags;
f7a7a5c228d45e Jack Wang 2020-05-11  238  	int *cpup;
f7a7a5c228d45e Jack Wang 2020-05-11  239  
f7a7a5c228d45e Jack Wang 2020-05-11  240  	/*
f7a7a5c228d45e Jack Wang 2020-05-11  241  	 * To keep fairness and not to let other queues starve we always
f7a7a5c228d45e Jack Wang 2020-05-11  242  	 * try to wake up someone else in round-robin manner.  That of course
f7a7a5c228d45e Jack Wang 2020-05-11  243  	 * increases latency but queues always have a chance to be executed.
f7a7a5c228d45e Jack Wang 2020-05-11  244  	 */
f7a7a5c228d45e Jack Wang 2020-05-11  245  	cpup = get_cpu_ptr(sess->cpu_rr);
f7a7a5c228d45e Jack Wang 2020-05-11  246  	for (cpu_q = rnbd_get_cpu_qlist(sess, nxt_cpu(*cpup)); cpu_q;
f7a7a5c228d45e Jack Wang 2020-05-11 @247  	     cpu_q = rnbd_get_cpu_qlist(sess, nxt_cpu(cpu_q->cpu))) {
f7a7a5c228d45e Jack Wang 2020-05-11  248  		if (!spin_trylock_irqsave(&cpu_q->requeue_lock, flags))
f7a7a5c228d45e Jack Wang 2020-05-11  249  			continue;
f7a7a5c228d45e Jack Wang 2020-05-11  250  		if (unlikely(!test_bit(cpu_q->cpu, sess->cpu_queues_bm)))
f7a7a5c228d45e Jack Wang 2020-05-11  251  			goto unlock;
f7a7a5c228d45e Jack Wang 2020-05-11  252  		q = list_first_entry_or_null(&cpu_q->requeue_list,
f7a7a5c228d45e Jack Wang 2020-05-11  253  					     typeof(*q), requeue_list);
f7a7a5c228d45e Jack Wang 2020-05-11  254  		if (WARN_ON(!q))
f7a7a5c228d45e Jack Wang 2020-05-11  255  			goto clear_bit;
f7a7a5c228d45e Jack Wang 2020-05-11  256  		list_del_init(&q->requeue_list);
f7a7a5c228d45e Jack Wang 2020-05-11  257  		clear_bit_unlock(0, &q->in_list);
f7a7a5c228d45e Jack Wang 2020-05-11  258  
f7a7a5c228d45e Jack Wang 2020-05-11  259  		if (list_empty(&cpu_q->requeue_list)) {
f7a7a5c228d45e Jack Wang 2020-05-11  260  			/* Clear bit if nothing is left */
f7a7a5c228d45e Jack Wang 2020-05-11  261  clear_bit:
f7a7a5c228d45e Jack Wang 2020-05-11  262  			clear_bit(cpu_q->cpu, sess->cpu_queues_bm);
f7a7a5c228d45e Jack Wang 2020-05-11  263  		}
f7a7a5c228d45e Jack Wang 2020-05-11  264  unlock:
f7a7a5c228d45e Jack Wang 2020-05-11  265  		spin_unlock_irqrestore(&cpu_q->requeue_lock, flags);
f7a7a5c228d45e Jack Wang 2020-05-11  266  
f7a7a5c228d45e Jack Wang 2020-05-11  267  		if (q)
f7a7a5c228d45e Jack Wang 2020-05-11  268  			break;
f7a7a5c228d45e Jack Wang 2020-05-11  269  	}
f7a7a5c228d45e Jack Wang 2020-05-11  270  
f7a7a5c228d45e Jack Wang 2020-05-11  271  	/**
f7a7a5c228d45e Jack Wang 2020-05-11  272  	 * Saves the CPU that is going to be requeued on the per-cpu var. Just
f7a7a5c228d45e Jack Wang 2020-05-11  273  	 * incrementing it doesn't work because rnbd_get_cpu_qlist() will
f7a7a5c228d45e Jack Wang 2020-05-11  274  	 * always return the first CPU with something on the queue list when the
f7a7a5c228d45e Jack Wang 2020-05-11  275  	 * value stored on the var is greater than the last CPU with something
f7a7a5c228d45e Jack Wang 2020-05-11  276  	 * on the list.
f7a7a5c228d45e Jack Wang 2020-05-11  277  	 */
f7a7a5c228d45e Jack Wang 2020-05-11  278  	if (cpu_q)
f7a7a5c228d45e Jack Wang 2020-05-11  279  		*cpup = cpu_q->cpu;
f7a7a5c228d45e Jack Wang 2020-05-11  280  	put_cpu_var(sess->cpu_rr);
f7a7a5c228d45e Jack Wang 2020-05-11  281  
f7a7a5c228d45e Jack Wang 2020-05-11  282  	if (q)
f7a7a5c228d45e Jack Wang 2020-05-11  283  		rnbd_clt_dev_requeue(q);
f7a7a5c228d45e Jack Wang 2020-05-11  284  
f7a7a5c228d45e Jack Wang 2020-05-11  285  	return q;
f7a7a5c228d45e Jack Wang 2020-05-11  286  }
f7a7a5c228d45e Jack Wang 2020-05-11  287  

:::::: The code at line 247 was first introduced by commit
:::::: f7a7a5c228d45efc45d6e26a199a3ea13d2f8754 block/rnbd: client: main functionality

:::::: TO: Jack Wang <jinpu.wang@cloud.ionos.com>
:::::: CC: Jason Gunthorpe <jgg@mellanox.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29222 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-07  9:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07  9:12 drivers/block/rnbd/rnbd-clt.c:247:20: sparse: sparse: context imbalance in 'rnbd_rerun_if_needed' - different lock contexts for basic block kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.