Bug 12920

Summary: savage: mmap2 of /dev/dri/card0 fails with EAGAIN since 2.6.29-rc6
Product: Platform Specific/Hardware Reporter: Alex Villacis Lasso (avillaci)
Component: i386Assignee: platform_i386
Status: CLOSED CODE_FIX    
Severity: normal CC: rjw, suresh.b.siddha, the.masch, venki
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.29-rc6 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 12398    
Attachments: Kernel configuration which succeeds in 2.6.29-rc5 and fails in 2.6.29-rc6 and up.
dmesg output for 2.6.29-rc8 which also shows the bug.
Full xorg log when bug happens.
strace output that shows EAGAIN as error from mmap2
strace output that shows EAGAIN as error from mmap2

Description Alex Villacis Lasso 2009-03-23 08:58:05 UTC
Latest working kernel version: 2.6.29-rc5
Earliest failing kernel version: 2.6.29-rc6
Distribution: Fedora 10 i386
Hardware Environment:

/proc/cpuinfo:
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 15
model		: 1
model name	: Intel(R) Pentium(R) 4 CPU 1.70GHz
stepping	: 2
cpu MHz		: 1700.047
cache size	: 256 KB
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 2
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pebs bts
bogomips	: 3400.09
clflush size	: 64
power management:

/proc/iomem:
00000000-0000ffff : reserved
00010000-0009fbff : System RAM
0009fc00-0009ffff : reserved
000a0000-000bffff : Video RAM area
000c0000-000cbfff : Video ROM
000f0000-000fffff : reserved
  000f0000-000fffff : System ROM
00100000-1f7effff : System RAM
  00400000-0068676c : Kernel code
  0068676d-007eca67 : Kernel data
  00838000-00c3fd83 : Kernel bss
1f7f0000-1f7f7fff : ACPI Tables
1f7f8000-1f7fffff : ACPI Non-volatile Storage
ceb00000-debfffff : PCI Bus 0000:01
  d0000000-d7ffffff : 0000:01:00.0
    d0000000-d06effff : vesafb
ded00000-deefffff : PCI Bus 0000:01
  dee70000-dee7ffff : 0000:01:00.0
  dee80000-deefffff : 0000:01:00.0
df000000-df7fffff : 0000:00:09.0
dffe0000-dffe7fff : 0000:00:09.0
dfffee00-dfffeeff : 0000:00:12.0
  dfffee00-dfffeeff : via-rhine
dfffef00-dfffefff : 0000:00:10.3
  dfffef00-dfffefff : ehci_hcd
dffff000-dfffffff : 0000:00:09.0
e0000000-efffffff : 0000:00:00.0
fec00000-fec00fff : reserved
fee00000-fee00fff : Local APIC
  fee00000-fee00fff : reserved
fff80000-ffffffff : reserved

/proc/ioports:
0000-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-0060 : keyboard
0064-0064 : keyboard
0070-0071 : rtc0
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
0170-0177 : 0000:00:11.1
  0170-0177 : pata_via
01f0-01f7 : 0000:00:11.1
  01f0-01f7 : pata_via
0201-0208 : ns558-pnp
0295-0296 : it87
  0295-0296 : it87
0330-0331 : MPU401 UART
0376-0376 : 0000:00:11.1
  0376-0376 : pata_via
0378-037a : parport0
03c0-03df : vesafb
03f2-03f2 : floppy
03f4-03f5 : floppy
03f6-03f6 : 0000:00:11.1
  03f6-03f6 : pata_via
03f7-03f7 : floppy
03f8-03ff : serial
0400-040f : 0000:00:11.0
  0400-0407 : vt596_smbus
0800-087f : 0000:00:11.0
  0800-0803 : ACPI PM1a_EVT_BLK
  0804-0805 : ACPI PM1a_CNT_BLK
  0808-080b : ACPI PM_TMR
  0810-0815 : ACPI CPU throttle
  0820-0823 : ACPI GPE0_BLK
0cf8-0cff : PCI conf1
cc00-ccff : 0000:00:12.0
  cc00-ccff : via-rhine
d000-d0ff : 0000:00:11.5
  d000-d0ff : VIA8233
d400-d41f : 0000:00:10.0
  d400-d41f : uhci_hcd
d800-d81f : 0000:00:10.1
  d800-d81f : uhci_hcd
dc00-dc1f : 0000:00:10.2
  dc00-dc1f : uhci_hcd
e000-e007 : 0000:00:0b.0
e400-e407 : 0000:00:0b.0
  e400-e402 : parport1
  e403-e407 : parport1
e800-e81f : 0000:00:0b.0
  e800-e807 : serial
  e808-e80f : serial
ec00-ecff : 0000:00:09.0
fc00-fc0f : 0000:00:11.1
  fc00-fc0f : pata_via

lspci -vvv
00:00.0 Host bridge: VIA Technologies, Inc. P4M266 Host Bridge
	Subsystem: VIA Technologies, Inc. Device 0000
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort+ >SERR- <PERR- INTx-
	Latency: 8
	Region 0: Memory at e0000000 (32-bit, prefetchable) [size=256M]
	Capabilities: [a0] AGP version 2.0
		Status: RQ=32 Iso- ArqSz=0 Cal=0 SBA+ ITACoh- GART64- HTrans- 64bit- FW- AGP3- Rate=x1,x2,x4
		Command: RQ=1 ArqSz=0 Cal=0 SBA- AGP+ GART64- 64bit- FW- Rate=x4
	Capabilities: [c0] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: agpgart-via
	Kernel modules: via-agp

00:01.0 PCI bridge: VIA Technologies, Inc. VT8633 [Apollo Pro266 AGP] (prog-if 00 [Normal decode])
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-
	Status: Cap+ 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort+ >SERR- <PERR+ INTx-
	Latency: 0
	Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
	I/O behind bridge: 0000f000-00000fff
	Memory behind bridge: ded00000-deefffff
	Prefetchable memory behind bridge: ceb00000-debfffff
	Secondary status: 66MHz- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- <SERR- <PERR-
	BridgeCtl: Parity- SERR- NoISA+ VGA+ MAbort- >Reset- FastB2B-
		PriDiscTmr- SecDiscTmr- DiscTmrStat- DiscTmrSERREn-
	Capabilities: [80] Power Management version 2
		Flags: PMEClk- DSI- D1+ D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-

00:09.0 VGA compatible controller: Oak Technology, Inc OTI-64111 [Spitfire] (rev 10) (prog-if 00 [VGA controller])
	Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Interrupt: pin A routed to IRQ 11
	Region 0: Memory at dffff000 (32-bit, non-prefetchable) [disabled] [size=4K]
	Region 1: Memory at df000000 (32-bit, non-prefetchable) [disabled] [size=8M]
	Region 2: I/O ports at ec00 [disabled] [size=256]
	Expansion ROM at dffe0000 [disabled] [size=32K]

00:0b.0 Serial controller: Timedia Technology Co Ltd PCI2S550 (Dual 16550 UART) (rev 01) (prog-if 02 [16550])
	Subsystem: Timedia Technology Co Ltd Device 5079
	Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping+ SERR+ FastB2B- DisINTx-
	Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Interrupt: pin A routed to IRQ 11
	Region 0: I/O ports at e800 [size=32]
	Region 2: I/O ports at e400 [size=8]
	Region 3: I/O ports at e000 [size=8]
	Kernel driver in use: serial
	Kernel modules: parport_pc

00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 80) (prog-if 00 [UHCI])
	Subsystem: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 32, Cache Line Size: 32 bytes
	Interrupt: pin A routed to IRQ 5
	Region 4: I/O ports at d400 [size=32]
	Capabilities: [80] Power Management version 2
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: uhci_hcd
	Kernel modules: uhci-hcd

00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 80) (prog-if 00 [UHCI])
	Subsystem: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 32, Cache Line Size: 32 bytes
	Interrupt: pin B routed to IRQ 11
	Region 4: I/O ports at d800 [size=32]
	Capabilities: [80] Power Management version 2
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: uhci_hcd
	Kernel modules: uhci-hcd

00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 80) (prog-if 00 [UHCI])
	Subsystem: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 32, Cache Line Size: 32 bytes
	Interrupt: pin C routed to IRQ 5
	Region 4: I/O ports at dc00 [size=32]
	Capabilities: [80] Power Management version 2
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: uhci_hcd
	Kernel modules: uhci-hcd

00:10.3 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 82) (prog-if 20 [EHCI])
	Subsystem: VIA Technologies, Inc. USB 2.0
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 32, Cache Line Size: 128 bytes
	Interrupt: pin D routed to IRQ 11
	Region 0: Memory at dfffef00 (32-bit, non-prefetchable) [size=256]
	Capabilities: [80] Power Management version 2
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME+
	Kernel driver in use: ehci_hcd
	Kernel modules: ehci-hcd

00:11.0 ISA bridge: VIA Technologies, Inc. VT8235 ISA Bridge
	Subsystem: VIA Technologies, Inc. KT4AV motherboard
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping+ SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Capabilities: [c0] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel modules: via-ircc, i2c-viapro

00:11.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06) (prog-if 8a [Master SecP PriP])
	Subsystem: VIA Technologies, Inc. VT82C586/B/VT82C686/A/B/VT8233/A/C/VT8235 PIPC Bus Master IDE
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 32
	Interrupt: pin A routed to IRQ 255
	Region 0: [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]
	Region 1: [virtual] Memory at 000003f0 (type 3, non-prefetchable) [size=1]
	Region 2: [virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]
	Region 3: [virtual] Memory at 00000370 (type 3, non-prefetchable) [size=1]
	Region 4: I/O ports at fc00 [size=16]
	Capabilities: [c0] Power Management version 2
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: pata_via

00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 50)
	Subsystem: VIA Technologies, Inc. K7VT2 motherboard
	Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Interrupt: pin C routed to IRQ 5
	Region 0: I/O ports at d000 [size=256]
	Capabilities: [c0] Power Management version 2
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: VIA 82xx Audio
	Kernel modules: snd-via82xx

00:12.0 Ethernet controller: VIA Technologies, Inc. VT6102 [Rhine-II] (rev 74)
	Subsystem: VIA Technologies, Inc. VT6102 [Rhine II] Embeded Ethernet Controller on VT8235
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 32 (750ns min, 2000ns max), Cache Line Size: 32 bytes
	Interrupt: pin A routed to IRQ 5
	Region 0: I/O ports at cc00 [size=256]
	Region 1: Memory at dfffee00 (32-bit, non-prefetchable) [size=256]
	Capabilities: [40] Power Management version 2
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Kernel driver in use: via-rhine
	Kernel modules: via-rhine

01:00.0 VGA compatible controller: S3 Inc. VT8375 [ProSavage8 KM266/KL266] (prog-if 00 [VGA controller])
	Subsystem: S3 Inc. VT8375 [ProSavage8 KM266/KL266]
	Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz+ UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 32 (1000ns min, 63750ns max), Cache Line Size: 32 bytes
	Interrupt: pin A routed to IRQ 5
	Region 0: Memory at dee80000 (32-bit, non-prefetchable) [size=512K]
	Region 1: Memory at d0000000 (32-bit, prefetchable) [size=128M]
	Expansion ROM at dee70000 [disabled] [size=64K]
	Capabilities: [dc] Power Management version 2
		Flags: PMEClk- DSI+ D1+ D2+ AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
		Status: D0 PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [80] AGP version 2.0
		Status: RQ=32 Iso- ArqSz=0 Cal=0 SBA- ITACoh- GART64- HTrans- 64bit- FW- AGP3- Rate=x4
		Command: RQ=32 ArqSz=0 Cal=0 SBA- AGP+ GART64- 64bit- FW- Rate=x4
	Kernel modules: savagefb



Software Environment:
Linux version 2.6.29-rc8 (alex@karlalex.palosanto.com) (gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC) ) #1 PREEMPT Sat Mar 21 13:57:36 ECT 2009
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.
 
Linux karlalex.palosanto.com 2.6.29-rc8 #1 PREEMPT Sat Mar 21 13:57:36 ECT 2009 i686 i686 i386 GNU/Linux
 
Gnu C                  4.3.2
Gnu make               3.81
binutils               2.18.50.0.9
util-linux             2.14.1
mount                  support
module-init-tools      3.5
e2fsprogs              1.41.4
pcmciautils            014
quota-tools            3.16.
PPP                    2.4.4
Linux C Library        2.9
Dynamic linker (ldd)   2.9
Procps                 3.2.7
Net-tools              1.60
Kbd                    1.12
oprofile               0.9.4
Sh-utils               6.12
udev                   127
wireless-tools         29
Modules Loaded         usb_storage ipv6 fuse savage drm eeprom sco bridge stp llc bnep l2cap bluetooth it87 hwmon_vid hwmon vfat fat dm_multipath uinput ppdev snd_via82xx snd_ac97_codec ac97_bus snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_pcm_oss snd_mixer_oss floppy snd_pcm i2c_viapro pcspkr sr_mod via_rhine i2c_core snd_timer mii snd_page_alloc cdrom via_ircc irda crc_ccitt snd_mpu401 snd_mpu401_uart snd_rawmidi snd_seq_device ns558 snd gameport soundcore parport_pc parport via_agp uhci_hcd ohci_hcd ehci_hcd usbcore

Problem Description:
A regression was introduced between 2.6.29-rc5 and -rc6 that results in an attempt to mmap2 on /dev/dri/card0 (ProSavageDDRK) to fail with EAGAIN. This hits the X server and results in broken DRI/Mesa support.


Steps to reproduce:
Get 2.6.29-rc6 or higher and a Savage chipset (don't know about other chipsets)
Attempt to start X
Report DRI support (from Xorg.0.log)

When the bug hits, the following appears on the X log:
----------------
(II) [drm] loaded kernel module for "savage" driver.
(II) [drm] DRM interface version 1.3
(II) [drm] DRM open master succeeded.
(II) SAVAGE(0): [drm] Using the DRM lock SAREA also for drawables.
(II) SAVAGE(0): [drm] framebuffer handle = 0xd0000000
(II) SAVAGE(0): [drm] added 1 reserved context for kernel
(II) SAVAGE(0): X context handle = 0x1
(II) SAVAGE(0): [drm] installed DRM signal handler
(II) SAVAGE(0): [agp] Mode 0x1f000207 [AGP 0x1106/0x3148; Card 0x5333/0x8d04]
(II) SAVAGE(0): [agp] 16384 kB allocated with handle 0x00000001
(II) SAVAGE(0): [agp] command DMA handle = 0xe0000000
(II) SAVAGE(0): [agp] agpTextures handle = 0xe0100000
(II) SAVAGE(0): [drm] aperture handle = 0xd2000000
(II) SAVAGE(0): [drm] Enabling ShadowStatus for DRI.
(II) SAVAGE(0): [drm] Status handle = 0x18a12000
(EE) SAVAGE(0): [drm] Could not map status page
(II) SAVAGE(0): [drm] removed 1 reserved context for kernel
(II) SAVAGE(0): [drm] unmapping 8192 bytes of SAREA 0xe0010000 at 0xb803a000
(II) SAVAGE(0): [drm] Closed DRM master.
(II) SAVAGE(0): Resetting ShadowStatus.
(EE) SAVAGE(0): DRI isn't enabled
----------------

A strace of the Xorg process shows:
open("/dev/dri/card0", O_RDWR|O_LARGEFILE) = 12
write(0, "drmOpenDevice: open result is 12,"..., 39) = 39
ioctl(12, DEVFSDIOC_GET_PROTO_REV, 0x9f89180) = 0
ioctl(12, DEVFSDIOC_GET_PROTO_REV, 0x9f89180) = 0
...
ioctl(12, 0xc0186415, 0xbfe7c678)       = 0
write(0, "(II) SAVAGE(0): [drm] Status hand"..., 49) = 49
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 12, 0x14335) = -1 EAGAIN (Resource temporarily unavailable)
write(2, "(EE) SAVAGE(0): [drm] Could not m"..., 48) = 48
write(0, "(EE) SAVAGE(0): [drm] Could not m"..., 48) = 48
munmap(0xffffffff, 4096)                = -1 EINVAL (Invalid argument)
Comment 1 Alex Villacis Lasso 2009-03-23 08:59:49 UTC
Created attachment 20642 [details]
Kernel configuration which succeeds in 2.6.29-rc5 and fails in 2.6.29-rc6 and up.
Comment 2 Alex Villacis Lasso 2009-03-23 09:01:19 UTC
Created attachment 20643 [details]
dmesg output for 2.6.29-rc8 which also shows the bug.

I do not see any message that could point to some particular problem, because similar messages appear in rc5, but I could be wrong.
Comment 3 Alex Villacis Lasso 2009-03-23 09:01:53 UTC
Created attachment 20644 [details]
Full xorg log when bug happens.
Comment 4 Alex Villacis Lasso 2009-03-23 09:05:11 UTC
Created attachment 20645 [details]
strace output that shows EAGAIN as error from mmap2
Comment 5 Alex Villacis Lasso 2009-03-23 09:07:16 UTC
Created attachment 20646 [details]
strace output that shows EAGAIN as error from mmap2
Comment 6 Alex Villacis Lasso 2009-03-23 09:08:50 UTC
Sorry for double-posting the attachment. 

I attempted to bisect this bug over the weekend. This is what I got so far:

git bisect start
# bad: [fec6c6fec3e20637bee5d276fb61dd8b49a3f9cc] Linux 2.6.29-rc7
git bisect bad fec6c6fec3e20637bee5d276fb61dd8b49a3f9cc
# good: [d2f8d7ee1a9b4650b4e43325b321801264f7c37a] Linux 2.6.29-rc5
git bisect good d2f8d7ee1a9b4650b4e43325b321801264f7c37a
# bad: [ddf9499b3d1e655f212f22b0a703506fcac90b25] x86, Voyager: fix compile by lifting the degeneracy of phys_cpu_present_map
git bisect bad ddf9499b3d1e655f212f22b0a703506fcac90b25
# bad: [ba95fd47d177d46743ad94055908d22840370e06] Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
git bisect bad ba95fd47d177d46743ad94055908d22840370e06
# good: [48c0d9ece360ff6001e2ae36aa9b34446d0388a8] Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
git bisect good 48c0d9ece360ff6001e2ae36aa9b34446d0388a8
# bad: [82eb03cfd862a65363fa2826de0dbd5474cfe5e2] cciss: PCI power management reset for kexec
git bisect bad 82eb03cfd862a65363fa2826de0dbd5474cfe5e2
# good: [8ce9a75a307e142a8871c649627555e0e4a1eefb] Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
git bisect good 8ce9a75a307e142a8871c649627555e0e4a1eefb
Comment 7 Alan 2009-03-23 10:44:38 UTC
I'd take a bet on this being the PAT/mmap breakage again
Comment 8 Ingo Molnar 2009-03-24 02:45:15 UTC
testing latest -tip would be useful:

  http://people.redhat.com/mingo/tip.git/README

in particular the fix below has a chance of resolving it.

	Ingo

---------------->
From 9cdec049389ce2c324fd1ec508a71528a27d4a07 Mon Sep 17 00:00:00 2001
From: Pallipadi, Venkatesh <venkatesh.pallipadi@intel.com>
Date: Mon, 23 Mar 2009 12:07:20 -0700
Subject: [PATCH] x86, PAT, PCI: Change vma prot in pci_mmap to reflect inherited prot

While looking at the issue in the thread:

  http://marc.info/?l=dri-devel&m=123606627824556&w=2

noticed a bug in pci PAT code and memory type setting.

PCI mmap code did not set the proper protection in vma, when it
inherited protection in reserve_memtype. This bug only affects
the case where there exists a WC mapping before X does an mmap
with /proc or /sys pci interface. This will cause X userlevel
mmap from /proc or /sysfs to fail on fork.

Reported-by: Kevin Winchester <kjwinchester@gmail.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Dave Airlie <airlied@redhat.com>
Cc: <stable@kernel.org>
LKML-Reference: <20090323190720.GA16831@linux-os.sc.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/pci/i386.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 5ead808..f234a37 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -319,6 +319,9 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
 			return -EINVAL;
 		}
 		flags = new_flags;
+		vma->vm_page_prot = __pgprot(
+			(pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK) |
+			flags);
 	}
 
 	if (((vma->vm_pgoff < max_low_pfn_mapped) ||
Comment 9 Alan 2009-03-24 10:57:37 UTC
(pwc has a similar problem btw)
Comment 10 Alex Villacis Lasso 2009-03-25 16:21:30 UTC
> 
> diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
> index 5ead808..f234a37 100644
> --- a/arch/x86/pci/i386.c
> +++ b/arch/x86/pci/i386.c
> @@ -319,6 +319,9 @@ int pci_mmap_page_range(struct pci_dev *dev, struct
> vm_area_struct *vma,
>              return -EINVAL;
>          }
>          flags = new_flags;
> +        vma->vm_page_prot = __pgprot(
> +            (pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK) |
> +            flags);
>      }
> 
>      if (((vma->vm_pgoff < max_low_pfn_mapped) ||

Compiling a full kernel takes too long in my machine (over 6 hours), so I tried manually applying this patch on an already compiled 2.6.29-rc8 checkout. However, it did not fix the problem - the symptoms remain exactly the same.
Comment 11 Mario Chacon 2009-03-27 12:02:17 UTC
I have the same problem using archlinux and the latest 2.26.9 kernel of the the distro, I will waiting that the distribution apply the patch. It's work the patch?
Comment 12 Alex Villacis Lasso 2009-03-30 16:00:59 UTC
Bisection points me to the following:

be03d9e8022030c16abf534e33e185bfc3d40eef is first bad commit
commit be03d9e8022030c16abf534e33e185bfc3d40eef
Author: Suresh Siddha <suresh.b.siddha@intel.com>
Date:   Wed Feb 11 11:20:23 2009 -0800

    x86, pat: fix warn_on_once() while mapping 0-1MB range with /dev/mem

    Jeff Mahoney reported:

    > With Suse's hwinfo tool, on -tip:
    > WARNING: at arch/x86/mm/pat.c:637 reserve_pfn_range+0x5b/0x26d()

    reserve_pfn_range() is not tracking the memory range below 1MB
    as non-RAM and as such is inconsistent with similar checks in
    reserve_memtype() and free_memtype()

    Rename the pagerange_is_ram() to pat_pagerange_is_ram() and add the
    "track legacy 1MB region as non RAM" condition.

    And also, fix reserve_pfn_range() to return -EINVAL, when the pfn
    range is RAM. This is to be consistent with this API design.

    Reported-and-tested-by: Jeff Mahoney <jeffm@suse.com>
    Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
    Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

:040000 040000 feb3bf21d762e885284cb1bedb5d2c6c0d16811b b4c2143775386ce15dd49b6749c1f7913d8beb00 M      arch

I have confirmed that reverting this one patch fixes the issue in both 2.6.29-rc8 and 2.6.29 final.
Comment 13 Alex Villacis Lasso 2009-03-31 23:09:09 UTC
Is there anything else I could do to help fix this problem?
Comment 14 Alex Villacis Lasso 2009-03-31 23:28:52 UTC
Going to try re-applying failing commit, then applying http://marc.info/?l=linux-kernel&m=123691716419111&w=2 to see whether this fixes the issue too.
Comment 15 Suresh B Siddha 2009-04-04 00:25:31 UTC
Fix for this issue (http://marc.info/?l=linux-kernel&m=123854290308079&w=2) went into linux-2.6.29.1. Can we please check 2.6.29.1 and close this bug if the issue is resolved?
Comment 16 Alex Villacis Lasso 2009-04-06 16:13:03 UTC
The 2.6.29.1 patch indeed fixes this bug for me. Marking as FIXED.
Comment 17 Mario Chacon 2009-04-06 17:49:35 UTC
The 2.6.29.1 patch indeed fixes this bug for me. Marking as FIXED.