Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755509AbbDIMhT (ORCPT ); Thu, 9 Apr 2015 08:37:19 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:33346 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753379AbbDIMhQ (ORCPT ); Thu, 9 Apr 2015 08:37:16 -0400 Date: Thu, 9 Apr 2015 14:36:52 +0200 From: Peter Zijlstra To: Lai Jiangshan Cc: mingo@kernel.org, rusty@rustcorp.com.au, mathieu.desnoyers@efficios.com, oleg@redhat.com, paulmck@linux.vnet.ibm.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, andi@firstfloor.org, rostedt@goodmis.org, tglx@linutronix.de Subject: Re: [PATCH v4 1/9] module: Sanitize RCU usage and locking Message-ID: <20150409123652.GV5029@twins.programming.kicks-ass.net> References: <20150408164813.810874878@infradead.org> <20150408170043.815070727@infradead.org> <5525FE57.1000003@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5525FE57.1000003@cn.fujitsu.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 797 Lines: 26 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 (debug_locks) > > + mutex_held = lockdep_is_held(&module_mutex); > > + > > + WARN_ON(!rcu_held && !mutex_held); > > +#endif > > +} > > Is rcu_lockdep_assert() suitable for it? > (note rcu_lockdep_assert() only works when CONFIG_PROVE_RCU) Nah, this works. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/