Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1545945 > unrolled thread
| Started by | Nicolai Hähnle <nhaehnle@gmail.com> |
|---|---|
| First post | 2016-12-21 19:50 +0100 |
| Last post | 2016-12-23 13:20 +0100 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v3 05/12] locking/ww_mutex: Remove the __ww_mutex_lock inline wrappers Nicolai Hähnle <nhaehnle@gmail.com> - 2016-12-21 19:50 +0100
Re: [PATCH v3 05/12] locking/ww_mutex: Remove the __ww_mutex_lock inline wrappers Peter Zijlstra <peterz@infradead.org> - 2016-12-23 11:50 +0100
Re: [PATCH v3 05/12] locking/ww_mutex: Remove the __ww_mutex_lock inline wrappers Nicolai Hähnle <nhaehnle@gmail.com> - 2016-12-23 12:20 +0100
Re: [PATCH v3 05/12] locking/ww_mutex: Remove the __ww_mutex_lock inline wrappers Peter Zijlstra <peterz@infradead.org> - 2016-12-23 13:20 +0100
| From | Nicolai Hähnle <nhaehnle@gmail.com> |
|---|---|
| Date | 2016-12-21 19:50 +0100 |
| Subject | [PATCH v3 05/12] locking/ww_mutex: Remove the __ww_mutex_lock inline wrappers |
| Message-ID | <sQU7D-70O-13@gated-at.bofh.it> |
From: Nicolai Hähnle <Nicolai.Haehnle@amd.com>
Keep the documentation in the header file since there is no good
place for it in mutex.c: there are two rather different
implementations with different EXPORT_SYMBOLs for each function.
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Maarten Lankhorst <dev@mblankhorst.nl>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
---
include/linux/ww_mutex.h | 18 ++++--------------
kernel/locking/mutex.c | 16 ++++++++--------
2 files changed, 12 insertions(+), 22 deletions(-)
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
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -818,7 +818,7 @@ ww_mutex_deadlock_injection(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
}
int __sched
-__ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
+ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
{
int ret;
@@ -831,10 +831,10 @@ __ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
return ret;
}
-EXPORT_SYMBOL_GPL(__ww_mutex_lock);
+EXPORT_SYMBOL_GPL(ww_mutex_lock);
int __sched
-__ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
+ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
{
int ret;
@@ -848,7 +848,7 @@ __ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
return ret;
}
-EXPORT_SYMBOL_GPL(__ww_mutex_lock_interruptible);
+EXPORT_SYMBOL_GPL(ww_mutex_lock_interruptible);
#endif
@@ -1025,7 +1025,7 @@ EXPORT_SYMBOL(mutex_trylock);
#ifndef CONFIG_DEBUG_LOCK_ALLOC
int __sched
-__ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
+ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
{
might_sleep();
@@ -1037,10 +1037,10 @@ __ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
return __ww_mutex_lock_slowpath(lock, ctx);
}
-EXPORT_SYMBOL(__ww_mutex_lock);
+EXPORT_SYMBOL(ww_mutex_lock);
int __sched
-__ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
+ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
{
might_sleep();
@@ -1052,7 +1052,7 @@ __ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
return __ww_mutex_lock_interruptible_slowpath(lock, ctx);
}
-EXPORT_SYMBOL(__ww_mutex_lock_interruptible);
+EXPORT_SYMBOL(ww_mutex_lock_interruptible);
#endif
--
2.7.4
[toc] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-12-23 11:50 +0100 |
| Subject | Re: [PATCH v3 05/12] locking/ww_mutex: Remove the __ww_mutex_lock inline wrappers |
| Message-ID | <sRvAd-5K8-5@gated-at.bofh.it> |
| In reply to | #1545945 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Nicolai Hähnle <nhaehnle@gmail.com> |
|---|---|
| Date | 2016-12-23 12:20 +0100 |
| Subject | Re: [PATCH v3 05/12] locking/ww_mutex: Remove the __ww_mutex_lock inline wrappers |
| Message-ID | <sRw3f-6bO-15@gated-at.bofh.it> |
| In reply to | #1546815 |
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
>
>
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-12-23 13:20 +0100 |
| Subject | Re: [PATCH v3 05/12] locking/ww_mutex: Remove the __ww_mutex_lock inline wrappers |
| Message-ID | <sRwZj-6Li-7@gated-at.bofh.it> |
| In reply to | #1546829 |
On Fri, Dec 23, 2016 at 12:16:03PM +0100, Nicolai Hähnle wrote: > >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? Not entirely sure, I'm building an allmodconfig. > FWIW: > > $ gcc --version > gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 gcc (Debian 6.2.1-5) 6.2.1 20161124
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web