All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: kernel/locking/rtmutex.c:1375 rt_mutex_slowunlock() warn: inconsistent returns '&lock->wait_lock'.
Date: Wed, 23 Jun 2021 13:06:00 +0800	[thread overview]
Message-ID: <202106231348.w0XFQoO2-lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0c18f29aae7ce3dadd26d8ee3505d07cc982df75
commit: 70c80103aafdeae99126694bc1cd54de016bc258 locking/rtmutex: Consolidate the fast/slowpath invocation
date:   3 months ago
:::::: branch date: 11 hours ago
:::::: commit date: 3 months ago
config: powerpc64-randconfig-m031-20210622 (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 9.3.0

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

smatch warnings:
kernel/locking/rtmutex.c:1375 rt_mutex_slowunlock() warn: inconsistent returns '&lock->wait_lock'.
kernel/locking/rtmutex.c:1375 rt_mutex_slowunlock() warn: inconsistent returns 'flags'.

vim +1375 kernel/locking/rtmutex.c

70c80103aafdea kernel/locking/rtmutex.c Thomas Gleixner           2021-03-26  1311  
23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  1312  /*
802ab58da74bb4 kernel/locking/rtmutex.c Sebastian Andrzej Siewior 2015-06-17  1313   * Slow path to release a rt-mutex.
aa2bfe55366552 kernel/locking/rtmutex.c Peter Zijlstra            2017-03-23  1314   *
aa2bfe55366552 kernel/locking/rtmutex.c Peter Zijlstra            2017-03-23  1315   * Return whether the current task needs to call rt_mutex_postunlock().
23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  1316   */
70c80103aafdea kernel/locking/rtmutex.c Thomas Gleixner           2021-03-26  1317  static void __sched rt_mutex_slowunlock(struct rt_mutex *lock)
23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  1318  {
70c80103aafdea kernel/locking/rtmutex.c Thomas Gleixner           2021-03-26  1319  	DEFINE_WAKE_Q(wake_q);
b4abf91047cf05 kernel/locking/rtmutex.c Thomas Gleixner           2016-01-13  1320  	unsigned long flags;
b4abf91047cf05 kernel/locking/rtmutex.c Thomas Gleixner           2016-01-13  1321  
b4abf91047cf05 kernel/locking/rtmutex.c Thomas Gleixner           2016-01-13  1322  	/* irqsave required to support early boot calls */
b4abf91047cf05 kernel/locking/rtmutex.c Thomas Gleixner           2016-01-13  1323  	raw_spin_lock_irqsave(&lock->wait_lock, flags);
23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  1324  
23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  1325  	debug_rt_mutex_unlock(lock);
23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  1326  
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1327  	/*
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1328  	 * We must be careful here if the fast path is enabled. If we
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1329  	 * have no waiters queued we cannot set owner to NULL here
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1330  	 * because of:
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1331  	 *
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1332  	 * foo->lock->owner = NULL;
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1333  	 *			rtmutex_lock(foo->lock);   <- fast path
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1334  	 *			free = atomic_dec_and_test(foo->refcnt);
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1335  	 *			rtmutex_unlock(foo->lock); <- fast path
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1336  	 *			if (free)
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1337  	 *				kfree(foo);
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1338  	 * raw_spin_unlock(foo->lock->wait_lock);
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1339  	 *
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1340  	 * So for the fastpath enabled kernel:
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1341  	 *
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1342  	 * Nothing can set the waiters bit as long as we hold
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1343  	 * lock->wait_lock. So we do the following sequence:
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1344  	 *
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1345  	 *	owner = rt_mutex_owner(lock);
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1346  	 *	clear_rt_mutex_waiters(lock);
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1347  	 *	raw_spin_unlock(&lock->wait_lock);
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1348  	 *	if (cmpxchg(&lock->owner, owner, 0) == owner)
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1349  	 *		return;
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1350  	 *	goto retry;
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1351  	 *
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1352  	 * The fastpath disabled variant is simple as all access to
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1353  	 * lock->owner is serialized by lock->wait_lock:
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1354  	 *
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1355  	 *	lock->owner = NULL;
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1356  	 *	raw_spin_unlock(&lock->wait_lock);
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1357  	 */
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1358  	while (!rt_mutex_has_waiters(lock)) {
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1359  		/* Drops lock->wait_lock ! */
b4abf91047cf05 kernel/locking/rtmutex.c Thomas Gleixner           2016-01-13  1360  		if (unlock_rt_mutex_safe(lock, flags) == true)
70c80103aafdea kernel/locking/rtmutex.c Thomas Gleixner           2021-03-26  1361  			return;
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1362  		/* Relock the rtmutex and try again */
b4abf91047cf05 kernel/locking/rtmutex.c Thomas Gleixner           2016-01-13  1363  		raw_spin_lock_irqsave(&lock->wait_lock, flags);
23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  1364  	}
23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  1365  
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1366  	/*
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1367  	 * The wakeup next waiter path does not suffer from the above
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1368  	 * race. See the comments there.
45ab4effc3bee6 kernel/locking/rtmutex.c Davidlohr Bueso           2015-05-19  1369  	 *
45ab4effc3bee6 kernel/locking/rtmutex.c Davidlohr Bueso           2015-05-19  1370  	 * Queue the next waiter for wakeup once we release the wait_lock.
27e35715df54cb kernel/locking/rtmutex.c Thomas Gleixner           2014-06-11  1371  	 */
70c80103aafdea kernel/locking/rtmutex.c Thomas Gleixner           2021-03-26  1372  	mark_wakeup_next_waiter(&wake_q, lock);
b4abf91047cf05 kernel/locking/rtmutex.c Thomas Gleixner           2016-01-13  1373  	raw_spin_unlock_irqrestore(&lock->wait_lock, flags);
23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  1374  
70c80103aafdea kernel/locking/rtmutex.c Thomas Gleixner           2021-03-26 @1375  	rt_mutex_postunlock(&wake_q);
23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  1376  }
23f78d4a03c53c kernel/rtmutex.c         Ingo Molnar               2006-06-27  1377  

---
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: 34046 bytes --]

             reply	other threads:[~2021-06-23  5:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23  5:06 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-11-19 11:22 kernel/locking/rtmutex.c:1375 rt_mutex_slowunlock() warn: inconsistent returns '&lock->wait_lock' kernel test robot
2021-11-26  5:22 kernel test robot

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 \
    --in-reply-to=202106231348.w0XFQoO2-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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 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.