From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751701Ab3KRR4q (ORCPT ); Mon, 18 Nov 2013 12:56:46 -0500 Received: from merlin.infradead.org ([205.233.59.134]:46530 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751420Ab3KRR4l (ORCPT ); Mon, 18 Nov 2013 12:56:41 -0500 Date: Mon, 18 Nov 2013 18:56:33 +0100 From: Peter Zijlstra To: Sebastian Andrzej Siewior Cc: Thomas Gleixner , Mike Galbraith , Frederic Weisbecker , LKML , RT , "Paul E. McKenney" Subject: Re: [PATCH v2] rtmutex: take the waiter lock with irqs off Message-ID: <20131118175633.GB3694@twins.programming.kicks-ass.net> References: <1383794799.5441.16.camel@marge.simpson.net> <1383798668.5441.25.camel@marge.simpson.net> <20131107125923.GB24644@localhost.localdomain> <1384243595.15180.63.camel@marge.simpson.net> <20131115163008.GB12164@linutronix.de> <20131115201436.GC12164@linutronix.de> <20131118141021.GA10022@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131118141021.GA10022@twins.programming.kicks-ass.net> 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 On Mon, Nov 18, 2013 at 03:10:21PM +0100, Peter Zijlstra wrote: > --- a/kernel/softirq.c > +++ b/kernel/softirq.c > @@ -746,13 +746,23 @@ void irq_exit(void) > #endif > > account_irq_exit_time(current); > - trace_hardirq_exit(); > sub_preempt_count(HARDIRQ_OFFSET); > - if (!in_interrupt() && local_softirq_pending()) > + if (!in_interrupt() && local_softirq_pending()) { > + /* > + * Temp. disable hardirq context so as not to confuse lockdep; > + * otherwise it might think we're running softirq handler from > + * hardirq context. > + * > + * Should probably sort this someplace else.. > + */ > + trace_hardirq_exit(); > invoke_softirq(); > + trace_hardirq_enter(); > + } > > tick_irq_exit(); > rcu_irq_exit(); > + trace_hardirq_exit(); > } > > void raise_softirq(unsigned int nr) *SPLAT* --- [ 7794.620512] ================================= [ 7794.620513] [ INFO: inconsistent lock state ] [ 7794.620515] 3.12.0-rt2-dirty #585 Not tainted [ 7794.620517] --------------------------------- [ 7794.620518] inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage. [ 7794.620520] swapper/0/0 [HC1[0]:SC0[0]:HE0:SE1] takes: [ 7794.620527] (&(&(&base->lock)->lock)->wait_lock){?.+...}, at: [] rt_mutex_slowtrylock+0xf/0x80 [ 7794.620528] {HARDIRQ-ON-W} state was registered at: [ 7794.620532] [] __lock_acquire+0x64c/0x1ec0 [ 7794.620534] [] lock_acquire+0x90/0x150 [ 7794.620537] [] _raw_spin_lock+0x3b/0x50 [ 7794.620540] [] rt_spin_lock_slowlock+0x33/0x260 [ 7794.620542] [] rt_spin_lock+0x69/0x70 [ 7794.620546] [] run_timer_softirq+0x4a/0x2f0 [ 7794.620548] [] do_current_softirqs+0x231/0x460 [ 7794.620550] [] run_ksoftirqd+0x38/0x60 [ 7794.620553] [] smpboot_thread_fn+0x22c/0x350 [ 7794.620555] [] kthread+0xcd/0xe0 [ 7794.620558] [] ret_from_fork+0x7c/0xb0 [ 7794.620559] irq event stamp: 15216954 [ 7794.620562] hardirqs last enabled at (15216953): [] cpuidle_enter_state+0x67/0xf0 [ 7794.620564] hardirqs last disabled at (15216954): [] common_interrupt+0x6a/0x6f [ 7794.620565] softirqs last enabled at (0): [< (null)>] (null) [ 7794.620566] softirqs last disabled at (0): [< (null)>] (null) [ 7794.620566] [ 7794.620566] other info that might help us debug this: [ 7794.620566] Possible unsafe locking scenario: [ 7794.620566] [ 7794.620567] CPU0 [ 7794.620567] ---- [ 7794.620568] lock(&(&(&base->lock)->lock)->wait_lock); [ 7794.620568] [ 7794.620569] lock(&(&(&base->lock)->lock)->wait_lock); [ 7794.620569] [ 7794.620569] *** DEADLOCK *** [ 7794.620569] [ 7794.620570] no locks held by swapper/0/0. [ 7794.620570] [ 7794.620570] stack backtrace: [ 7794.620572] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.12.0-rt2-dirty #585 [ 7794.620573] Hardware name: Supermicro X8DTN/X8DTN, BIOS 4.6.3 01/08/2010 [ 7794.620577] ffffffff820fb6f0 ffff880237c03bf8 ffffffff8165aca2 ffffffff81c164c0 [ 7794.620579] ffff880237c03c48 ffffffff816569d9 0000000000000000 ffffffff00000000 [ 7794.620581] ffff880200000001 0000000000000002 ffffffff81c164c0 ffffffff810f9150 [ 7794.620582] Call Trace: [ 7794.620585] [] dump_stack+0x4e/0x8f [ 7794.620588] [] print_usage_bug+0x1f2/0x203 [ 7794.620591] [] ? check_usage_backwards+0x130/0x130 [ 7794.620596] [] mark_lock+0x2ad/0x320 [ 7794.620598] [] __lock_acquire+0x87a/0x1ec0 [ 7794.620600] [] ? __lock_acquire+0x40f/0x1ec0 [ 7794.620601] [] ? __lock_acquire+0x40f/0x1ec0 [ 7794.620604] [] lock_acquire+0x90/0x150 [ 7794.620605] [] ? rt_mutex_slowtrylock+0xf/0x80 [ 7794.620607] [] _raw_spin_lock+0x3b/0x50 [ 7794.620609] [] ? rt_mutex_slowtrylock+0xf/0x80 [ 7794.620610] [] rt_mutex_slowtrylock+0xf/0x80 [ 7794.620612] [] rt_mutex_trylock+0x2a/0x30 [ 7794.620614] [] rt_spin_trylock+0x16/0x50 [ 7794.620616] [] get_next_timer_interrupt+0x51/0x290 [ 7794.620618] [] ? native_sched_clock+0x24/0x80 [ 7794.620620] [] __tick_nohz_idle_enter+0x305/0x4a0 [ 7794.620622] [] ? native_sched_clock+0x24/0x80 [ 7794.620624] [] tick_nohz_irq_exit+0x34/0x40 [ 7794.620626] [] irq_exit+0x10d/0x140 [ 7794.620628] [] do_IRQ+0x63/0xd0 [ 7794.620629] [] common_interrupt+0x6f/0x6f [ 7794.620632] [] ? cpuidle_enter_state+0x6b/0xf0 [ 7794.620634] [] cpuidle_idle_call+0x106/0x2b0 [ 7794.620636] [] arch_cpu_idle+0xe/0x30 [ 7794.620639] [] cpu_startup_entry+0x298/0x310 [ 7794.620642] [] rest_init+0xc3/0xd0 [ 7794.620644] [] ? rest_init+0x5/0xd0 [ 7794.620648] [] start_kernel+0x3dd/0x3ea [ 7794.620650] [] ? repair_env_string+0x5e/0x5e [ 7794.620652] [] x86_64_start_reservations+0x2a/0x2c [ 7794.620653] [] x86_64_start_kernel+0xfb/0xfe