On 28/10/17(Sat) 22:18, [email protected] wrote:
> Hello,
> 
> Since my bug report, I read the beginning of the man page for crash. I now 
> know that the ddb log can be retrieved with the dmesg command at the 
> following boot. The log I attach today must be more accurate than the one I 
> copied by hand last week. By the way, do I have to launch a trace command for 
> every cpu?
> 
> I experienced another way to crash my machine with the same error. While 
> watching youtube videos with firefox, if I wait for the screen to blank for 
> inactivity, the sound still works, but if I want to get the screen up again, 
> the system crashes.
> 
> I will read the crash man page ahead, and try to find more information from 
> the crash dump.
> 
> Thanks a lot for your excellent work.

Does the diff below help?

Index: linux_ww_mutex.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/linux_ww_mutex.h,v
retrieving revision 1.1
diff -u -p -r1.1 linux_ww_mutex.h
--- linux_ww_mutex.h    1 Jul 2017 16:14:10 -0000       1.1
+++ linux_ww_mutex.h    28 Oct 2017 22:41:54 -0000
@@ -96,7 +96,7 @@ ww_mutex_is_locked(struct ww_mutex *lock
  * Return 1 if lock could be acquired, else 0 (contended).
  */
 static inline int
-ww_mutex_trylock(struct ww_mutex *lock) {
+ww_mutex_trylock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) {
        int res = 0;
 
        mtx_enter(&lock->lock);
@@ -106,9 +106,16 @@ ww_mutex_trylock(struct ww_mutex *lock) 
        if (lock->acquired == 0) {
                KASSERT(lock->ctx == NULL);
                lock->acquired = 1;
+               lock->ctx = ctx;
                lock->owner = curproc;
                res = 1;
        }
+       /*
+        * In case we already hold the ww_mutex, increase a count.
+        */
+       else if (lock->owner == curproc) {
+               res = 1;
+       }
        mtx_leave(&lock->lock);
        return res;
 }
@@ -155,7 +162,7 @@ __ww_mutex_lock(struct ww_mutex *lock, s
                         * - We are in the slow-path (first lock to obtain).
                          *
                         * - No context was specified. We assume a single
-                        *   resouce, so there is no danger of a deadlock.
+                        *   resource, so there is no danger of a deadlock.
                          *
                         * - An `older` process (`ctx`) tries to acquire a
                         *   lock already held by a `younger` process.
Index: drm_modeset_lock.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/drm_modeset_lock.c,v
retrieving revision 1.1
diff -u -p -r1.1 drm_modeset_lock.c
--- drm_modeset_lock.c  1 Jul 2017 16:14:10 -0000       1.1
+++ drm_modeset_lock.c  28 Oct 2017 22:42:19 -0000
@@ -309,7 +309,7 @@ static inline int modeset_lock(struct dr
        if (ctx->trylock_only) {
                lockdep_assert_held(&ctx->ww_ctx);
 
-               if (!ww_mutex_trylock(&lock->mutex))
+               if (!ww_mutex_trylock(&lock->mutex, &ctx->ww_ctx))
                        return -EBUSY;
                else
                        return 0;

Reply via email to