public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: Gabriel C <nix.or.die@gmail.com>, Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	stable <stable@vger.kernel.org>,
	lwn@lwn.net, Jiri Slaby <jslaby@suse.cz>,
	Ruslan Ruslichenko <rruslich@cisco.com>
Subject: Re: Linux 4.9.6 ( Restore IO-APIC irq_chip retrigger callback , breaks my box )
Date: Mon, 13 Feb 2017 03:31:55 +0100	[thread overview]
Message-ID: <1486953115.5912.4.camel@gmx.de> (raw)
In-Reply-To: <edaa7780-a2fa-61e1-d3a8-8dd820a7c526@gmail.com>

On Mon, 2017-02-13 at 02:26 +0100, Gabriel C wrote:

> [    5.276704]        CPU0
> [    5.312400]        ----
> [    5.347605]   lock(tick_broadcast_lock);
> [    5.383163]   
> [    5.418457]     lock(tick_broadcast_lock);
> [    5.454015]
>                  *** DEADLOCK ***
> 
> [    5.557982] no locks held by cpuhp/0/14.

Oh, that looks familiar...

tick/broadcast: Make tick_broadcast_control() use raw_spinlock_irqsave()

Otherwise we end up with the lockdep splat below:

[   12.703619] =================================
[   12.703619] [ INFO: inconsistent lock state ]
[   12.703621] 4.10.0-rt1-rt #18 Not tainted
[   12.703622] ---------------------------------
[   12.703623] inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
[   12.703624] cpuhp/0/23 [HC0[0]:SC0[0]:HE1:SE1] takes:
[   12.703625]  (tick_broadcast_lock){?.....}, at: [<ffffffff81123f9a>] tick_broadcast_control+0x5a/0x1a0
[   12.703632] {IN-HARDIRQ-W} state was registered at:
[   12.703637] [<ffffffff810e3511>] __lock_acquire+0xa21/0x1550
[   12.703639] [<ffffffff810e444d>] lock_acquire+0xbd/0x250
[   12.703642] [<ffffffff81703723>] _raw_spin_lock_irqsave+0x53/0x70
[   12.703644] [<ffffffff811240f6>] tick_broadcast_switch_to_oneshot+0x16/0x50
[   12.703646] [<ffffffff811244d9>] tick_switch_to_oneshot+0x59/0xd0
[   12.703647] [<ffffffff811245e5>] tick_init_highres+0x15/0x20
[   12.703652] [<ffffffff811134cf>] hrtimer_run_queues+0x9f/0xe0
[   12.703654] [<ffffffff81111155>] run_local_timers+0x25/0x60
[   12.703656] [<ffffffff811111bc>] update_process_times+0x2c/0x60
[   12.703659] [<ffffffff8112256f>] tick_periodic+0x2f/0x100
[   12.703661] [<ffffffff81122664>] tick_handle_periodic+0x24/0x70
[   12.703664] [<ffffffff810485d3>] local_apic_timer_interrupt+0x33/0x60
[   12.703669] [<ffffffff81706f18>] smp_apic_timer_interrupt+0x38/0x50
[   12.703671] [<ffffffff81705f2d>] apic_timer_interrupt+0x9d/0xb0
[   12.703672] [<ffffffff81702b54>] mwait_idle+0x94/0x290
[   12.703676] [<ffffffff8102862f>] arch_cpu_idle+0xf/0x20
[   12.703677] [<ffffffff817030c1>] default_idle_call+0x31/0x60
[   12.703681] [<ffffffff810d7575>] do_idle+0x175/0x290
[   12.703683] [<ffffffff810d79b8>] cpu_startup_entry+0x48/0x50
[   12.703687] [<ffffffff81046833>] start_secondary+0x133/0x160
[   12.703689] [<ffffffff810001c4>] verify_cpu+0x0/0xfc
[   12.703690] irq event stamp: 71
[   12.703691] hardirqs last  enabled at (71): [<ffffffff8170376c>] _raw_spin_unlock_irq+0x2c/0x80
[   12.703696] hardirqs last disabled at (70): [<ffffffff816ff0dc>] __schedule+0x9c/0x7e0
[   12.703699] softirqs last  enabled at (0): [<ffffffff8107ba11>] copy_process.part.34+0x5f1/0x22d0
[   12.703700] softirqs last disabled at (0): [<          (null)>]           (null)
[   12.703701] 
[   12.703701] other info that might help us debug this:
[   12.703701]  Possible unsafe locking scenario:
[   12.703701] 
[   12.703701]        CPU0
[   12.703702]        ----
[   12.703702]   lock(tick_broadcast_lock);
[   12.703703]   <Interrupt>
[   12.703704]     lock(tick_broadcast_lock);
[   12.703705] 
[   12.703705]  *** DEADLOCK ***
[   12.703705] 
[   12.703705] no locks held by cpuhp/0/23.
[   12.703705] 
[   12.703705] stack backtrace:
[   12.703707] CPU: 0 PID: 23 Comm: cpuhp/0 Not tainted 4.10.0-rt1-rt #18
[   12.703708] Hardware name: Hewlett-Packard ProLiant DL980 G7, BIOS P66 07/07/2010
[   12.703709] Call Trace:
[   12.703715]  dump_stack+0x85/0xc8
[   12.703717]  print_usage_bug+0x1ea/0x1fb
[   12.703719]  ? print_shortest_lock_dependencies+0x1c0/0x1c0
[   12.703721]  mark_lock+0x20d/0x290
[   12.703723]  __lock_acquire+0x8e6/0x1550
[   12.703724]  ? __lock_acquire+0x2ce/0x1550
[   12.703726]  ? load_balance+0x1b4/0xaf0
[   12.703728]  lock_acquire+0xbd/0x250
[   12.703729]  ? tick_broadcast_control+0x5a/0x1a0
[   12.703735]  ? efifb_probe+0x170/0x170
[   12.703736]  _raw_spin_lock+0x3b/0x50
[   12.703737]  ? tick_broadcast_control+0x5a/0x1a0
[   12.703738]  tick_broadcast_control+0x5a/0x1a0
[   12.703740]  ? efifb_probe+0x170/0x170
[   12.703742]  intel_idle_cpu_online+0x22/0x100
[   12.703744]  cpuhp_invoke_callback+0x245/0x9d0
[   12.703747]  ? finish_task_switch+0x78/0x290
[   12.703750]  ? check_preemption_disabled+0x9f/0x130
[   12.703752]  cpuhp_thread_fun+0x52/0x110
[   12.703754]  smpboot_thread_fn+0x276/0x320
[   12.703757]  kthread+0x10c/0x140
[   12.703759]  ? smpboot_update_cpumask_percpu_thread+0x130/0x130
[   12.703760]  ? kthread_park+0x90/0x90
[   12.703762]  ret_from_fork+0x2a/0x40
[   12.709790] intel_idle: lapic_timer_reliable_states 0x2

Signed-off-by: Mike Galbraith <efault@gmx.de>
---
 kernel/time/tick-broadcast.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -357,6 +357,7 @@ void tick_broadcast_control(enum tick_br
 	struct clock_event_device *bc, *dev;
 	struct tick_device *td;
 	int cpu, bc_stopped;
+	unsigned long flags;
 
 	td = this_cpu_ptr(&tick_cpu_device);
 	dev = td->evtdev;
@@ -370,7 +371,7 @@ void tick_broadcast_control(enum tick_br
 	if (!tick_device_is_functional(dev))
 		return;
 
-	raw_spin_lock(&tick_broadcast_lock);
+	raw_spin_lock_irqsave(&tick_broadcast_lock, flags);
 	cpu = smp_processor_id();
 	bc = tick_broadcast_device.evtdev;
 	bc_stopped = cpumask_empty(tick_broadcast_mask);
@@ -420,7 +421,7 @@ void tick_broadcast_control(enum tick_br
 				tick_broadcast_setup_oneshot(bc);
 		}
 	}
-	raw_spin_unlock(&tick_broadcast_lock);
+	raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags);
 }
 EXPORT_SYMBOL_GPL(tick_broadcast_control);
 

  reply	other threads:[~2017-02-13  2:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26  7:48 Linux 4.9.6 Greg KH
2017-01-26  7:48 ` Greg KH
2017-02-06 17:30 ` Linux 4.9.6 ( Restore IO-APIC irq_chip retrigger callback , breaks my box ) Gabriel C
2017-02-06 17:41   ` Greg KH
2017-02-06 19:05     ` Ruslan Ruslichenko -X (rruslich - GLOBALLOGIC INC at Cisco)
2017-02-06 20:38       ` Gabriel C
2017-02-06 23:06   ` Linus Torvalds
2017-02-07 20:46     ` Thomas Gleixner
2017-02-07 21:25       ` Thomas Gleixner
2017-02-10 23:17         ` Gabriel C
2017-02-11  1:42           ` Gabriel C
2017-02-11  8:26           ` Thomas Gleixner
2017-02-11 13:09             ` Gabriel C
2017-02-11 14:21               ` Borislav Petkov
2017-02-11 20:58                 ` Gabriel C
2017-02-11 21:32                   ` Borislav Petkov
2017-02-12 20:21                     ` Gabriel C
2017-02-12 21:12                       ` Borislav Petkov
2017-02-12 22:21                         ` Gabriel C
2017-02-13  0:38                           ` Borislav Petkov
2017-02-13  1:26                             ` Gabriel C
2017-02-13  2:31                               ` Mike Galbraith [this message]
2017-02-13  8:47                                 ` Thomas Gleixner
2017-02-13  8:52                                 ` [tip:timers/urgent] tick/broadcast: Prevent deadlock on tick_broadcast_lock tip-bot for Mike Galbraith
2017-02-13 10:28                               ` Linux 4.9.6 ( Restore IO-APIC irq_chip retrigger callback , breaks my box ) Borislav Petkov
2017-02-07 21:24     ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1486953115.5912.4.camel@gmx.de \
    --to=efault@gmx.de \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lwn@lwn.net \
    --cc=nix.or.die@gmail.com \
    --cc=rruslich@cisco.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox