From owner-freebsd-current@FreeBSD.ORG Mon Oct 11 19:18:20 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7159C106566B for ; Mon, 11 Oct 2010 19:18:20 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from fsm1.ukr.net (fsm1.ukr.net [195.214.192.23]) by mx1.freebsd.org (Postfix) with ESMTP id 305B48FC13 for ; Mon, 11 Oct 2010 19:18:19 +0000 (UTC) Received: from 234-31-132-95.pool.ukrtel.net ([95.132.31.234] helo=localhost) by fsm1.ukr.net with esmtps ID 1P5Nt4-000IWz-T3 ; Mon, 11 Oct 2010 22:18:19 +0300 Date: Mon, 11 Oct 2010 22:18:18 +0300 From: Ivan Klymenko To: Anonymous Message-ID: <20101011221818.0ed775b1@ukr.net> In-Reply-To: <86lj64h8ee.fsf@gmail.com> References: <20101011105904.70dd7e7f@ukr.net> <86lj64h8ee.fsf@gmail.com> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org Subject: Re: system hangs after logging into gdm X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2010 19:18:20 -0000 =D0=92 Mon, 11 Oct 2010 22:49:29 +0400 Anonymous =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > Ivan Klymenko writes: >=20 > > =D0=92 Sun, 10 Oct 2010 15:37:55 -0700 > > Garrett Cooper writes: > > > >>On Sun, Oct 10, 2010 at 3:08 PM, Ivan Klymenko > >>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