drm/i915: Avoid potential sleep whilst holding spinlock
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 20 Oct 2009 16:29:16 +0000 (16:29 +0000)
committerEric Anholt <eric@anholt.net>
Thu, 5 Nov 2009 21:33:22 +0000 (13:33 -0800)
commitba86bf8bfc1add5f515db8cf1d6042bb9396a299
treedd50b1d71536030c3a65e94993fc78bcdf4a7a46
parent9a6fc8d0f8c3ee3d42417e8315fc8c8fae1d3213
drm/i915: Avoid potential sleep whilst holding spinlock

Miles Lane reported the following error:
2 locks held by cat/4179:
  #0:  (&p->lock){+.+.+.}, at: [<c10a3884>] seq_read+0x25/0x315
  #1:  (&dev_priv->mm.active_list_lock){+.+...}, at: [<c119a854>]
i915_batchbuffer_info+0x2b/0x124
Pid: 4179, comm: cat Not tainted 2.6.32-rc5-git1 #2
Call Trace:
  [<c104874f>] ? __debug_show_held_locks+0x1e/0x20
  [<c1023fb0>] __might_sleep+0xf0/0xf7
  [<c101c393>] kmap+0x17/0x58
  [<c119a8d6>] i915_batchbuffer_info+0xad/0x124
  [<c10a39bf>] seq_read+0x160/0x315
  [<c108fb8c>] ? rw_verify_area+0x98/0xbb
  [<c10a385f>] ? seq_read+0x0/0x315
  [<c1090331>] vfs_read+0x75/0xa9
  [<c10903f9>] sys_read+0x3b/0x5d
  [<c1002a8f>] sysenter_do_call+0x12/0x36

The fix is relatively simple, use the atomic variants of kmap() that
avoid the potential sleep.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Miles Lane <miles.lane@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/i915_debugfs.c