Re: [PATCH 10/10] drm/ttm: flip the switch for driver allocated resources v2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 6/7/21 12:37 PM, Christian König wrote:
Am 07.06.21 um 12:15 schrieb Thomas Hellström (Intel):

On 6/2/21 12:09 PM, Christian König wrote:
Instead of both driver and TTM allocating memory finalize embedding the
ttm_resource object as base into the driver backends.

v2: fix typo in vmwgfx grid mgr and double init in amdgpu_vram_mgr.c

Signed-off-by: Christian König <christian.koenig@xxxxxxx>
Reviewed-by: Matthew Auld <matthew.auld@xxxxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c   | 44 ++++++--------
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c    |  2 +-
  .../gpu/drm/amd/amdgpu/amdgpu_res_cursor.h    |  5 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c  | 60 +++++++++----------
  drivers/gpu/drm/drm_gem_vram_helper.c         |  3 +-
  drivers/gpu/drm/nouveau/nouveau_bo.c          |  8 +--
  drivers/gpu/drm/nouveau/nouveau_mem.c         | 11 ++--
  drivers/gpu/drm/nouveau/nouveau_mem.h         | 14 ++---
  drivers/gpu/drm/nouveau/nouveau_ttm.c         | 32 +++++-----
  drivers/gpu/drm/ttm/ttm_range_manager.c       | 23 +++----
  drivers/gpu/drm/ttm/ttm_resource.c            | 18 +-----
  drivers/gpu/drm/ttm/ttm_sys_manager.c         | 12 ++--
  drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c | 24 ++++----
  drivers/gpu/drm/vmwgfx/vmwgfx_thp.c           | 27 ++++-----
  include/drm/ttm/ttm_range_manager.h           |  3 +-
  include/drm/ttm/ttm_resource.h                | 43 ++++++-------
  16 files changed, 140 insertions(+), 189 deletions(-)
...
  diff --git a/drivers/gpu/drm/ttm/ttm_range_manager.c b/drivers/gpu/drm/ttm/ttm_range_manager.c
index ce5d07ca384c..c32e1aee2481 100644
--- a/drivers/gpu/drm/ttm/ttm_range_manager.c
+++ b/drivers/gpu/drm/ttm/ttm_range_manager.c
@@ -58,7 +58,7 @@ to_range_manager(struct ttm_resource_manager *man)
  static int ttm_range_man_alloc(struct ttm_resource_manager *man,
                     struct ttm_buffer_object *bo,
                     const struct ttm_place *place,
-                   struct ttm_resource *mem)
+                   struct ttm_resource **res)
  {
      struct ttm_range_manager *rman = to_range_manager(man);
      struct ttm_range_mgr_node *node;
@@ -83,37 +83,30 @@ static int ttm_range_man_alloc(struct ttm_resource_manager *man,
        spin_lock(&rman->lock);
      ret = drm_mm_insert_node_in_range(mm, &node->mm_nodes[0],
-                      mem->num_pages, bo->page_alignment, 0,
+                      node->base.num_pages,
+                      bo->page_alignment, 0,
                        place->fpfn, lpfn, mode);
      spin_unlock(&rman->lock);
  -    if (unlikely(ret)) {
+    if (unlikely(ret))
          kfree(node);
-    } else {
-        mem->mm_node = &node->mm_nodes[0];
-        mem->start = node->mm_nodes[0].start;
-    }
+    else
+        node->base.start = node->mm_nodes[0].start;
        return ret;
  }

Looks like this patch forgets to assign *@res. Null pointer derefs when testing i915.

I should really CC the Intel list for TTM patches as well. The CI system should have spotted that.

Unfortunately, the dg1 system is not participating in CI yet AFAICT, but moving forward I think it's a good idea.

/Thomas





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux