Re: [PATCH v2] locking/mutex: Prevent lock starvation when spinning is enabled

kbuild test robot
2016-08-10T20:00:50Z

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

Hi Jason,

[auto build test WARNING on tip/locking/core]
[also build test WARNING on v4.8-rc1 next-20160809]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Jason-Low/locking-mutex-Prevent-lock-starvation-when-spinning-is-enabled/20160811-034327
config: m68k-allyesconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 4.9.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m68k

All warnings (new ones prefixed by >>):

kernel/locking/mutex.c: In function 'do_yield_to_waiter':
kernel/locking/mutex.c:441:10: error: 'struct mutex' has no member named 'yield_to_waiter'
if (lock->yield_to_waiter != true)
^
kernel/locking/mutex.c:442:7: error: 'struct mutex' has no member named 'yield_to_waiter'
lock->yield_to_waiter = true;
^
kernel/locking/mutex.c: In function 'clear_yield_to_waiter':
kernel/locking/mutex.c:447:6: error: 'struct mutex' has no member named 'yield_to_waiter'
lock->yield_to_waiter = false;
^
kernel/locking/mutex.c: In function 'need_yield_to_waiter':
kernel/locking/mutex.c:452:13: error: 'struct mutex' has no member named 'yield_to_waiter'
return lock->yield_to_waiter;
^
kernel/locking/mutex.c: In function '__ww_mutex_lock':
>> kernel/locking/mutex.c:983:7: warning: passing argument 1 of 'need_yield_to_waiter' from incompatible pointer type
if (!need_yield_to_waiter(lock))
^
kernel/locking/mutex.c:450:20: note: expected 'struct mutex *' but argument is of type 'struct ww_mutex *'
static inline bool need_yield_to_waiter(struct mutex *lock)
^
kernel/locking/mutex.c: In function '__ww_mutex_lock_interruptible':
kernel/locking/mutex.c:1002:7: warning: passing argument 1 of 'need_yield_to_waiter' from incompatible pointer type
if (!need_yield_to_waiter(lock))
^
kernel/locking/mutex.c:450:20: note: expected 'struct mutex *' but argument is of type 'struct ww_mutex *'
static inline bool need_yield_to_waiter(struct mutex *lock)
^
kernel/locking/mutex.c: In function 'need_yield_to_waiter':
kernel/locking/mutex.c:453:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^

vim +/need_yield_to_waiter +983 kernel/locking/mutex.c

967 ret = __mutex_fastpath_trylock(&lock->count, __mutex_trylock_slowpath);
968 if (ret)
969 mutex_set_owner(lock);
970
971 return ret;
972 }
973 EXPORT_SYMBOL(mutex_trylock);
974
975 #ifndef CONFIG_DEBUG_LOCK_ALLOC
976 int __sched
977 __ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
978 {
979 int ret = 1;
980
981 might_sleep();
982
> 983 if (!need_yield_to_waiter(lock))
984 ret = __mutex_fastpath_lock_retval(&lock->base.count);
985
986 if (likely(!ret)) {
987 ww_mutex_set_context_fastpath(lock, ctx);
988 mutex_set_owner(&lock->base);
989 } else
990 ret = __ww_mutex_lock_slowpath(lock, ctx);
991 return ret;

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 37707 bytes --]