Skip to contentSkip to conversation

Circular vma locking with kvm, seems to be mmu notifiers related

DISCUSSION Max Krasnyansky 3 participants 4 messages Aug 12, 2008 – Aug 13, 2008

lore
Share & tools
lore
#0 lore raw

Got this on the latest mainline git.
There are already a couple of lockdep/kvm threads. So maybe it's known.

=============================================
[ INFO: possible recursive locking detected ]
2.6.27-rc2 #36
---------------------------------------------
qemu-system-x86/3445 is trying to acquire lock:
(&anon_vma->lock){--..}, at: [<ffffffff8029f84d>] mm_take_all_locks+0x8d/0xf0

but task is already holding lock:
(&anon_vma->lock){--..}, at: [<ffffffff8029f84d>] mm_take_all_locks+0x8d/0xf0

other info that might help us debug this:
4 locks held by qemu-system-x86/3445:
#0: (&mm->mmap_sem){----}, at: [<ffffffff802b2009>]

do_mmu_notifier_register+0xe9/0x140
 #1:  (mm_all_locks_mutex){--..}, at: [<ffffffff8029f7e7>]
mm_take_all_locks+0x27/0xf0
 #2:  (&inode->i_data.i_mmap_lock){--..}, at: [<ffffffff8029f877>]
mm_take_all_locks+0xb7/0xf0
 #3:  (&anon_vma->lock){--..}, at: [<ffffffff8029f84d>]
mm_take_all_locks+0x8d/0xf0

stack backtrace:

Pid: 3445, comm: qemu-kvm Not tainted 2.6.27-rc2 #36

Call Trace:
 [<ffffffff80261ddf>] __lock_acquire+0x92f/0x1020
 [<ffffffff80260c3d>] ? mark_held_locks+0x4d/0x90
 [<ffffffff80260de1>] ? trace_hardirqs_on_caller+0xe1/0x100
 [<ffffffff8026252b>] lock_acquire+0x5b/0x80
 [<ffffffff8029f84d>] ? mm_take_all_locks+0x8d/0xf0
 [<ffffffff8053348f>] _spin_lock+0x2f/0x40
 [<ffffffff8029f84d>] mm_take_all_locks+0x8d/0xf0
 [<ffffffff802b1f75>] do_mmu_notifier_register+0x55/0x140
 [<ffffffff802b207e>] mmu_notifier_register+0xe/0x10
 [<ffffffffa00f21db>] kvm_dev_ioctl+0x17b/0x300 [kvm]
 [<ffffffff802c49a1>] vfs_ioctl+0x31/0xa0
 [<ffffffff802c4c9b>] do_vfs_ioctl+0x28b/0x2f0
 [<ffffffff802c4d4a>] sys_ioctl+0x4a/0x80
 [<ffffffff8020b9db>] system_call_fastpath+0x16/0x1b
#1 lore raw
Quoted 10 lines · Max Krasnyansky

Got this on the latest mainline git.
There are already a couple of lockdep/kvm threads. So maybe it's known.

=============================================
[ INFO: possible recursive locking detected ]
2.6.27-rc2 #36
---------------------------------------------
qemu-system-x86/3445 is trying to acquire lock:
(&anon_vma->lock){--..}, at: [<ffffffff8029f84d>] mm_take_all_locks+0x8d/0xf0

Quoted 4 lines

but task is already holding lock:
(&anon_vma->lock){--..}, at: [<ffffffff8029f84d>] mm_take_all_locks+0x8d/0xf0

Seems to be a false positive. mmu_take_all_locks takes (surprise!) all anon_vma->locks belonging to an mm, and takes special care not to deadlock while doing this.

We need to communicate this to lockdep somehow.

Signature · 1 line
error compiling committee.c: too many arguments to function
#2 lore raw

Hi Avi,

Quoted 16 lines · Avi Kivity
Quoted 10 lines · Max Krasnyansky

Got this on the latest mainline git.
There are already a couple of lockdep/kvm threads. So maybe it's known.

=============================================
[ INFO: possible recursive locking detected ]
2.6.27-rc2 #36
---------------------------------------------
qemu-system-x86/3445 is trying to acquire lock:
(&anon_vma->lock){--..}, at: [<ffffffff8029f84d>] mm_take_all_locks+0x8d/0xf0

Quoted 4 lines

but task is already holding lock:
(&anon_vma->lock){--..}, at: [<ffffffff8029f84d>] mm_take_all_locks+0x8d/0xf0

Quoted 5 lines

Seems to be a false positive. mmu_take_all_locks takes (surprise!) all anon_vma->locks belonging to an mm, and takes special care not to deadlock while doing this.

We need to communicate this to lockdep somehow.

I think Peter already annotated this in
454ed842d55740160334efc9ad56cfef54ed37bc .

Hannes

#3 lore raw
Quoted 26 lines · Johannes Weiner

Hi Avi,

Quoted 21 lines · Avi Kivity
Quoted 10 lines · Max Krasnyansky

Got this on the latest mainline git.
There are already a couple of lockdep/kvm threads. So maybe it's known.

=============================================
[ INFO: possible recursive locking detected ]
2.6.27-rc2 #36
---------------------------------------------
qemu-system-x86/3445 is trying to acquire lock:
(&anon_vma->lock){--..}, at: [<ffffffff8029f84d>] mm_take_all_locks+0x8d/0xf0

Quoted 5 lines

but task is already holding lock:
(&anon_vma->lock){--..}, at: [<ffffffff8029f84d>] mm_take_all_locks+0x8d/0xf0

Seems to be a false positive. mmu_take_all_locks takes (surprise!) all anon_vma->locks belonging to an mm, and takes special care not to deadlock while doing this.

Quoted 7 lines
Quoted 2 lines

We need to communicate this to lockdep somehow.

I think Peter already annotated this in
454ed842d55740160334efc9ad56cfef54ed37bc .

Excellent, thanks for the info.

Signature · 1 line
error compiling committee.c: too many arguments to function