CC: kbuild-...@lists.01.org
CC: linux-ker...@vger.kernel.org
TO: Thomas Gleixner <t...@linutronix.de>
CC: Ingo Molnar <mi...@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 <l...@intel.com>
Reported-by: Dan Carpenter <dan.carpen...@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-...@lists.01.org

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to