git: drm: Use lockmgr locks with Linux wait queues

Francois Tigeot ftigeot at
Tue Nov 18 13:36:08 PST 2014

commit 88c5318ef0b15bc6f23c6ddfe09d2226a2720d8e
Author: François Tigeot <ftigeot at>
Date:   Tue Nov 18 22:18:03 2014 +0100

    drm: Use lockmgr locks with Linux wait queues
    * On Linux, it is possible to grab a second spinlock in an already
      spinlock-protected code section.
    * The wait_event() macro is used in such a situation in the i915 driver.
      One of the event checks itself tries to grab a second lock. What's more,
      this second lock is a lockmgr lock in the DragonFly kernel. This results
      in the following situation:
        lockmgr LK_EXCLUSIVE
    * Unfortunately if the lockmgr lock can't be acquired, the thread is put
      to sleep and a thread sleeping with a spinlock held leads to a general
      system freeze or a kernel panic.
    * For that reason, we can't use a spinlock in Linux wait queues. Change
      the internal wait_queue_head_t lock to a lockmgr lock.
    Thanks go to Imre Vadász for spotting this horrible issue.

Summary of changes:
 sys/dev/drm/i915/i915_gem.c            |  8 ++++----
 sys/dev/drm/include/linux/completion.h | 18 +++++++++---------
 sys/dev/drm/include/linux/wait.h       | 10 +++++-----
 3 files changed, 18 insertions(+), 18 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list