1. 25 7月, 2013 2 次提交
    • D
      drm/vma: provide drm_vma_node_unmap() helper · 51335df9
      David Herrmann 提交于
      Instead of unmapping the nodes in TTM and GEM users manually, we provide
      a generic wrapper which does the correct thing for all vma-nodes.
      
      v2: remove bdev->dev_mapping test in ttm_bo_unmap_virtual_unlocked() as
      ttm_mem_io_free_vm() does nothing in that case (io_reserved_vm is 0).
      v4: Fix docbook comments
      v5: use drm_vma_node_size()
      
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
      Cc: Thomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@gmail.com>
      51335df9
    • D
      drm/ttm: convert to unified vma offset manager · 72525b3f
      David Herrmann 提交于
      Use the new vma-manager infrastructure. This doesn't change any
      implementation details as the vma-offset-manager is nearly copied 1-to-1
      from TTM.
      
      The vm_lock is moved into the offset manager so we can drop it from TTM.
      During lookup, we use the vma locking helpers to take a reference to the
      found object.
      In all other scenarios, locking stays the same as before. We always
      guarantee that drm_vma_offset_remove() is called only during destruction.
      Hence, helpers like drm_vma_node_offset_addr() are always safe as long as
      the node has a valid offset.
      
      This also drops the addr_space_offset member as it is a copy of vm_start
      in vma_node objects. Use the accessor functions instead.
      
      v4:
       - remove vm_lock
       - use drm_vma_offset_lock_lookup() to protect lookup (instead of vm_lock)
      
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
      Cc: Martin Peres <martin.peres@labri.fr>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Thomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@gmail.com>
      72525b3f
  2. 02 7月, 2013 1 次提交
  3. 28 6月, 2013 4 次提交
  4. 21 1月, 2013 1 次提交
  5. 15 1月, 2013 3 次提交
  6. 20 12月, 2012 1 次提交
    • M
      drm/ttm: fix delayed ttm_bo_cleanup_refs_and_unlock delayed handling · 0953e76e
      Maarten Lankhorst 提交于
      Fix regression introduced by 85b144f8
      "drm/ttm: call ttm_bo_cleanup_refs with reservation and lru lock held, v3"
      
      Slowpath ttm_bo_cleanup_refs_and_unlock accidentally tried to increase
      refcount on &bo->sync_obj instead of bo->sync_obj.
      
      The compiler didn't complain since sync_obj_ref takes a void pointer,
      so it was still valid c.
      
      This could result in lockups, memory corruptions, and warnings like
      these when graphics card VRAM usage is high:
      
      ------------[ cut here ]------------
      WARNING: at include/linux/kref.h:42 radeon_fence_ref+0x2c/0x40()
      Hardware name: System Product Name
      Pid: 157, comm: X Not tainted 3.7.0-rc7-00520-g85b144f8-dirty #174
      Call Trace:
      [<ffffffff81058c84>] ? warn_slowpath_common+0x74/0xb0
      [<ffffffff8129273c>] ? radeon_fence_ref+0x2c/0x40
      [<ffffffff8125e95c>] ? ttm_bo_cleanup_refs_and_unlock+0x18c/0x2d0
      [<ffffffff8125f17c>] ? ttm_mem_evict_first+0x1dc/0x2a0
      [<ffffffff81264452>] ? ttm_bo_man_get_node+0x62/0xb0
      [<ffffffff8125f4ce>] ? ttm_bo_mem_space+0x28e/0x340
      [<ffffffff8125fb0c>] ? ttm_bo_move_buffer+0xfc/0x170
      [<ffffffff810de172>] ? kmem_cache_alloc+0xb2/0xc0
      [<ffffffff8125fc15>] ? ttm_bo_validate+0x95/0x110
      [<ffffffff8125ff7c>] ? ttm_bo_init+0x2ec/0x3b0
      [<ffffffff8129419a>] ? radeon_bo_create+0x18a/0x200
      [<ffffffff81293e80>] ? radeon_bo_clear_va+0x40/0x40
      [<ffffffff812a5342>] ? radeon_gem_object_create+0x92/0x160
      [<ffffffff812a575c>] ? radeon_gem_create_ioctl+0x6c/0x150
      [<ffffffff812a529f>] ? radeon_gem_object_free+0x2f/0x40
      [<ffffffff81246b60>] ? drm_ioctl+0x420/0x4f0
      [<ffffffff812a56f0>] ? radeon_gem_pwrite_ioctl+0x20/0x20
      [<ffffffff810f53a4>] ? do_vfs_ioctl+0x2e4/0x4e0
      [<ffffffff810e5588>] ? vfs_read+0x118/0x160
      [<ffffffff810f55ec>] ? sys_ioctl+0x4c/0xa0
      [<ffffffff810e5851>] ? sys_read+0x51/0xa0
      [<ffffffff814b0612>] ? system_call_fastpath+0x16/0x1b
      Signed-off-by: NMaarten Lankhorst <maarten.lankhorst@canonical.com>
      Reported-by: NMarkus Trippelsdorf <markus@trippelsdorf.de>
      Acked-by: NPaul Menzel <paulepanter@users.sourceforge.net>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      0953e76e
  7. 10 12月, 2012 5 次提交
  8. 28 11月, 2012 1 次提交
  9. 20 11月, 2012 6 次提交
  10. 07 11月, 2012 1 次提交
  11. 23 10月, 2012 2 次提交
    • T
      drm/ttm: Fix a theoretical race in ttm_bo_cleanup_refs() · b8e902f2
      Thomas Hellstrom 提交于
      In theory, that function could release the lru lock between
      checking for bo on ddestroy list and a successful reserve if the bo
      was already reserved, and the function was called with waiting reserves
      allowed.
      However, all current reservers of a bo on the ddestroy list would
      atomically take the bo off the list after a successful reserve so this
      race should not have been hit, so no need to backport for stable.
      
      This patch also fixes a case found by Maarten Lankhorst where
      ttm_mem_evict_first called with no_wait_gpu would incorrectly
      spin waiting for bo idle if trying to evict a busy buffer that
      also sits on the ddestroy list.
      Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      b8e902f2
    • T
      drm/ttm: Fix a theoretical race · 7bc17a78
      Thomas Hellstrom 提交于
      The ttm_mem_evict_first function could theoretically drop the
      lru lock without retrying if a reservation from off the LRU list
      ended up waiting.
      However, since currently there are no users that could cause a wait
      in that situation so this is not suitable for stable
      Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      7bc17a78
  12. 03 10月, 2012 1 次提交
  13. 12 6月, 2012 1 次提交
    • T
      drm/ttm: Fix buffer object metadata accounting regression v2 · a393c730
      Thomas Hellstrom 提交于
      A regression was introduced in the 3.3 rc series, commit
      "drm/ttm: simplify memory accounting for ttm user v2",
      causing the metadata of buffer objects created using the ttm_bo_create()
      function to be accounted twice.
      That causes massive leaks with the vmwgfx driver running for example
      SpecViewperf Catia-03 test 2, eventually killing the app.
      
      Furthermore, the same commit introduces a regression where
      metadata accounting is leaked if a buffer object is
      initialized with an illegal size. This is also fixed with this commit.
      
      v2: Fixed an error path and removed an unused variable.
      Signed-off-by: NThomas Hellstrom <thellstrom@vmware.com>
      Reviewed-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      a393c730
  14. 02 6月, 2012 1 次提交
  15. 23 5月, 2012 1 次提交
  16. 20 3月, 2012 1 次提交
  17. 26 1月, 2012 1 次提交
    • B
      drm/ttm: fix two regressions since move_notify changes · 9f1feed2
      Ben Skeggs 提交于
      Both changes in dc97b340 cause serious
      regressions in the nouveau driver.
      
      move_notify() was originally able to presume that bo->mem is the old node,
      and new_mem is the new node.  The above commit moves the call to
      move_notify() to after move() has been done, which means that now, sometimes,
      new_mem isn't the new node at all, bo->mem is, and new_mem points at a
      stale, possibly-just-been-killed-by-move node.
      
      This is clearly not a good situation.  This patch reverts this change, and
      replaces it with a cleanup in the move() failure path instead.
      
      The second issue is that the call to move_notify() from cleanup_memtype_use()
      causes the TTM ghost objects to get passed into the driver.  This is clearly
      bad as the driver knows nothing about these "fake" TTM BOs, and ends up
      accessing uninitialised memory.
      
      I worked around this in nouveau's move_notify() hook by ensuring the BO
      destructor was nouveau's.  I don't particularly like this solution, and
      would rather TTM never pass the driver these objects.  However, I don't
      clearly understand the reason why we're calling move_notify() here anyway
      and am happy to work around the problem in nouveau instead of breaking the
      behaviour expected by other drivers.
      Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
      Reviewed-by: NThomas Hellstrom <thellstrom@vmware.com>
      Cc: Jerome Glisse <j.glisse@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      9f1feed2
  18. 06 12月, 2011 4 次提交
  19. 23 11月, 2011 1 次提交
  20. 28 10月, 2011 1 次提交
  21. 05 10月, 2011 1 次提交