system sporadically hangs on shutdown after switching to WITH_NEW_XORG

Konstantin Belousov kostikbel at gmail.com
Mon Jun 17 19:37:30 UTC 2013


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 whoever made
> > this possible.
> >
> > Unfortunately, I am now experiencing random hangs on shutdown. On shutdown 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.
> 
> So it turns out that init hangs because vga_txtmouse (draw_txtmouse in fact) is 
> hogging the clock swi. The routine is waiting for a vertical retrace which never 
> arrives. (The new intel driver can't return to text console, so the screen just 
> goes blank when X exits.)
> 
> Some workarounds:
> 
> - don't run moused (i.e. disable it in rc.conf and devd.conf)
>    instead run the X server in combination with hald
> 
> - do run moused, but then either
> 
>   - unplug the mouse before shutting down
> 
>    - build a kernel with VGA_NO_FONT_LOADING
> 
> Of course the long-term fix is to remove the possibly infinite loop in 
> draw_txtmouse.
> 
> 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,
 	}
 }
 
+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)
 
 	drm_fb_helper_single_add_all_connectors(&ifbdev->helper);
 	drm_fb_helper_initial_config(&ifbdev->helper, 32);
+	sc_txtmouse_no_retrace_wait = 1;
 	return 0;
 }
 
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)
 {
 }
 
+int sc_txtmouse_no_retrace_wait;
+
 #ifndef SC_NO_CUTPASTE
 
 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 = 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 = scp->sc->mouse_char;
 	vidd_load_font(scp->sc->adp, 0, 32, 8, font_buf, c, 4); 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20130617/15e0a13c/attachment.sig>


More information about the freebsd-stable mailing list