From: Kristian H. <kr...@bi...> - 2009-02-18 17:58:05
|
On Wed, Feb 18, 2009 at 12:36 PM, Eric Anholt <er...@an...> wrote: > On Wed, 2009-02-18 at 11:02 -0500, kr...@bi... wrote: >> From: Kristian Høgsberg <kr...@re...> >> >> A number of GEM operations (and legacy drm ones) want to copy data to >> or from userspace while holding the struct_mutex lock. However, the >> fault handler calls us with the mmap_sem held and thus enforces the >> opposite locking order. This patch downs the mmap_sem up front for >> those operations that access userspace data under the struct_mutex >> lock to ensure the locking order is consistent. >> >> Signed-off-by: Kristian Høgsberg <kr...@re...> > > Have you tested this against actually faulting? My understanding was > that you can't recurse on mmap_sem. I tested it and it worked, but didn't add code to detect contention so I can't say for sure I hit that case. mmap_sem is a read/write semaphore, so while we can't recurse, we can get away with taking two reader locks. cheers, Kristian |