Inquiry into a complex bug involving Xorg-Intel-Linux

by Martin Monperrus
This document is a complete analysis of a challenging bug related to Xorg, an Intel graphics card and Linux.
This bug is interesting because the chain of events producing the bug is really long and involves many different software components, and because the guilty software component is not the one we may accuse directly.

Symptoms

* [user experience] Firefox is very slow
* [user experience] Gnome desktop is very slow
* [CPU usage] Xorg takes too much CPU (>50%)
* [Xorg.0.log] Could not open device /dev/dri/card0
* [Xorg.0.log] Failed to open DRM device
* [Xorg.0.log] Failed to become DRM master
* [dmesg] i915: Unknown parameter `modeset'

Solution

Remove "options i915 modeset=1" in "/etc/modprobe.d/i915-kms.conf"
This config file tries to enable kernel mode setting, which does not work with i915.

Chain of events producing the bug

* modprobe is told to load module i915
* modprobe reads /etc/modprobe.d/i915-kms.conf
* modprobe tries to load the module with "options i915 modeset=1"
* modprobe fails to load i915 (error: Unknown parameter `modeset')
* udev does not get an event for the DRM (the event should be sent by i915)
* udev does not create /dev/dri/card0
* Xorg can not open /dev/dri/card0
* Xorg can not use hardware based direct rendering
* Xorg extension RENDER falls back to software-based rendering
* libgtk+/pango heavily use RENDER
* all GTK-based applications are very slow (including Firefox)

Responsabilities

* The bug was NOT in the Xorg module intel (intel_drv.so)
* The bug was NOT in the configuration of Xorg (/etc/X11/xorg.conf)
* The bug was NOT in udev, or in the udev rules
* The bug was NOT in kernel modules "i915" or "drm"
* The bug was in the configuration files of modprobe

Additional Information

$ Xorg -version
X.Org X Server 1.7.7
Release Date: 2010-05-04
X Protocol Version 11, Revision 0

xserver-xorg-video-intel
Version: 2:2.9.1-4

/var/log/Xorg.0.log
(II) intel(0): Integrated Graphics Chipset: Intel(R) GM45
(--) intel(0): Chipset: "GM45"
(--) intel(0): Linear framebuffer at 0xE0000000
(--) intel(0): IO registers at addr 0xF6C00000 size 4194304

$ dmesg
agpgart-intel 0000:00:00.0: Intel Mobile Intel GM45 Express Chipset
agpgart-intel 0000:00:00.0: detected 32764K stolen memory
agpgart-intel 0000:00:00.0: AGP aperture is 256M @ 0xe0000000
...
[drm] Initialized drm 1.1.0 20060810
[drm] Initialized i915 1.6.0 20080730 on minor 0

$ find /sys/ -name "drm"
/sys/devices/pci0000:00/0000:00:02.0/drm

Tagged as: