aboutsummaryrefslogtreecommitdiff
path: root/linux-core/drm_lock.c
AgeCommit message (Collapse)Author
2008-04-28Merge branch 'master' into modesetting-101Thomas Hellstrom
Conflicts: linux-core/Makefile.kernel linux-core/drm_compat.c linux-core/drm_fops.c linux-core/drm_lock.c shared-core/drm.h shared-core/i915_dma.c shared-core/i915_drv.h shared-core/i915_irq.c
2008-04-23Don't disable IRQs, just tasklets, when taking the drm lock spinlock.Thomas Hellstrom
2008-03-14fix build problemsAlan Hourihane
2008-03-14drm: Fix race that can lockup the kernelMike Isely
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>
2008-02-13start moving over to proper hierarchy wrt master accessesDave Airlie
2008-02-13major port of multi-master ideas into modesettingDave Airlie
2007-07-20Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove DRM_DEVICE.Eric Anholt
The data is now in kernel space, copied in/out as appropriate according to the This results in DRM_COPY_{TO,FROM}_USER going away, and error paths to deal with those failures. This also means that XFree86 4.2.0 support for i810 DRM is lost.
2007-07-20Replace filp in ioctl arguments with drm_file *file_priv.Eric Anholt
As a fallout, replace filp storage with file_priv storage for "unique identifier of a client" all over the DRM. There is a 1:1 mapping, so this should be a noop. This could be a minor performance improvement, as everything on Linux dereferenced filp to get file_priv anyway, while only the mmap ioctls went the other direction.
2007-07-20Remove DRM_ERR OS macro.Eric Anholt
This was used to make all ioctl handlers return -errno on linux and errno on *BSD. Instead, just return -errno in shared code, and flip sign on return from shared code to *BSD code.
2007-07-16drm: remove drmP.h internal typedefsDave Airlie
2007-07-16drm: detypedef drm.h and fixup all problemsDave Airlie
2007-02-14Fix multiple spinlock unlockingThomas Hellstrom
2007-02-13Bugzilla Bug #9457Thomas Hellstrom
Add refcounting of user waiters to the DRM hardware lock, so that we can use the DRM_LOCK_CONT flag more conservatively. Also add a kernel waiter refcount that if nonzero transfers the lock for the kernel context, when it is released. This is useful when waiting for idle and can be used for very simple fence object driver implementations for the new memory manager. It also resolves the AIGLX startup deadlock for the sis and the via drivers. i810, i830 still require that the hardware lock is really taken so the deadlock remains for those two. I'm not sure about ffb. Anyone familiar with that code?
2006-10-02Fix type of second argument to spin_lock_irqsave().Michel Dänzer
(cherry picked from f6238cf6244b32bd84e3d2819963d7f5473867c8 commit)
2006-10-02Trap and be verbose about a deadlock that occurs with AIGLX and drivers thatThomas Hellstrom
use drm_reclaim_buffers_locked().
2006-09-29Add support for interrupt triggered driver callback with lock held to DRM core.Michel Dänzer
(cherry picked from d817cc1f30060fcc4a85a05b2de8a2a1687421b5 commit)
2006-09-27Activate error message that was never hit since it was maskedThomas Hellstrom
by drm_lock_transfer. Ifdef out drm_lock_transfer. I see no use for it currently. Should be removed.
2006-09-26Remove the call to drm_lock_transfer, since it is not used anymore.Thomas Hellstrom
Fix up drm_lock_free to retain the last locking context information.
2006-09-15Allow a "native type" to be associated with a fence sequence.Thomas Hellstrom
In the intel case, we can associate a flush with a sequence.
2006-09-12More bugfixes.Thomas Hellstrom
Disable the i915 IRQ turnoff for now since it seems to be causing problems.
2006-08-28Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm into ↵Thomas Hellstrom
drm-ttm-0-2-branch Conflicts: linux-core/drmP.h
2006-08-28drm: lots of small cleanups and whitespace issues fixed upDave Airlie
remove a mach64 warning, align a lot of things from linux kernel
2006-08-21Generic DRM support base-class support for user-space objects, likeThomas Hellstrom
fence objects and buffer objects: Refcounting, Inter-process sharing, Synchronization Destruction.
2006-02-18fix build wrong function callDave Airlie
2006-02-18major realigment of DRM CVS with kernel code, makes integration much easierDave Airlie
2005-11-11convert to use __set_current_state, align some header includesDave Airlie
2005-06-04misc cleanup patch from Adrian BunkDave Airlie
2005-04-20A fix for a locking bug which is triggered when a client tries to lock withThomas Hellstrom
flag DMA_QUIESCENT (typically the X server), but gets interrupted by a signal. The locking IOCTL should then return an error, but if DMA_QUIESCENT succeeds it returns 0, and the client falsely thinks it has the lock. In addition The client waits for DMA_QUISCENT and possibly DMA_READY without having the lock.
2004-10-18Update Doxygen configuration & comments.Jose Fonseca
2004-10-12Breakout heads into their own data structures.Jon Smirl
2004-10-10Rename fn_tbl to driver. Core driver now uses pci_driver name whichJon Smirl
reflects the personality name.
2004-09-30Lindent of core build. Drivers checked for no binary diffs. A few filesJon Smirl
weren't Lindent's because their comments didn't convert very well. A bunch of other minor clean up with no code implact included.
2004-09-30Move things around to reduce public symbols and even out files. Switch toJon Smirl
get_order from drm_order.
2004-09-27First check in for DRM that splits core from personality modulesJon Smirl
2004-08-27__NO_VERSION__ hasn't been needed since 2.3 days ditch it...Dave Airlie
2004-07-05fixes from kernel for 0 vs NULL - mikaDave Airlie
2003-05-27Merged DRM documentation.Jose Fonseca
2003-04-22Move the excitingly named DRM(flush_block_and_flush) and friends toKeith Whitwell
gamma-specific code. Fix templates so i8x0 drivers don't have to define __HAVE_DMA_WAITLIST.
2003-03-28merged drm-filp-0-1-branchKeith Whitwell
2002-09-21make sure we never oops because the hardware lock pointer in the sigdataMichel Daenzer
structure is out of date
2001-02-15Merge mga-1-0-0-branch into trunk.Gareth Hughes