Re: [PATCH v4 1/9] module: Sanitize RCU usage and locking

2015-04-09 Thread Peter Zijlstra
On Thu, Apr 09, 2015 at 12:21:43PM +0800, Lai Jiangshan wrote: > On 04/09/2015 12:48 AM, Peter Zijlstra 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 (

Re: [PATCH v4 1/9] module: Sanitize RCU usage and locking

2015-04-08 Thread Lai Jiangshan
On 04/09/2015 12:48 AM, Peter Zijlstra 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); >

[PATCH v4 1/9] module: Sanitize RCU usage and locking

2015-04-08 Thread Peter Zijlstra
Currently the RCU usage in module is an inconsistent mess of RCU and RCU-sched, this is broken for CONFIG_PREEMPT where synchronize_rcu() does not imply synchronize_sched(). Most usage sites use preempt_{dis,en}able() which is RCU-sched, but (most of) the modification sites use synchronize_rcu().