Messages in this thread | | | Date | Mon, 2 Mar 2015 13:37:18 +0100 | From | Peter Zijlstra <> | Subject | Re: [RFC][PATCH 2/9] module: Sanitize RCU usage and locking |
| |
On Mon, Mar 02, 2015 at 09:46:45PM +1030, Rusty Russell wrote: > Peter Zijlstra <peterz@infradead.org> writes: > > 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(). > > Huh? It's not "an inconsistent mess". They're all synchronize_rcu(), > except one.
Uhm, most of them use preempt_disable(), which is RCU-sched, not RCU.
The only RCU user I found was the bug-list thing.
What other RCU users are there?
> That said, I love the new checks, thanks! > > > +static inline void module_assert_mutex(void) > > +{ > > + lockdep_assert_held(&module_mutex); > > +} > > + > > +static inline 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); > > +#endif > > +} > > Minor nitpick: I generally avoid static inline in C files (unless > functions are unused under some config options, which these aren't). > > In general, they mess up future cleanups, as gcc doesn't warn about > unused functions.
Ah, sure. And I suppose gcc will not emit code for empty static functions anyhow - which is the reason I stuck the inline on, to avoid it generating code for the !LOCKDEP case.
| |