git: DragonFly_RELEASE_4_0 drm: Use lockmgr locks with Linux wait queues

Francois Tigeot ftigeot at crater.dragonflybsd.org
Tue Nov 18 15:07:23 PST 2014


commit d8f9751d0ff36e11540de0f3b1132ddc6df25639
Author: François Tigeot <ftigeot at wolfpond.org>
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:
    
        spinlock
        lockmgr LK_EXCLUSIVE
        spinunlock
    
    * 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(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/d8f9751d0ff36e11540de0f3b1132ddc6df25639


-- 
DragonFly BSD source repository



More information about the Commits mailing list