diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-10-15 11:33:43 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-10-19 11:00:44 +0200 |
commit | 2225cfe46bcc7558d9e371d1bc117df2df1fbacd (patch) | |
tree | 98a7a3dddd15dc3db44969155dd592b7254603ae /lib/random32.c | |
parent | 3d57b42cabc8472ab63f0adc9529102314218f1e (diff) | |
download | linux-stable-2225cfe46bcc7558d9e371d1bc117df2df1fbacd.tar.gz linux-stable-2225cfe46bcc7558d9e371d1bc117df2df1fbacd.tar.bz2 linux-stable-2225cfe46bcc7558d9e371d1bc117df2df1fbacd.zip |
drm/gem: Use kref_get_unless_zero for the weak mmap references
Compared to wrapping the final kref_put with dev->struct_mutex this
allows us to only acquire the offset manager look both in the final
cleanup and in the lookup. Which has the upside that no locks leak out
of the core abstractions. But it means that we need to hold a
temporary reference to the object while checking mmap constraints, to
make sure the object doesn't disappear. Extended the critical region
would have worked too, but would result in more leaky locking.
Also, this is the final bit which required dev->struct_mutex in gem
core, now modern drivers can be completely struct_mutex free!
This needs a new drm_vma_offset_exact_lookup_locked and makes both
drm_vma_offset_exact_lookup and drm_vma_offset_lookup unused.
v2: Don't leak object references in failure paths (David).
v3: Add a comment from Chris explaining how the ordering works, with
the slight adjustment that I dropped any mention of struct_mutex since
with this patch it's now immaterial ot core gem.
Cc: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://mid.gmane.org/1444901623-18918-1-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'lib/random32.c')
0 files changed, 0 insertions, 0 deletions