system hangs after logging into gdm

Ivan Klymenko fidaj at ukr.net
Mon Oct 11 19:18:20 UTC 2010


В Mon, 11 Oct 2010 22:49:29 +0400
Anonymous <swell.k at gmail.com> пишет:

> Ivan Klymenko <fidaj at ukr.net> writes:
> 
> > В Sun, 10 Oct 2010 15:37:55 -0700
> > Garrett Cooper <gcooper at FreeBSD.org> writes:
> >
> >>On Sun, Oct 10, 2010 at 3:08 PM, Ivan Klymenko <fidaj at ukr.net>
> >>wrote:
> >>> My system has an svn r213507
> >>>
> >>> FreeBSD nonamehost 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r213507: Sun
> >>> Oct 10 22:43:18 EEST 2010
> >>> root at nonamehost:/usr/obj/usr/src/sys/mk9 amd64
> >>>
> >>> after upgrading to r213666 my system hangs after logging into gdm
> >>>
> >>> had to go back to r213507
> >>
> >> What video driver are you using?
> >
> > NVIDIA Driver Version: 260.19.06
> 
> Do you have local patches to make it compile on /head? Could they be
> the cause of the hang? 260.19.04 and 260.19.06 use taskqueue_run(9)
> that was removed in /head at r210377.

patches exist, but the cause is not in them - as Xorg starts, the
system hangs after a few seconds after entering the password box to
login gdm
without a password - it works

--- src/nvidia_os.c.orig	2010-09-15 01:26:27.000000000 +0300
+++ src/nvidia_os.c	2010-09-15 01:27:51.000000000 +0300
@@ -13,6 +13,67 @@
 #include "nv.h"
 #include "nv-freebsd.h"
 
+struct taskqueue {
+        STAILQ_HEAD(, task)     tq_queue;
+        const char              *tq_name;
+        taskqueue_enqueue_fn    tq_enqueue;
+        void                    *tq_context;
+        struct task             *tq_running;
+        struct mtx              tq_mutex;
+        struct thread           **tq_threads;
+        int                     tq_tcount;
+        int                     tq_spin;
+        int                     tq_flags;
+};
+
+static void taskqueue_run(struct taskqueue *, struct task **);
+
+static __inline void
+TQ_LOCK(struct taskqueue *tq)
+{
+        if (tq->tq_spin)
+    	    mtx_lock_spin(&tq->tq_mutex);
+        else
+            mtx_lock(&tq->tq_mutex);
+}
+
+static __inline void
+TQ_UNLOCK(struct taskqueue *tq)
+{
+       if (tq->tq_spin)
+          mtx_unlock_spin(&tq->tq_mutex);
+       else
+          mtx_unlock(&tq->tq_mutex);
+}
+
+static void
+taskqueue_run(struct taskqueue *queue, struct task **tpp)
+{                       
+	struct task *task;
+	int pending;
+
+	mtx_assert(&queue->tq_mutex, MA_OWNED);
+	while (STAILQ_FIRST(&queue->tq_queue)) {
+	/*
+	* Carefully remove the first task from the queue and
+	* zero its pending count.
+	*/
+		task = STAILQ_FIRST(&queue->tq_queue);
+		STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link);
+		pending = task->ta_pending;
+		task->ta_pending = 0;
+		task->ta_running = tpp;
+		*tpp = task;
+		TQ_UNLOCK(queue);
+
+		task->ta_func(task->ta_context, pending);
+
+		TQ_LOCK(queue);
+		*tpp = NULL;
+		wakeup(task);
+	}
+}
+
 MALLOC_DEFINE(M_NVIDIA, "nvidia", "NVIDIA memory allocations");
 TASKQUEUE_DEFINE_THREAD(nvidia);
 
@@ -332,7 +393,8 @@
 
 RM_STATUS NV_API_CALL os_flush_work_queue(void)
 {
-    taskqueue_run(taskqueue_nvidia);
+//    taskqueue_run(taskqueue_nvidia);
+    taskqueue_run(taskqueue_nvidia, &taskqueue_nvidia->tq_running);
     return RM_OK;
 }
 


More information about the freebsd-current mailing list