lkml.org 
[lkml]   [2015]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH v5 00/10] latched RB-trees and __module_address()
Date
Peter Zijlstra <peterz@infradead.org> writes:
> On Tue, Apr 14, 2015 at 12:27:05PM +0930, Rusty Russell wrote:

Hmm, this blows up:

> +static void module_assert_mutex_or_preempt(void)
> +{
> +#ifdef CONFIG_LOCKDEP
> + if (!unlikely(debug_locks))
> + return;
> +
> + WARN_ON(!rcu_held_lock_sched_held() &&
> + !lockdep_is_held(&module_mutex));

That's rcu_read_lock_sched_held, not rcu_held_lock_sched_held().

Also, your unlikely is weird and backwards.

I changed it as below, and folded. It's in modules-next.

I'm now going to do some *actual* testing, and I'll go all Torvalds on
you if this spews warnings...

Cheers,
Rusty.

diff --git a/kernel/module.c b/kernel/module.c
index 4a89b88b4428..a15899e00ca9 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -113,10 +113,10 @@ static void module_assert_mutex(void)
static void module_assert_mutex_or_preempt(void)
{
#ifdef CONFIG_LOCKDEP
- if (!unlikely(debug_locks))
+ if (unlikely(!debug_locks))
return;

- WARN_ON(!rcu_held_lock_sched_held() &&
+ WARN_ON(!rcu_read_lock_sched_held() &&
!lockdep_is_held(&module_mutex));
#endif
}


\
 
 \ /
  Last update: 2015-05-28 05:01    [W:0.116 / U:1.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site