Peter Zijlstra
1d4a7f1c4f
hrtimers: fix inconsistent lock state on resume in hres_timers_resume
Andrey Borzenkov reported this lockdep assert:
> [17854.688347] =================================
> [17854.688347] [ INFO: inconsistent lock state ]
> [17854.688347] 2.6.29-rc2-1avb #1
> [17854.688347] ---------------------------------
> [17854.688347] inconsistent {in-hardirq-W} -> {hardirq-on-W} usage.
> [17854.688347] pm-suspend/18240 [HC0[0]:SC0[0]:HE1:SE1] takes:
> [17854.688347] (&cpu_base->lock){++..}, at: [<c0136fcc>] retrigger_next_event+0x5c/0xa0
> [17854.688347] {in-hardirq-W} state was registered at:
> [17854.688347] [<c01443cd>] __lock_acquire+0x79d/0x1930
> [17854.688347] [<c01455bc>] lock_acquire+0x5c/0x80
> [17854.688347] [<c03092e5>] _spin_lock+0x35/0x70
> [17854.688347] [<c0136e61>] hrtimer_run_queues+0x31/0x140
> [17854.688347] [<c0128d98>] run_local_timers+0x8/0x20
> [17854.688347] [<c0128dd3>] update_process_times+0x23/0x60
> [17854.688347] [<c013e274>] tick_periodic+0x24/0x80
> [17854.688347] [<c013e2e2>] tick_handle_periodic+0x12/0x70
> [17854.688347] [<c0104e24>] timer_interrupt+0x14/0x20
> [17854.688347] [<c01607b9>] handle_IRQ_event+0x29/0x60
> [17854.688347] [<c0161c59>] handle_level_irq+0x69/0xe0
> [17854.688347] [<ffffffff>] 0xffffffff
> [17854.688347] irq event stamp: 55771
> [17854.688347] hardirqs last enabled at (55771): [<c0309125>] _spin_unlock_irqrestore+0x35/0x60
> [17854.688347] hardirqs last disabled at (55770): [<c0309419>] _spin_lock_irqsave+0x19/0x80
> [17854.688347] softirqs last enabled at (54836): [<c0124f54>] __do_softirq+0xc4/0x110
> [17854.688347] softirqs last disabled at (54831): [<c01049ae>] do_softirq+0x8e/0xe0
> [17854.688347]
> [17854.688347] other info that might help us debug this:
> [17854.688347] 3 locks held by pm-suspend/18240:
> [17854.688347] #0: (&buffer->mutex){--..}, at: [<c01dd4c5>] sysfs_write_file+0x25/0x100
> [17854.688347] #1: (pm_mutex){--..}, at: [<c015056f>] enter_state+0x4f/0x140
> [17854.688347] #2: (dpm_list_mtx){--..}, at: [<c027880f>] device_pm_lock+0xf/0x20
> [17854.688347]
> [17854.688347] stack backtrace:
> [17854.688347] Pid: 18240, comm: pm-suspend Not tainted 2.6.29-rc2-1avb #1
> [17854.688347] Call Trace:
> [17854.688347] [<c0306248>] ? printk+0x18/0x20
> [17854.688347] [<c0141fac>] print_usage_bug+0x16c/0x1d0
> [17854.688347] [<c0142bcf>] mark_lock+0x8bf/0xc90
> [17854.688347] [<c0106b8f>] ? pit_next_event+0x2f/0x40
> [17854.688347] [<c01441b0>] __lock_acquire+0x580/0x1930
> [17854.688347] [<c030916d>] ? _spin_unlock+0x1d/0x20
> [17854.688347] [<c0106b8f>] ? pit_next_event+0x2f/0x40
> [17854.688347] [<c013dd38>] ? clockevents_program_event+0x98/0x160
> [17854.688347] [<c0142fe8>] ? mark_held_locks+0x48/0x90
> [17854.688347] [<c0309125>] ? _spin_unlock_irqrestore+0x35/0x60
> [17854.688347] [<c0143229>] ? trace_hardirqs_on_caller+0x139/0x190
> [17854.688347] [<c014328b>] ? trace_hardirqs_on+0xb/0x10
> [17854.688347] [<c01455bc>] lock_acquire+0x5c/0x80
> [17854.688347] [<c0136fcc>] ? retrigger_next_event+0x5c/0xa0
> [17854.688347] [<c03092e5>] _spin_lock+0x35/0x70
> [17854.688347] [<c0136fcc>] ? retrigger_next_event+0x5c/0xa0
> [17854.688347] [<c0136fcc>] retrigger_next_event+0x5c/0xa0
> [17854.688347] [<c013711a>] hres_timers_resume+0xa/0x10
> [17854.688347] [<c013aa8e>] timekeeping_resume+0xee/0x150
> [17854.688347] [<c0273384>] __sysdev_resume+0x14/0x50
> [17854.688347] [<c0273407>] sysdev_resume+0x47/0x80
> [17854.688347] [<c02791ab>] device_power_up+0xb/0x20
> [17854.688347] [<c015043f>] suspend_devices_and_enter+0xcf/0x150
> [17854.688347] [<c0150c2f>] ? freeze_processes+0x3f/0x90
> [17854.688347] [<c0150614>] enter_state+0xf4/0x140
> [17854.688347] [<c01506dd>] state_store+0x7d/0xc0
> [17854.688347] [<c0150660>] ? state_store+0x0/0xc0
> [17854.688347] [<c0202da4>] kobj_attr_store+0x24/0x30
> [17854.688347] [<c01dd53c>] sysfs_write_file+0x9c/0x100
> [17854.688347] [<c019916c>] vfs_write+0x9c/0x160
> [17854.688347] [<c0103494>] ? restore_nocheck_notrace+0x0/0xe
> [17854.688347] [<c01dd4a0>] ? sysfs_write_file+0x0/0x100
> [17854.688347] [<c01992ed>] sys_write+0x3d/0x70
> [17854.688347] [<c0103371>] sysenter_do_call+0x12/0x31
Andrey's analysis:
> timekeeping_resume() is called via class ->resume
> method; and according to comments in sysdev_resume() and
> device_power_up(), they are called with interrupts disabled.
>
> Looking at suspend_enter, irqs *are* disabled at this point.
>
> So it actually looks like something (may be some driver)
> unconditionally enabled irqs in resume path.
Add a debug check to test this theory. If it triggers then it
triggers because the resume code calls it with irqs enabled,
which is a no-no not just for timekeeping_resume(), but also
bad for a number of other resume handlers.
Reported-by: Andrey Borzenkov <arvidjaar@mail.ru>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-01-18 21:31:37 +01:00
..
2009-01-07 08:45:46 -08:00
2009-01-09 03:39:43 -05:00
2009-01-15 12:06:56 +01:00
2009-01-09 12:43:06 -08:00
2008-11-14 10:39:12 +11:00
2009-01-09 13:23:45 -08:00
2009-01-04 15:14:42 -05:00
2008-12-09 02:27:41 -05:00
2009-01-04 15:14:41 -05:00
2009-01-04 15:14:42 -05:00
2009-01-04 15:14:42 -05:00
2009-01-07 09:58:22 +11:00
2008-10-20 08:52:38 -07:00
2008-11-12 17:17:16 -08:00
2009-01-08 08:31:10 -08:00
2009-01-06 15:59:13 -08:00
2008-10-20 08:52:34 -07:00
2009-01-07 11:36:14 -08:00
2009-01-08 08:31:11 -08:00
2008-11-14 10:39:23 +11:00
2009-01-09 13:59:25 -08:00
2008-12-18 13:54:01 +01:00
2009-01-06 15:59:31 -08:00
2008-10-16 11:21:30 -07:00
2008-10-23 14:30:41 +04:00
2009-01-06 15:59:09 -08:00
2008-12-30 16:10:19 -08:00
2009-01-11 15:34:10 +01:00
2008-10-30 11:38:45 -07:00
2008-11-14 10:39:19 +11:00
2009-01-06 09:32:11 +01:00
2009-01-18 21:31:37 +01:00
2008-09-14 16:25:35 +02:00
2008-12-19 22:47:10 +01:00
2008-10-20 08:52:34 -07:00
2008-07-28 14:37:38 +02:00
2008-12-25 09:31:28 +01:00
2009-01-01 10:12:15 +10:30
2008-10-06 13:50:59 -05:00
2009-01-06 15:59:27 -08:00
2009-01-06 15:59:21 -08:00
2009-01-06 10:44:31 -08:00
2008-11-16 09:01:36 +01:00
2008-12-10 08:01:54 -08:00
2008-08-13 12:55:10 +02:00
2008-10-20 15:43:10 +02:00
2008-12-30 16:10:19 -08:00
2009-01-07 08:45:46 -08:00
2008-11-16 09:52:03 +01:00
2009-01-07 08:45:46 -08:00
2008-11-24 10:00:28 +01:00
2008-11-26 08:22:50 +01:00
2009-01-08 08:31:02 -08:00
2008-11-24 18:57:41 -05:00
2009-01-06 15:59:12 -08:00
2008-10-23 12:09:00 -07:00
2008-09-02 19:21:38 -07:00
2009-01-08 08:31:12 -08:00
2008-09-02 19:21:40 -07:00
2009-01-07 18:52:44 +01:00
2008-12-25 18:02:25 +01:00
2009-01-06 11:28:06 +01:00
2009-01-06 15:59:14 -08:00
2008-12-28 12:21:10 -08:00
2009-01-03 18:59:25 +01:00
2009-01-05 10:18:08 +01:00
2008-12-18 21:56:04 +01:00
2009-01-05 10:18:08 +01:00
2009-01-05 13:09:49 +01:00
2008-12-18 21:56:04 +01:00
2009-01-05 10:12:33 +01:00
2008-12-10 08:01:52 -08:00
2009-01-08 08:31:05 -08:00
2009-01-07 11:12:32 -08:00
2008-07-21 21:55:02 -07:00
2008-09-05 21:35:13 -07:00
2008-12-31 09:53:21 +01:00
2009-01-06 11:07:15 +01:00
2008-11-24 17:52:22 +01:00
2008-12-01 20:39:50 +01:00
2009-01-08 08:31:15 -08:00
2008-11-05 10:30:14 +01:00
2008-10-22 10:01:52 +02:00
2009-01-03 19:00:09 +01:00
2009-01-07 18:52:44 +01:00
2009-01-07 16:10:54 +01:00
2008-08-05 14:33:47 -07:00
2009-01-06 15:59:29 -08:00
2009-01-01 10:12:15 +10:30
2009-01-03 12:04:39 -08:00
2009-01-01 10:12:28 +10:30
2008-08-13 13:56:51 +02:00
2008-12-25 11:44:43 +01:00
2009-01-05 08:40:14 +10:30
2008-11-19 18:49:57 -08:00
2009-01-06 17:10:33 -08:00
2008-10-30 18:30:09 +11:00
2009-01-08 12:04:47 +00:00
2009-01-01 10:12:28 +10:30
2009-01-06 15:59:20 -08:00
2009-01-06 15:59:13 -08:00
2008-12-31 15:11:46 +01:00
2008-11-16 09:52:03 +01:00
2009-01-06 15:59:09 -08:00
2008-11-14 10:39:18 +11:00
2008-11-24 18:57:41 -05:00
2008-12-28 12:27:58 -08:00
2008-10-16 11:21:47 -07:00
2008-08-23 12:14:12 -07:00
2008-10-16 11:21:31 -07:00
2009-01-01 10:12:25 +10:30