[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150413154002.GI23123@twins.programming.kicks-ass.net>
Date: Mon, 13 Apr 2015 17:40:02 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: rusty@...tcorp.com.au, mathieu.desnoyers@...icios.com,
oleg@...hat.com, paulmck@...ux.vnet.ibm.com,
torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org,
andi@...stfloor.org, rostedt@...dmis.org, tglx@...utronix.de,
laijs@...fujitsu.com, linux@...izon.com
Subject: Re: [PATCH v5 01/10] module: Sanitize RCU usage and locking
On Mon, Apr 13, 2015 at 05:32:29PM +0200, Ingo Molnar wrote:
> > +static void module_assert_mutex_or_preempt(void)
> > +{
> > +#ifdef CONFIG_LOCKDEP
> > + int rcu_held = rcu_read_lock_sched_held();
> > + int mutex_held = 1;
> > +
> > + if (debug_locks)
> > + mutex_held = lockdep_is_held(&module_mutex);
> > +
> > + WARN_ON(!rcu_held && !mutex_held);
>
> So because rcu_read_lock_sched_held() also depends on debug_locks
> being on to be fully correct, shouldn't the warning also be within the
> debug_locks condition?
Ah, see how mutex_held will be true for !debug_locks and therefore we'll
not trigger the warn.
Maybe not the best way to code that though.
Something like so perhaps:
static void module_assert_mutex_or_preempt(void)
{
#ifdef CONFIG_LOCKDEP
if (!debug_locks)
return;
WARN_ON(!rcu_held_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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists