Bug 16400

Summary: 2.6.35-rc5 inconsistent lock state
Product: Memory Management Reporter: Maciej Rutecki (maciej.rutecki)
Component: OtherAssignee: Andrew Morton (akpm)
Status: CLOSED CODE_FIX    
Severity: normal CC: axboe, florian, maciej.rutecki, miles.lane, rjw
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.35-rc5 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 16055    

Description Maciej Rutecki 2010-07-15 17:37:23 UTC
Subject    : 2.6.35-rc5 inconsistent lock state
Submitter  : Martin Pirker <lkml.collector@gmail.com>
Date       : 2010-07-14 20:33
Message-ID : AANLkTikDF0TL6OyPVCzPlUTwxFehcrETn3ysgSSeTq92@mail.gmail.com
References : http://marc.info/?l=linux-kernel&m=127913961025267&w=2

This entry is being used for tracking a regression from 2.6.34.  Please don't
close it until the problem is fixed in the mainline.
Comment 1 Miles Lane 2010-07-16 18:00:37 UTC
I have a nearly identical trace.  I will attach my .config file.

[ INFO: inconsistent lock state ]
2.6.35-rc5-git1 #10
---------------------------------
inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
swapper/0 [HC0[0]:SC1[1]:HE1:SE0] takes:
 (&(&bdi->wb_lock)->rlock){+.?...}, at: [<ffffffff810e5403>] bdi_queue_work+0x22/0x7f
 {SOFTIRQ-ON-W} state was registered at:
 __lock_acquire+0x35d/0xdc6
 lock_acquire+0x8b/0xba
 _raw_spin_lock+0x36/0x45
 bdi_task_init+0x29/0x75
 bdi_forker_task+0x2f/0x30b
   [<ffffffff8105672a>] kthread+0x89/0x91
   [<ffffffff8100aaa4>] kernel_thread_helper+0x4/0x10
 irq event stamp: 2115746
 hardirqs last  enabled at (2115746): [<ffffffff810c2d1a>] kmem_cache_alloc+0xd7/0x114
 hardirqs last disabled at (2115745): [<ffffffff810c2cb4>] kmem_cache_alloc+0x71/0x114
 softirqs last  enabled at (2115726): [<ffffffff81046890>] __do_softirq+0x162/0x178
 softirqs last disabled at (2115741): [<ffffffff8100ab9c>] call_softirq+0x1c/0x30

 other info that might help us debug this:
 1 lock held by swapper/0:
  #0:  (&q->backing_dev_info.laptop_mode_wb_timer){+.-...}, at: [<ffffffff8104bc38>] run_timer_softirq+0x188/0x295

 stack backtrace:
 Pid: 0, comm: swapper Not tainted 2.6.35-rc5-git1 #10
 Call Trace:
  <IRQ>  [<ffffffff81066976>] valid_state+0x17e/0x191
  [<ffffffff81014b48>] ? save_stack_trace+0x2a/0x47
  [<ffffffff8106599b>] ? register_lock_class+0x1e/0x3c1
  [<ffffffff810673fd>] ? check_usage_forwards+0x0/0x7e
  [<ffffffff81066a9c>] mark_lock+0x113/0x275
  [<ffffffff81067fa1>] __lock_acquire+0x2e9/0xdc6
  [<ffffffff8106747b>] ? check_usage_backwards+0x0/0x7b
  [<ffffffff810669b6>] ? mark_lock+0x2d/0x275
  [<ffffffff81068b09>] lock_acquire+0x8b/0xba
  [<ffffffff810e5403>] ? bdi_queue_work+0x22/0x7f
  [<ffffffff812ea281>] _raw_spin_lock+0x36/0x45
  [<ffffffff810e5403>] ? bdi_queue_work+0x22/0x7f
  [<ffffffff81067032>] ? trace_hardirqs_on+0xd/0xf
  [<ffffffff810e5403>] bdi_queue_work+0x22/0x7f
  [<ffffffff810e5c2d>] __bdi_start_writeback+0x73/0x7c
  [<ffffffff810e5c65>] bdi_start_writeback+0x10/0x12
  [<ffffffff8109d2f4>] laptop_mode_timer_fn+0x4f/0x57
  [<ffffffff8104bc93>] run_timer_softirq+0x1e3/0x295
  [<ffffffff8104bc38>] ? run_timer_softirq+0x188/0x295
  [<ffffffff81059930>] ? hrtimer_interrupt+0x11c/0x1c5
  [<ffffffff8109d2a5>] ? laptop_mode_timer_fn+0x0/0x57
  [<ffffffff81046794>] ? __do_softirq+0x66/0x178
  [<ffffffff810467f7>] __do_softirq+0xc9/0x178
  [<ffffffff8100ab9c>] call_softirq+0x1c/0x30
  [<ffffffff8100c30a>] do_softirq+0x66/0xda
  [<ffffffff81046a2b>] irq_exit+0x45/0x94
  [<ffffffff8100ba21>] do_IRQ+0xad/0xc4
  [<ffffffff812eafd3>] ret_from_intr+0x0/0x16
  <EOI>  [<ffffffffa01126a1>] ? acpi_idle_enter_bm+0x28a/0x2d5 [processor]
  [<ffffffffa011268c>] ? acpi_idle_enter_bm+0x275/0x2d5 [processor]
  [<ffffffff81254bdf>] cpuidle_idle_call+0xad/0xe6
  [<ffffffff81008fe2>] cpu_idle+0xb9/0x110
  [<ffffffff812d725f>] rest_init+0xe3/0xea
  [<ffffffff812d717c>] ? rest_init+0x0/0xea
  [<ffffffff816afe4c>] start_kernel+0x460/0x46b
  [<ffffffff816af2c8>] x86_64_start_reservations+0xb3/0xb7
  [<ffffffff816af418>] x86_64_start_kernel+0x14c/0x15b
Comment 2 Florian Mickler 2010-07-20 06:43:18 UTC
Patch suggested in http://marc.info/?l=linux-kernel&m=127939627513154&w=2.

Reported to fix the warning:

Martin Pirker <lkml.collector () gmail ! com> wrote: 
> On Sat, Jul 17, 2010 at 9:50 PM, Jens Axboe <axboe@kernel.dk> wrote:
> > I posted a patch for this the other day, but I just now notice
> > that it was a private list of CC addresses.
> >
> > Can anyone try this completed untested patch?
> 
> [sorry Jens for my first failed test attempt, my idiocy...]
> 
> applied to 2.6.35-rc5 -> error message so far not seen again.
> about functionality, well, HD spin up control via laptop_mode I cannot
> say, I've a SSD...
> 
> HTH,
> Martin
Comment 3 Rafael J. Wysocki 2010-08-01 21:32:13 UTC
Patch : http://marc.info/?l=linux-kernel&m=127939627513154&w=2
Handled-By : Jens Axboe <axboe@kernel.dk>
Comment 4 Florian Mickler 2010-09-05 07:43:07 UTC
On Sat, 04 Sep 2010 09:18:30 +0200
Jens Axboe <axboe@kernel.dk> wrote:

> > Subject: some random patch from jens
> > From: Jens Axboe <axboe@kernel.dk>
> > 
> > Fix some lockdep splat.
> > 
> > Addresses https://bugzilla.kernel.org/show_bug.cgi?id=16400
> 
> I don't think this is needed anymore, as the patches from Artem made the
> bdi lock bh safe anyway.
>