Bug 19343

Summary: [915GM] xrandr crash X
Product: xorg Reporter: zhao jian <jian.j.zhao>
Component: Driver/intelAssignee: haihao <haihao.xiang>
Status: VERIFIED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: critical    
Priority: high CC: keithp, unggnu, zhenyu.z.wang
Version: git   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 17452    
Attachments:
Description Flags
xorg.conf
none
xorg.0.log
none
restore block handler
none
new patch to fix this bug none

Description zhao jian 2008-12-30 23:06:04 UTC
Created attachment 21580 [details]
xorg.conf

System Environment:
----------------------
Host:		915gm
Arch:		i386
OSD:		Fedora release 8 (Werewolf)
Kernel:		2.6.28-release
Libdrm:		(master)             c34539e8bb5568b1d6059abf139dd08e07e84eea
Mesa:		(intel-2008-q4)      88f4b17555be36f3023f74a1b9c792294f09912b
Xorg:		7.2
Xserver:	(server-1.6-branch)  32e81074b967716865aef08b66ec29caf0fec2c5
Xf86_video_intel:	(xf86-video-intel-2.6-branch)
                 6371dbbee3051d7ac614f5d7a794519a4c04deeb

Bug Description:
---------------------
After start X, X will crash if I type 'xrandr -q', with the following information: 
(EE) intel(0): underrun on pipe B!
xterm:  fatal IO error 11 (Resource temporarily unavailable) or KillClient on X server ":0.0"
XIO:  fatal IO error 104 (Connection reset by peer) on X server ":0.0"
      after 11 requests (10 known processed) with 0 events remaining. 

Following is the information I debugged with gdb: 
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1209530608 (LWP 2773)]
0x080eb221 in xf86RotateBlockHandler (screenNum=0, blockData=0x0,
    pTimeout=0xbf9daa98, pReadmask=0x81de460) at xf86Rotate.c:288
warning: Source file is more recent than executable.
288         (*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
(gdb) bt
#0  0x080eb221 in xf86RotateBlockHandler (screenNum=0, blockData=0x0,
    pTimeout=0xbf9daa98, pReadmask=0x81de460) at xf86Rotate.c:288
#1  0x080eb238 in xf86RotateBlockHandler (screenNum=0, blockData=0x0,
    pTimeout=0xbf9daa98, pReadmask=0x81de460) at xf86Rotate.c:288
#2  0x080eb238 in xf86RotateBlockHandler (screenNum=0, blockData=0x0,
    pTimeout=0xbf9daa98, pReadmask=0x81de460) at xf86Rotate.c:288
#3  0x080eb238 in xf86RotateBlockHandler (screenNum=0, blockData=0x0,
    pTimeout=0xbf9daa98, pReadmask=0x81de460) at xf86Rotate.c:288
#4  0x080eb238 in xf86RotateBlockHandler (screenNum=0, blockData=0x0,
    pTimeout=0xbf9daa98, pReadmask=0x81de460) at xf86Rotate.c:288
#5  0x080eb238 in xf86RotateBlockHandler (screenNum=0, blockData=0x0,
    pTimeout=0xbf9daa98, pReadmask=0x81de460) at xf86Rotate.c:288
#6  0x080eb238 in xf86RotateBlockHandler (screenNum=0, blockData=0x0,
    pTimeout=0xbf9daa98, pReadmask=0x81de460) at xf86Rotate.c:288
#7  0x080eb238 in xf86RotateBlockHandler (screenNum=0, blockData=0x0,
    pTimeout=0xbf9daa98, pReadmask=0x81de460) at xf86Rotate.c:288
#8  0x080eb238 in xf86RotateBlockHandler (screenNum=0, blockData=0x0,
    pTimeout=0xbf9daa98, pReadmask=0x81de460) at xf86Rotate.c:288
#9  0x080eb238 in xf86RotateBlockHandler (screenNum=0, blockData=0x0,
.........
#1000 .... (endless but the same)

Reproduce steps:
----------------
1. xinit&
2. xrandr -q
Comment 1 zhao jian 2008-12-30 23:06:39 UTC
Created attachment 21581 [details]
xorg.0.log
Comment 2 Gordon Jin 2008-12-30 23:24:19 UTC
Other machines don't have this issue.

I think we've tested 915GM in Q4-rc1 and it was fine. 
Jian, please try bisect.
Comment 3 Gordon Jin 2009-01-03 22:49:02 UTC
This seems an xserver regression. And it's interesting other platforms including 945GM are fine.

Reassign this critical bug to Haihao as Zhenyu is not available today.
Comment 4 haihao 2009-01-03 23:19:55 UTC
Created attachment 21648 [details] [review]
restore block handler

I only test this patch on 915GM. Could you test it on other machines?
Comment 5 liuhaien 2009-01-04 00:31:26 UTC
(In reply to comment #4)
> Created an attachment (id=21648) [details]
> restore block handler
> 
> I only test this patch on 915GM. Could you test it on other machines?
> 

thanks ,I have tested your patch on 855gm ,915gm ,945gm and gm965,  No regression.
and 915gm works against this patch.
Comment 6 Wang Zhenyu 2009-01-04 18:14:06 UTC
Patch looks good to me. Please send it to keithp and xorg list.

As this is a xserver issue, it shouldn't block driver 2.6.
Comment 7 haihao 2009-01-04 22:02:19 UTC
Maybe this patch is incorrect. 
If the header of the block handler link pScreen->BlockHandler is not xf86RotateBlockHandler, this patch will remove some other block handlers from the link.
Comment 8 haihao 2009-01-04 22:20:17 UTC
Created attachment 21667 [details] [review]
new patch to fix this bug

This patch avoids a potential endless loop which is introduced by 8f17a31aa721e42925cd6b4616ccad90497818f3: pScreen->BlockHandler and xf86_config->BlockHandler all point to xf86RotateBlockHandler.
Comment 9 haihao 2009-01-11 19:33:31 UTC
Keith has pushed this path into xserver master. Thanks.

commit 5f3188228eb988bd8f08b62c84f98a8ff66ee283
Author: Xiang, Haihao <haihao.xiang@intel.com>
Date:   Tue Jan 6 10:03:19 2009 +0800

    avoid a potential endless loop.
Comment 10 Gordon Jin 2009-01-12 23:06:58 UTC
Keith, could you cherry pick haihao's patch into server-1.6-branch? This bug seems quite critical, so I'd like to see it made into xserver-1.6.
Comment 11 Keith Packard 2009-01-12 23:33:21 UTC
Fixes that need to get into 1.6 should block the 1.6 release bug, and should be posted to the Server16Branch wiki page
Comment 12 Julien Cristau 2009-01-17 10:19:01 UTC
*** Bug 19629 has been marked as a duplicate of this bug. ***
Comment 13 liuhaien 2009-02-17 22:44:20 UTC
verified against:
Libdrm:		(master)0054e14793e585ec0d8e95e3d7b82cbf1a684af8
Mesa:		(mesa_7_4_branch)0e6d9c1a55510cb4096728fb5fcfac77be09129e	
Xserver:	(server-1.6-branch)660c2a7d4c6cb52fd0992e9d2008a24805dc8c02
Xf86_video_intel:		(master)506bbb8341c052499057834a669b82787454b426
GEM_kernel:       (drm-intel-2.6.28)fbb12e74c6793652ae323d78fa3312a8787ff021

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.