dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: "Thomas Hellström (Intel)" <thomas_os@shipmail.org>,
	matthew.auld@intel.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 10/10] drm/ttm: flip the switch for driver allocated resources v2
Date: Mon, 7 Jun 2021 12:37:42 +0200	[thread overview]
Message-ID: <6c2ccd57-73bb-fcc5-a22c-0e6b5be12566@gmail.com> (raw)
In-Reply-To: <c7163102-61e7-435d-f10a-83ee1926fe1f@shipmail.org>

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@amd.com>
>> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
>> ---
>>   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.

>
> BTW shouldn't we return the struct ttm_resource ptr here rather than 
> passing it as an argument?

Yeah, good idea.

Thanks for the report,
Christian.

>
> /Thomas
>
>


  reply	other threads:[~2021-06-07 10:37 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-02 10:09 [PATCH 01/10] drm/ttm: allocate resource object instead of embedding it v2 Christian König
2021-06-02 10:09 ` [PATCH 02/10] drm/ttm: flip over the range manager to self allocated nodes Christian König
2021-06-02 11:44   ` Thomas Hellström (Intel)
2021-06-02 12:11     ` Christian König
2021-06-02 12:33       ` Thomas Hellström (Intel)
2021-06-02 13:07         ` Christian König
2021-06-02 14:13           ` Thomas Hellström (Intel)
2021-06-02 14:17             ` Christian König
2021-06-02 15:28               ` Thomas Hellström (Intel)
2021-06-02 18:41                 ` Christian König
2021-06-02 18:52                   ` Thomas Hellström (Intel)
2021-06-02 18:53                     ` Christian König
2021-06-02 10:09 ` [PATCH 03/10] drm/ttm: flip over the sys " Christian König
2021-06-03  7:51   ` Matthew Auld
2021-06-02 10:09 ` [PATCH 04/10] drm/amdgpu: revert "drm/amdgpu: stop allocating dummy GTT nodes" Christian König
2021-06-02 10:09 ` [PATCH 05/10] drm/amdkfd: use resource cursor in svm_migrate_copy_to_vram v2 Christian König
2021-06-03  9:44   ` Matthew Auld
2021-06-02 10:09 ` [PATCH 06/10] drm/amdgpu: switch the GTT backend to self alloc Christian König
2021-06-02 10:09 ` [PATCH 07/10] drm/amdgpu: switch the VRAM " Christian König
2021-06-02 10:09 ` [PATCH 08/10] drm/nouveau: switch the TTM backends " Christian König
2021-06-02 10:09 ` [PATCH 09/10] drm/vmwgfx: " Christian König
2021-06-02 10:09 ` [PATCH 10/10] drm/ttm: flip the switch for driver allocated resources v2 Christian König
2021-06-07 10:15   ` Thomas Hellström (Intel)
2021-06-07 10:37     ` Christian König [this message]
2021-06-07 10:44       ` Thomas Hellström (Intel)
2021-06-03  8:45 ` [PATCH 01/10] drm/ttm: allocate resource object instead of embedding it v2 Matthew Auld
2021-06-04 11:54   ` Christian König
2021-06-04  9:33 ` Thomas Hellström (Intel)
2021-06-07 16:40 ` Thomas Hellström (Intel)
2021-06-07 17:06   ` Thomas Hellström (Intel)
2021-06-07 17:54     ` Christian König
2021-06-07 17:58       ` Thomas Hellström (Intel)
2021-06-07 17:59         ` Christian König
2021-06-08  5:29           ` Thomas Hellström (Intel)
2021-06-08  7:14             ` Christian König
2021-06-08  7:17               ` Thomas Hellström (Intel)
2021-06-08  7:21                 ` Christian König
2021-06-08  9:38                   ` Das, Nirmoy
2021-06-08  9:40                     ` Das, Nirmoy
2021-06-08  9:42                       ` Christian König
2021-06-08  9:48                         ` Das, Nirmoy
2021-06-07 17:10   ` Christian König
2021-06-08  6:55 ` Thomas Hellström

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6c2ccd57-73bb-fcc5-a22c-0e6b5be12566@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=thomas_os@shipmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox