From owner-freebsd-stable@FreeBSD.ORG Mon Jun 17 19:37:30 2013 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id CF41E442 for ; Mon, 17 Jun 2013 19:37:30 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 2BFB31AF6 for ; Mon, 17 Jun 2013 19:37:29 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r5HJbQdb018758; Mon, 17 Jun 2013 22:37:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r5HJbQdb018758 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r5HJbQwI018757; Mon, 17 Jun 2013 22:37:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 17 Jun 2013 22:37:26 +0300 From: Konstantin Belousov To: Michiel Boland Subject: Re: system sporadically hangs on shutdown after switching to WITH_NEW_XORG Message-ID: <20130617193726.GR91021@kib.kiev.ua> References: <51BDD593.5000102@xs4all.nl> <51BF60A8.6000503@xs4all.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="w2Q1kmhlT73y7Um/" Content-Disposition: inline In-Reply-To: <51BF60A8.6000503@xs4all.nl> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: FreeBSD Stable X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jun 2013 19:37:30 -0000 --w2Q1kmhlT73y7Um/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 17, 2013 at 09:16:56PM +0200, Michiel Boland wrote: > On 06/16/2013 17:11, Michiel Boland wrote: > > Hi. Recently I switched to WITH_NEW_XORG, primarily because the stock X= server > > with Intel driver has some issues that make it unusable for me. > > > > The new X server and Intel driver works extremely well, so kudos to who= ever made > > this possible. > > > > Unfortunately, I am now experiencing random hangs on shutdown. On shutd= own the > > system randomly freezes after > > > > [...] syslogd: exiting on signal 15 > > > > I would then expect to see 'Waiting (max 60 seconds) for system process= 'XXX' to > > stop messages, but these never arrive. >=20 > So it turns out that init hangs because vga_txtmouse (draw_txtmouse in fa= ct) is=20 > hogging the clock swi. The routine is waiting for a vertical retrace whic= h never=20 > arrives. (The new intel driver can't return to text console, so the scree= n just=20 > goes blank when X exits.) >=20 > Some workarounds: >=20 > - don't run moused (i.e. disable it in rc.conf and devd.conf) > instead run the X server in combination with hald >=20 > - do run moused, but then either >=20 > - unplug the mouse before shutting down >=20 > - build a kernel with VGA_NO_FONT_LOADING >=20 > Of course the long-term fix is to remove the possibly infinite loop in=20 > draw_txtmouse. >=20 > Thanks to Konstantin for his patience in helping me track this down. The following patch, although a hack, should fix the issue. Michiel tested it. diff --git a/sys/dev/drm2/i915/intel_fb.c b/sys/dev/drm2/i915/intel_fb.c index 3cb3b78..e41a49f 100644 --- a/sys/dev/drm2/i915/intel_fb.c +++ b/sys/dev/drm2/i915/intel_fb.c @@ -207,6 +207,8 @@ static void intel_fbdev_destroy(struct drm_device *dev, } } =20 +extern int sc_txtmouse_no_retrace_wait; + int intel_fbdev_init(struct drm_device *dev) { struct intel_fbdev *ifbdev; @@ -229,6 +231,7 @@ int intel_fbdev_init(struct drm_device *dev) =20 drm_fb_helper_single_add_all_connectors(&ifbdev->helper); drm_fb_helper_initial_config(&ifbdev->helper, 32); + sc_txtmouse_no_retrace_wait =3D 1; return 0; } =20 diff --git a/sys/dev/syscons/scvgarndr.c b/sys/dev/syscons/scvgarndr.c index 6e6663c..fc7f02f 100644 --- a/sys/dev/syscons/scvgarndr.c +++ b/sys/dev/syscons/scvgarndr.c @@ -395,6 +395,8 @@ vga_txtblink(scr_stat *scp, int at, int flip) { } =20 +int sc_txtmouse_no_retrace_wait; + #ifndef SC_NO_CUTPASTE =20 static void @@ -445,7 +447,9 @@ draw_txtmouse(scr_stat *scp, int x, int y) #if 1 /* wait for vertical retrace to avoid jitter on some videocards */ crtc_addr =3D scp->sc->adp->va_crtc_addr; - while (!(inb(crtc_addr + 6) & 0x08)) /* idle */ ; + while (!sc_txtmouse_no_retrace_wait && + !(inb(crtc_addr + 6) & 0x08)) + /* idle */ ; #endif c =3D scp->sc->mouse_char; vidd_load_font(scp->sc->adp, 0, 32, 8, font_buf, c, 4);=20 --w2Q1kmhlT73y7Um/ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJRv2V2AAoJEJDCuSvBvK1BnoYP/jpuSewCk+00USw6beL6CquJ /0Eug9CHqR2UTp+Yzc16acLYLLHMzHub3aAPErZg5SBm1YbciCHA4/5AGiAf8G0V hoouxWW8yki2MgGNeq5Op3sIjVHZBSuXYPIOOHi9clVhcHj0QLsX9ii0LTmlste+ Fa8KQyIjXAqQb/5YU5BuqNExagVmtm7FHxNtrcrqFnEZ1lNds8NoUxPP3roXCkx3 C4GtAanXk6e6Lx+ChuN8T66kXCyR89B05i5Vb4CToko2oc1WPvjgBxLguv5kMis6 NAGJZlwE0WoYkB9KGnqbg4kk12jih9JPe1rBw9hypg5gYoeNdaqqNHpQgl007wWu xYQMgXnXxR4lwfQKqGjGMlCUsYo/XlYlaxbo8o1213GxHqMX16gYaKR3VZFYmdAZ cauwsFZ7koUpgF6EfNHh4U3kHPqQlRle8P4rMV4ug++u9DanUjyRKMU8K7YC9nX7 kjMhzDrflM8iAHqQqOW4QCJ29bvt3nzu+u5DknPagU6VB3P7TKvDGz8FdqJWpDlk ts65MP5uEtX0zRw5l1EXGWZxMN09sVETtaRf1OiIi3ktuJwUD8RA1eOyVhIGWzro ZYS8hjNuLSO5I73z86w7XoRZvbW0eeeq3XyAPq63Cig5K5KDLSOsHF7DlvEOp2Fy bhissJ6cJUO7y6kw/T6Q =8GIf -----END PGP SIGNATURE----- --w2Q1kmhlT73y7Um/--