2.6.29-rc3 circular locking dependency detected

2009-02-03 Thread Mark McLoughlin
Hi,

Just saw this when starting a guest with an assigned device.

Cheers,
Mark.

===
[ INFO: possible circular locking dependency detected ]
2.6.29-0.74.rc3.git3.fc11.x86_64 #1
---
qemu-kvm/3706 is trying to acquire lock:
 (kvm-lock){--..}, at: [a013a25f] kvm_emulate_pio+0x1ab/0x1ff [kvm]

but task is already holding lock:
 (kvm-slots_lock){}, at: [a013c4c0] kvm_arch_vcpu_ioctl_run+0x49
7/0x73a [kvm]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

- #1 (kvm-slots_lock){}:
   [8106e9c1] __lock_acquire+0xaab/0xc41
   [8106ebe4] lock_acquire+0x8d/0xba
   [813826ae] down_read+0x4b/0x7f
   [a0137ff2] kvm_iommu_map_guest+0x62/0xb8 [kvm]
   [a01363ea] kvm_vm_ioctl+0x3f4/0x7f1 [kvm]
   [810eac30] vfs_ioctl+0x2a/0x78
   [810eb0e9] do_vfs_ioctl+0x46b/0x4ab
   [810eb17e] sys_ioctl+0x55/0x77
   [810112ba] system_call_fastpath+0x16/0x1b
   [] 0x

- #0 (kvm-lock){--..}:
   [8106e862] __lock_acquire+0x94c/0xc41
   [8106ebe4] lock_acquire+0x8d/0xba
   [8138205a] __mutex_lock_common+0x107/0x39c
   [81382398] mutex_lock_nested+0x35/0x3a
   [a013a25f] kvm_emulate_pio+0x1ab/0x1ff [kvm]
   [a015c875] handle_io+0x6e/0x76 [kvm_intel]
   [a015d202] kvm_handle_exit+0x1ba/0x1db [kvm_intel]
   [a013c534] kvm_arch_vcpu_ioctl_run+0x50b/0x73a [kvm]
   [a01344a7] kvm_vcpu_ioctl+0xfc/0x48b [kvm]
   [810eac30] vfs_ioctl+0x2a/0x78
   [810eb0e9] do_vfs_ioctl+0x46b/0x4ab
   [810eb17e] sys_ioctl+0x55/0x77
   [810112ba] system_call_fastpath+0x16/0x1b
   [] 0x

other info that might help us debug this:

2 locks held by qemu-kvm/3706:
 #0:  (vcpu-mutex){--..}, at: [a0136ceb] vcpu_load+0x15/0x37 [kvm]
 #1:  (kvm-slots_lock){}, at: [a013c4c0] kvm_arch_vcpu_ioctl_run
+0x497/0x73a [kvm]

stack backtrace:
Pid: 3706, comm: qemu-kvm Not tainted 2.6.29-0.74.rc3.git3.fc11.x86_64 #1
Call Trace:
 [8106dc65] print_circular_bug_tail+0x71/0x7c
 [8106e862] __lock_acquire+0x94c/0xc41
 [8106ebe4] lock_acquire+0x8d/0xba
 [a013a25f] ? kvm_emulate_pio+0x1ab/0x1ff [kvm]
 [8138205a] __mutex_lock_common+0x107/0x39c
 [a013a25f] ? kvm_emulate_pio+0x1ab/0x1ff [kvm]
 [a013a25f] ? kvm_emulate_pio+0x1ab/0x1ff [kvm]
 [81382398] mutex_lock_nested+0x35/0x3a
 [a013a25f] kvm_emulate_pio+0x1ab/0x1ff [kvm]
 [a015b695] ? kvm_register_read+0x26/0x35 [kvm_intel]
 [a015c875] handle_io+0x6e/0x76 [kvm_intel]
 [a015d202] kvm_handle_exit+0x1ba/0x1db [kvm_intel]
 [a013c534] kvm_arch_vcpu_ioctl_run+0x50b/0x73a [kvm]
 [a01344a7] kvm_vcpu_ioctl+0xfc/0x48b [kvm]
 [81163618] ? inode_has_perm+0x6c/0x72
 [810eac30] vfs_ioctl+0x2a/0x78
 [810eb0e9] do_vfs_ioctl+0x46b/0x4ab
 [810eb17e] sys_ioctl+0x55/0x77
 [810112ba] system_call_fastpath+0x16/0x1b


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 2.6.29-rc3 circular locking dependency detected

2009-02-03 Thread Avi Kivity

Mark McLoughlin wrote:

Hi,

Just saw this when starting a guest with an assigned device.

Cheers,
Mark.

===
[ INFO: possible circular locking dependency detected ]
2.6.29-0.74.rc3.git3.fc11.x86_64 #1
---
qemu-kvm/3706 is trying to acquire lock:
 (kvm-lock){--..}, at: [a013a25f] kvm_emulate_pio+0x1ab/0x1ff [kvm]

but task is already holding lock:
 (kvm-slots_lock){}, at: [a013c4c0] kvm_arch_vcpu_ioctl_run+0x49
7/0x73a [kvm]
  


This is the expected nesting. kvm-slots_lock is outer to kvm-lock.


which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

- #1 (kvm-slots_lock){}:
   [8106e9c1] __lock_acquire+0xaab/0xc41
   [8106ebe4] lock_acquire+0x8d/0xba
   [813826ae] down_read+0x4b/0x7f
   [a0137ff2] kvm_iommu_map_guest+0x62/0xb8 [kvm]
   [a01363ea] kvm_vm_ioctl+0x3f4/0x7f1 [kvm]
   [810eac30] vfs_ioctl+0x2a/0x78
   [810eb0e9] do_vfs_ioctl+0x46b/0x4ab
   [810eb17e] sys_ioctl+0x55/0x77
   [810112ba] system_call_fastpath+0x16/0x1b
   [] 0x
  


I think taking slots_lock in kvm_vm_ioctl_assign_device() (and dropping 
it from kvm_iommu_map_guest) should suffice, no?



--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: 2.6.29-rc3 circular locking dependency detected

2009-02-03 Thread Mark McLoughlin
On Tue, 2009-02-03 at 12:47 +0200, Avi Kivity wrote:
 Mark McLoughlin wrote:

  which lock already depends on the new lock.
 
  the existing dependency chain (in reverse order) is:
 
  - #1 (kvm-slots_lock){}:
 [8106e9c1] __lock_acquire+0xaab/0xc41
 [8106ebe4] lock_acquire+0x8d/0xba
 [813826ae] down_read+0x4b/0x7f
 [a0137ff2] kvm_iommu_map_guest+0x62/0xb8 [kvm]
 [a01363ea] kvm_vm_ioctl+0x3f4/0x7f1 [kvm]
 [810eac30] vfs_ioctl+0x2a/0x78
 [810eb0e9] do_vfs_ioctl+0x46b/0x4ab
 [810eb17e] sys_ioctl+0x55/0x77
 [810112ba] system_call_fastpath+0x16/0x1b
 [] 0x

 
 I think taking slots_lock in kvm_vm_ioctl_assign_device() (and dropping 
 it from kvm_iommu_map_guest) should suffice, no?

Just from a quick look, that seems right - also need to remove the
locking from kvm_iommu_unmap_memslots()

Cheers,
Mark.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html