[Intel-gfx] [PATCH 5/6] drm/i915/ttm: switch over to ttm_buddy_man

Matthew Auld matthew.auld at intel.com
Tue Jun 8 08:13:46 UTC 2021


On 08/06/2021 08:39, Thomas Hellström wrote:
> On Mon, 2021-06-07 at 19:22 +0100, Matthew Auld wrote:
>> Move back to the buddy allocator for managing device local memory,
>> and
>> restore the lost mock selftests. Keep around the range manager
>> related
>> bits, since we likely need this for managing stolen at some point.
>> For
>> stolen we also don't need to reserve anything so no need to support a
>> generic reserve interface.
>>
>> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
>> Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>
>> ---
>>   drivers/gpu/drm/i915/gem/i915_gem_ttm.c       |  26 +--
>>   drivers/gpu/drm/i915/intel_memory_region.c    |  55 +-----
>>   drivers/gpu/drm/i915/intel_memory_region.h    |  17 --
>>   drivers/gpu/drm/i915/intel_region_ttm.c       | 100 +++--------
>>   .../drm/i915/selftests/intel_memory_region.c  | 170 ++++++++++++----
>> --
>>
> 
> ...
> 
>>   
>>   static int i915_ttm_move(struct ttm_buffer_object *bo, bool evict,
>> @@ -661,20 +661,8 @@ int __i915_gem_ttm_object_init(struct
>> intel_memory_region *mem,
>>          static struct lock_class_key lock_class;
>>          struct drm_i915_private *i915 = mem->i915;
>>          enum ttm_bo_type bo_type;
>> -       size_t alignment = 0;
>>          int ret;
>>   
>> -       /* Adjust alignment to GPU- and CPU huge page sizes. */
>> -
>> -       if (mem->is_range_manager) {
>> -               if (size >= SZ_1G)
>> -                       alignment = SZ_1G >> PAGE_SHIFT;
>> -               else if (size >= SZ_2M)
>> -                       alignment = SZ_2M >> PAGE_SHIFT;
>> -               else if (size >= SZ_64K)
>> -                       alignment = SZ_64K >> PAGE_SHIFT;
>> -       }
>> -
>>          drm_gem_private_object_init(&i915->drm, &obj->base, size);
>>          i915_gem_object_init(obj, &i915_gem_ttm_obj_ops, &lock_class,
>> flags);
>>          i915_gem_object_init_memory_region(obj, mem);
>> @@ -696,7 +684,7 @@ int __i915_gem_ttm_object_init(struct
>> intel_memory_region *mem,
>>           */
>>          obj->base.vma_node.driver_private = i915_gem_to_ttm(obj);
>>          ret = ttm_bo_init(&i915->bdev, i915_gem_to_ttm(obj), size,
>> -                         bo_type, &i915_sys_placement, alignment,
>> +                         bo_type, &i915_sys_placement, PAGE_SIZE,
> 
> Actually just realized that the alignment is specified in PAGE_SIZE
> units, so above should be s/PAGE_SIZE/1/. Might need to check that the
> buddy TTM interface gets this right as well.

Oops, and yes it looks like the buddy is also confused here.

> 
> 


More information about the Intel-gfx mailing list