[Intel-gfx] [PATCH 00/18] dev->struct_mutex crusade

Daniel Vetter daniel.vetter at ffwll.ch
Thu Jul 9 14:32:32 PDT 2015


Hi all,

I wanted to take another look at struct_mutex usage in modern (gem) drivers and
noticed that for a fair lot we're very to be completely struct_mutex free.

This pile here is the the simple part, which mostly just removes code and
mutex_lock/unlock calls. All the patches here are independent and can be merged
in any order whatsoever. My plan is to send out a pull request for all those not
picked up by driver maintainers in 2-3 weeks or so, assuming no one complains.

Of course review & comments still very much welcome.

The more tricky 2nd part of this (and that one's not yet done) is to rework the
gem mmap handler to use the same kref_get_unless_zero trick as ttm. With that
there's no core requirement to hold struct_mutex over the final unref, which
means we can make that one lockless. I plan to add a gem_object_free_unlocked
for all the drivers which don't have any need for this lock.

Also there's a few more drivers which can be made struct_mutex free easily, I'll
propably stitch together poc patches for those.

Cheers, Daniel

Daniel Vetter (18):
  drm/gem: rip out drm vma accounting for gem mmaps
  drm/cma-helper: Fix locking in drm_fb_cma_debugfs_show
  drm/gem: Be more friendly with locking checks
  drm/ast: Don't grab dev->struct_mutex for in mmap offset ioctl
  drm/bochs: Don't grab dev->struct_mutex for in mmap offset ioctl
  drm/mga200g: Don't grab dev->struct_mutex for in mmap offset ioctl
  drm/mga200g: Hold a proper reference for cursor_set
  drm/cirrus: Don't grab dev->struct_mutex for in mmap offset ioctl
  drm/cma-helper: Don't grab dev->struct_mutex for in mmap offset ioctl
  drm/rockchip: Don't grab dev->struct_mutex for in mmap offset ioctl
  drm/armada: Don't grab dev->struct_mutex for in mmap offset ioctl
  drm/nouveau: Don't take dev->struct_mutex in fbcon init
  drm/nouveau: Don't take dev->struct_mutex in ttm_fini
  drm/qxl: Don't take dev->struct_mutex in bo_force_delete
  drm/radeon: Don't take dev->struct_mutex in bo_force_delete
  drm/radeon: Don't take dev->struct_mutex in pm functions
  drm/amdgpu: Don't take dev->struct_mutex in bo_force_delete
  drm/amdgpu: don't grab dev->struct_mutex in pm functions

 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c  |  4 +---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c      |  2 --
 drivers/gpu/drm/armada/armada_gem.c         | 11 ++++-------
 drivers/gpu/drm/ast/ast_main.c              | 16 +++++-----------
 drivers/gpu/drm/bochs/bochs_mm.c            | 16 ++++------------
 drivers/gpu/drm/cirrus/cirrus_main.c        | 15 ++++-----------
 drivers/gpu/drm/drm_fb_cma_helper.c         | 16 ++--------------
 drivers/gpu/drm/drm_gem.c                   | 13 ++-----------
 drivers/gpu/drm/drm_gem_cma_helper.c        |  9 +--------
 drivers/gpu/drm/mgag200/mgag200_cursor.c    | 22 ++++++++++------------
 drivers/gpu/drm/mgag200/mgag200_main.c      | 16 ++++------------
 drivers/gpu/drm/nouveau/nouveau_fbcon.c     | 11 +++--------
 drivers/gpu/drm/nouveau/nouveau_ttm.c       |  2 --
 drivers/gpu/drm/qxl/qxl_object.c            |  4 +---
 drivers/gpu/drm/radeon/radeon_object.c      |  4 +---
 drivers/gpu/drm/radeon/radeon_pm.c          |  5 -----
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 13 ++++---------
 17 files changed, 46 insertions(+), 133 deletions(-)

-- 
2.1.4



More information about the Intel-gfx mailing list