Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1566289 > unrolled thread
| Started by | Alex Goins <agoins@nvidia.com> |
|---|---|
| First post | 2017-01-25 03:50 +0100 |
| Last post | 2017-01-30 18:40 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH RT] Align rt_mutex inlining with upstream behavior Alex Goins <agoins@nvidia.com> - 2017-01-25 03:50 +0100
Re: [PATCH RT] Align rt_mutex inlining with upstream behavior Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2017-01-26 18:10 +0100
Re: [PATCH RT] Align rt_mutex inlining with upstream behavior Andy Ritger <aritger@nvidia.com> - 2017-01-30 18:40 +0100
| From | Alex Goins <agoins@nvidia.com> |
|---|---|
| Date | 2017-01-25 03:50 +0100 |
| Subject | [PATCH RT] Align rt_mutex inlining with upstream behavior |
| Message-ID | <t3lON-4dZ-5@gated-at.bofh.it> |
mutex_destroy is no-op inline when DEBUG_MUTEX is not enabled. The RT Linux
patches replace mutex_destroy() with rt_mutex_destroy(). This patch aligns
rt_mutex_destroy() with mutex_destroy() by using the same no-op inline
technique.
Signed-off-by: Alex Goins <agoins@nvidia.com>
Reviewed-by: Andy Ritger <aritger@nvidia.com>
---
include/linux/rtmutex.h | 7 ++++++-
kernel/locking/rtmutex.c | 5 ++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 1abba5c..741e844 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -56,6 +56,12 @@ struct rt_mutex {
#endif
#ifdef CONFIG_DEBUG_RT_MUTEXES
+ extern void rt_mutex_destroy(struct rt_mutex *lock);
+#else
+ static inline void rt_mutex_destroy(struct rt_mutex *lock) {}
+#endif
+
+#ifdef CONFIG_DEBUG_RT_MUTEXES
# define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
, .name = #mutexname, .file = __FILE__, .line = __LINE__
# define rt_mutex_init(mutex) __rt_mutex_init(mutex, __func__)
@@ -87,7 +93,6 @@ static inline int rt_mutex_is_locked(struct rt_mutex *lock)
}
extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
-extern void rt_mutex_destroy(struct rt_mutex *lock);
extern void rt_mutex_lock(struct rt_mutex *lock);
extern int rt_mutex_lock_interruptible(struct rt_mutex *lock);
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
index 2c49d76..8ff12fb 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
@@ -1577,6 +1577,7 @@ bool __sched rt_mutex_futex_unlock(struct rt_mutex *lock,
return rt_mutex_slowunlock(lock, wqh);
}
+#ifdef CONFIG_DEBUG_RT_MUTEXES
/**
* rt_mutex_destroy - mark a mutex unusable
* @lock: the mutex to be destroyed
@@ -1588,12 +1589,10 @@ bool __sched rt_mutex_futex_unlock(struct rt_mutex *lock,
void rt_mutex_destroy(struct rt_mutex *lock)
{
WARN_ON(rt_mutex_is_locked(lock));
-#ifdef CONFIG_DEBUG_RT_MUTEXES
lock->magic = NULL;
-#endif
}
-
EXPORT_SYMBOL_GPL(rt_mutex_destroy);
+#endif
/**
* __rt_mutex_init - initialize the rt lock
--
1.9.1
[toc] | [next] | [standalone]
| From | Sebastian Andrzej Siewior <bigeasy@linutronix.de> |
|---|---|
| Date | 2017-01-26 18:10 +0100 |
| Message-ID | <t3VID-1CL-43@gated-at.bofh.it> |
| In reply to | #1566289 |
On 2017-01-24 18:45:50 [-0800], Alex Goins wrote: > mutex_destroy is no-op inline when DEBUG_MUTEX is not enabled. The RT Linux > patches replace mutex_destroy() with rt_mutex_destroy(). This patch aligns > rt_mutex_destroy() with mutex_destroy() by using the same no-op inline > technique. > > Signed-off-by: Alex Goins <agoins@nvidia.com> > Reviewed-by: Andy Ritger <aritger@nvidia.com> So what is the problem? Why are we doing this? There is still a check to see if the lock is in use which is also done for the case where DEBUG_MUTEX is disabled. Sebastian
[toc] | [prev] | [next] | [standalone]
| From | Andy Ritger <aritger@nvidia.com> |
|---|---|
| Date | 2017-01-30 18:40 +0100 |
| Message-ID | <t5o5Q-6Mu-31@gated-at.bofh.it> |
| In reply to | #1567609 |
On Thu, Jan 26, 2017 at 06:01:09PM +0100, Sebastian Andrzej Siewior wrote: > On 2017-01-24 18:45:50 [-0800], Alex Goins wrote: > > mutex_destroy is no-op inline when DEBUG_MUTEX is not enabled. The RT Linux > > patches replace mutex_destroy() with rt_mutex_destroy(). This patch aligns > > rt_mutex_destroy() with mutex_destroy() by using the same no-op inline > > technique. > > > > Signed-off-by: Alex Goins <agoins@nvidia.com> > > Reviewed-by: Andy Ritger <aritger@nvidia.com> > > So what is the problem? Why are we doing this? There is still a check to > see if the lock is in use which is also done for the case where > DEBUG_MUTEX is disabled. The problem is that various static inline functions such as reservation_object_fini() indirectly call mutex_destroy. On DEBUG_MUTEX kernels, mutex_destroy is EXPORT_SYMBOL_GPL. In upstream, non-DEBUG_MUTEX kernels define mutex_destroy to a noop. This gives users the option of disabling DEBUG_MUTEX if they want to use non-GPL, reservation_object_fini()-using, kernel modules. In PREEMPTRT, non-DEBUG_MUTEX kernels export rt_mutex_destroy as EXPORT_SYMBOL_GPL, so users no longer have the work around of using DEBUG_MUTEX. This patch gives PREEMPTRT users the option of disabling DEBUG_MUTEX if they want to use such kernel modules, matching upstream behavior.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web