Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Oct 2010 22:18:18 +0300
From:      Ivan Klymenko <fidaj@ukr.net>
To:        Anonymous <swell.k@gmail.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: system hangs after logging into gdm
Message-ID:  <20101011221818.0ed775b1@ukr.net>
In-Reply-To: <86lj64h8ee.fsf@gmail.com>
References:  <20101011105904.70dd7e7f@ukr.net> <86lj64h8ee.fsf@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
=D0=92 Mon, 11 Oct 2010 22:49:29 +0400
Anonymous <swell.k@gmail.com> =D0=BF=D0=B8=D1=88=D0=B5=D1=82:

> Ivan Klymenko <fidaj@ukr.net> writes:
>=20
> > =D0=92 Sun, 10 Oct 2010 15:37:55 -0700
> > Garrett Cooper <gcooper@FreeBSD.org> writes:
> >
> >>On Sun, Oct 10, 2010 at 3:08 PM, Ivan Klymenko <fidaj@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@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
>=20
> 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@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"
=20
+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)
+{                      =20
+	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 =3D STAILQ_FIRST(&queue->tq_queue);
+		STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link);
+		pending =3D task->ta_pending;
+		task->ta_pending =3D 0;
+		task->ta_running =3D tpp;
+		*tpp =3D task;
+		TQ_UNLOCK(queue);
+
+		task->ta_func(task->ta_context, pending);
+
+		TQ_LOCK(queue);
+		*tpp =3D NULL;
+		wakeup(task);
+	}
+}
+
 MALLOC_DEFINE(M_NVIDIA, "nvidia", "NVIDIA memory allocations");
 TASKQUEUE_DEFINE_THREAD(nvidia);
=20
@@ -332,7 +393,8 @@
=20
 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;
 }
=20



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101011221818.0ed775b1>