• Daniel Vetter's avatar
    drm/gem: support BO freeing without dev->struct_mutex · 9f0ba539
    Daniel Vetter authored
    Finally all the core gem and a lot of drivers are entirely free of
    dev->struct_mutex depencies, and we can start to have an entirely
    lockless unref path.
    
    To make sure that no one who touches the core code accidentally breaks
    existing drivers which still require dev->struct_mutex I've made the
    might_lock check unconditional.
    
    While at it de-inline the ref/unref functions, they've become a bit
    too big.
    
    v2: Make it not leak like a sieve.
    
    v3: Review from Lucas:
    - drop != NULL in pointer checks.
    - fixup copypasted kerneldoc to actually match the functions.
    
    v4:
    Add __drm_gem_object_unreference as a fastpath helper for drivers who
    abolished dev->struct_mutex, requested by Chris.
    
    v5: Fix silly mistake in drm_gem_object_unreference_unlocked caught by
    intel-gfx CI - I checked for gem_free_object instead of
    gem_free_object_unlocked ...
    
    Cc: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Alex Deucher <alexdeucher@gmail.com>
    Cc: Lucas Stach <l.stach@pengutronix.de>
    Reviewed-by: Lucas Stach <l.stach@pengutronix.de> (v3)
    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v4)
    Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    Link: http://patchwork.freedesktop.org/patch/msgid/1462178451-1765-1-git-send-email-daniel.vetter@ffwll.ch
    9f0ba539
drm_gem.c 29 KB