Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760095AbcLWLQI (ORCPT ); Fri, 23 Dec 2016 06:16:08 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34165 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751399AbcLWLQG (ORCPT ); Fri, 23 Dec 2016 06:16:06 -0500 Subject: Re: [PATCH v3 05/12] locking/ww_mutex: Remove the __ww_mutex_lock inline wrappers To: Peter Zijlstra References: <1482346000-9927-1-git-send-email-nhaehnle@gmail.com> <1482346000-9927-6-git-send-email-nhaehnle@gmail.com> <20161223104844.GN3107@twins.programming.kicks-ass.net> Cc: linux-kernel@vger.kernel.org, =?UTF-8?Q?Nicolai_H=c3=a4hnle?= , Ingo Molnar , Maarten Lankhorst , Daniel Vetter , Chris Wilson , dri-devel@lists.freedesktop.org From: =?UTF-8?Q?Nicolai_H=c3=a4hnle?= Message-ID: Date: Fri, 23 Dec 2016 12:16:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20161223104844.GN3107@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2629 Lines: 71 On 23.12.2016 11:48, Peter Zijlstra wrote: > On Wed, Dec 21, 2016 at 07:46:33PM +0100, Nicolai Hähnle wrote: >> diff --git a/include/linux/ww_mutex.h b/include/linux/ww_mutex.h >> index a5960e5..b2eaaab 100644 >> --- a/include/linux/ww_mutex.h >> +++ b/include/linux/ww_mutex.h >> @@ -186,11 +186,6 @@ static inline void ww_acquire_fini(struct ww_acquire_ctx *ctx) >> #endif >> } >> >> -extern int __must_check __ww_mutex_lock(struct ww_mutex *lock, >> - struct ww_acquire_ctx *ctx); >> -extern int __must_check __ww_mutex_lock_interruptible(struct ww_mutex *lock, >> - struct ww_acquire_ctx *ctx); >> - >> /** >> * ww_mutex_lock - acquire the w/w mutex >> * @lock: the mutex to be acquired >> @@ -220,10 +215,8 @@ extern int __must_check __ww_mutex_lock_interruptible(struct ww_mutex *lock, >> * >> * A mutex acquired with this function must be released with ww_mutex_unlock. >> */ >> -static inline int ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) >> -{ >> - return __ww_mutex_lock(lock, ctx); >> -} >> +extern int __must_check ww_mutex_lock(struct ww_mutex *lock, >> + struct ww_acquire_ctx *ctx); >> >> /** >> * ww_mutex_lock_interruptible - acquire the w/w mutex, interruptible >> @@ -255,11 +248,8 @@ static inline int ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ct >> * >> * A mutex acquired with this function must be released with ww_mutex_unlock. >> */ >> -static inline int __must_check ww_mutex_lock_interruptible(struct ww_mutex *lock, >> - struct ww_acquire_ctx *ctx) >> -{ >> - return __ww_mutex_lock_interruptible(lock, ctx); >> -} >> +extern int __must_check ww_mutex_lock_interruptible(struct ww_mutex *lock, >> + struct ww_acquire_ctx *ctx); >> >> /** >> * ww_mutex_lock_slow - slowpath acquiring of the w/w mutex >> diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c >> index a41bec2..282c6de 100644 > > For some reason this patch appears to make lib/locking-selftest.c really > unhappy. > > I get endless streams of: > > ../lib/locking-selftest.c: In function ‘ww_test_fail_acquire’: > ../lib/locking-selftest.c:1141:6: error: void value not ignored as it ought to be > ret = WWL(&o, &t); > ^ > > Apparently GCC gets confused about __much_check on inline functions or > something, or I got the patch wrong. Weird, I'm not getting that, and it makes no sense either from a quick glimpse of the code. Is there anything beside CONFIG_DEBUG_LOCKING_API_SELFTESTS I would have to enable to trigger this? FWIW: $ gcc --version gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 > >