linux/drivers
Mike Isely 9df5808cca drm: Fix race that can lockup the kernel
The i915_vblank_swap() function schedules an automatic buffer swap
upon receipt of the vertical sync interrupt.  Such an operation is
lengthy so it can't be allowed to happen in normal interrupt context,
thus the DRM implements this by scheduling the work in a kernel
softirq-scheduled tasklet.  In order for the buffer swap to work
safely, the DRM's central lock must be taken, via a call to
drm_lock_take() located in drivers/char/drm/drm_irq.c within the
function drm_locked_tasklet_func().  The lock-taking logic uses a
non-interrupt-blocking spinlock to implement the manipulations needed
to take the lock.  This semantic would be safe if all attempts to use
the spinlock only happen from process context.  However this buffer
swap happens from softirq context which is really a form of interrupt
context.  Thus we have an unsafe situation, in that
drm_locked_tasklet_func() can block on a spinlock already taken by a
thread in process context which will never get scheduled again because
of the blocked softirq tasklet.  This wedges the kernel hard.

To trigger this bug, run a dual-head cloned mode configuration which
uses the i915 drm, then execute an opengl application which
synchronizes buffer swaps against the vertical sync interrupt.  In my
testing, a lockup always results after running anywhere from 5 minutes
to an hour and a half.  I believe dual-head is needed to really
trigger the problem because then the vertical sync interrupt handling
is no longer predictable (due to being interrupt-sourced from two
different heads running at different speeds).  This raises the
probability of the tasklet trying to run while the userspace DRI is
doing things to the GPU (and manipulating the DRM lock).

The fix is to change the relevant spinlock semantics to be the
interrupt-blocking form.  After this change I am no longer able to
trigger the lockup; the longest test run so far was 20 hours (test
stopped after that point).

Note: I have examined the places where this spinlock is being
employed; all are reasonably short bounded sequences and should be
suitable for interrupts being blocked without impacting overall kernel
interrupt response latency.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2008-03-17 09:54:58 +10:00
..
acorn/char Fix default compose table initialization 2008-03-03 14:53:16 -08:00
acpi ACPI: Remove ACPI_CUSTOM_DSDT_INITRD option 2008-03-15 11:58:04 -07:00
amba
ata [libata] Add support for the RB500 PATA CompactFlash 2008-03-10 20:54:05 -04:00
atm atm: replace remaining __FUNCTION__ occurrences 2008-03-05 18:38:07 -08:00
auxdisplay
base drivers: fix dma_get_required_mask 2008-03-10 16:33:33 -07:00
block block: floppy: fix rmmod lockup 2008-03-13 13:11:43 -07:00
bluetooth Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-03-12 13:08:09 -07:00
cdrom make cdrom.c:check_for_audio_disc() static 2008-03-04 11:28:41 +01:00
char drm: Fix race that can lockup the kernel 2008-03-17 09:54:58 +10:00
clocksource
connector CONNECTOR: make cn_already_initialized static 2008-02-26 18:42:44 -08:00
cpufreq [CPUFREQ] fix section mismatch warnings 2008-03-05 14:45:31 -05:00
cpuidle ACPI, cpuidle: Clarify C-state description in sysfs 2008-02-14 00:09:55 -05:00
crypto [HIFN]: Fix invalid config ifdefs for RNG support 2008-02-15 19:15:05 +08:00
dca DCA: convert struct class_device to struct device. 2008-02-08 15:33:33 -08:00
dio
dma iop-adma.c: replace remaining __FUNCTION__ occurrences 2008-03-13 10:57:09 -07:00
edac
eisa
firewire firewire: fw-ohci: shut up false compiler warning on PPC32 2008-03-14 00:57:00 +01:00
firmware dmi: prevent linked list corruption 2008-02-23 17:12:15 -08:00
gpio gpio/pca953x bugfix: mark as can_sleep 2008-03-10 18:01:19 -07:00
hid HID: add USB IDs for MacBook 3rd generation 2008-02-13 17:08:04 +01:00
hwmon hwmon: normal_i2c arrays should be const 2008-02-18 21:58:15 -05:00
i2c i2c: chips subdirectory is deprecated 2008-03-12 14:15:00 +01:00
ide ide: update references to Documentation/ide/ide.txt (v2) 2008-03-07 21:53:50 +01:00
ieee1394 ieee1394: sbp2: fix for SYM13FW500 bridge (Datafab disk) 2008-03-14 00:56:59 +01:00
infiniband IPoIB: Allocate priv->tx_ring with vmalloc() 2008-03-12 07:51:03 -07:00
input i8042: use SGI_HAS_I8042 to select SGI i8042 handlinig 2008-03-10 18:01:20 -07:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-03-12 13:08:09 -07:00
leds PWM LED driver 2008-02-08 09:22:38 -08:00
lguest lguest: Revert 1ce70c4fac, fix real problem. 2008-03-11 09:35:58 +11:00
macintosh [POWERPC] Fix build of modular drivers/macintosh/apm_emu.c 2008-03-13 10:09:27 +11:00
mca
md md: reduce CPU wastage on idle md array with a write-intent bitmap 2008-03-10 18:01:19 -07:00
media V4L/DVB (7219): zoran: Fix namespace conflicts with Zoran 'GPIO_MAX' enum 2008-02-18 12:18:28 -03:00
memstick memstick: add support for JMicron jmb38x MemoryStick host controller 2008-03-10 18:01:19 -07:00
message [SCSI] mpt fusion: don't oops if NumPhys==0 2008-03-05 14:57:57 -06:00
mfd sm501: add support for the SM502 programmable PLL 2008-03-04 16:35:13 -08:00
misc Merge branches 'release', 'ejd', 'sony' and 'wmi' into release 2008-03-13 01:59:52 -04:00
mmc tifm_sd: DATA_CARRY is not boolean in tifm_sd_transfer_data() 2008-03-15 09:24:21 -07:00
mtd UBI: mtd/ubi/vtbl.c: fix memory leak 2008-03-04 11:03:09 +02:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2008-03-12 13:08:09 -07:00
nubus
of
oprofile d_path: Make get_dcookie() use a struct path argument 2008-02-14 21:17:08 -08:00
parisc [PARISC] make ptr_to_pide() static 2008-03-15 19:17:12 -07:00
parport parport: section fixup 2008-02-13 16:21:19 -08:00
pci Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6 2008-03-13 13:16:22 -07:00
pcmcia PCI: drivers/pcmcia/i82092.c: fix up after pci_bus_region changes 2008-02-21 15:34:35 -08:00
pnp PNP: disable PNP motherboard resources that overlap PCI BARs 2008-03-12 12:39:36 -07:00
power Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6 2008-02-07 09:45:58 -08:00
ps3 [POWERPC] PS3: Update sys-manager button events 2008-02-14 22:11:01 +11:00
rapidio docbook: fix rapidio source files 2008-03-03 10:47:13 -08:00
rtc rtc: add support for the S-35390A RTC chip 2008-03-04 16:35:09 -08:00
s390 [S390] zcrypt: fix ap_device_list handling 2008-03-05 12:37:19 +01:00
sbus
scsi Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6 2008-03-05 17:49:59 -08:00
serial of_serial: fix section mismatch warnings 2008-03-10 18:01:17 -07:00
sh maple: fix device detection 2008-02-26 14:12:09 +09:00
sn
spi spi_bitbang: short transfer status fix 2008-03-13 13:11:43 -07:00
ssb ssb: Add pcibios_enable_device() return value check 2008-03-04 18:36:35 -05:00
tc
telephony
thermal thermal: fix generic thermal I/F for hwmon 2008-03-13 01:49:01 -04:00
uio UIO: fix Greg's stupid changes 2008-02-21 15:27:07 -08:00
usb USB: fix ehci unlink regressions 2008-03-10 16:42:27 -07:00
video fbdev: add BF52x EZkit Display driver 2008-03-10 18:01:20 -07:00
virtio
w1 ds1wm: report bus reset error 2008-03-04 16:35:12 -08:00
watchdog [WATCHDOG] make watchdog/hpwdt.c:asminline_call() static 2008-03-06 21:32:21 +00:00
xen
zorro
Kconfig memstick: initial commit for Sony MemoryStick support 2008-02-09 11:08:34 -08:00
Makefile memstick: initial commit for Sony MemoryStick support 2008-02-09 11:08:34 -08:00