Re: [PATCH v5 00/10] latched RB-trees and __module_address()
From: Rusty Russell
Date: Wed May 27 2015 - 22:22:35 EST
Peter Zijlstra <peterz@xxxxxxxxxxxxx> 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
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/