amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling@amd.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
	"Alex Deucher" <alexdeucher@gmail.com>
Cc: Alex Deucher <alexander.deucher@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/amdgpu: track MQD size for gfx and compute
Date: Wed, 22 Mar 2023 10:34:14 -0400	[thread overview]
Message-ID: <213443b2-5caa-5c50-128c-cc50021dd451@amd.com> (raw)
In-Reply-To: <22ef9485-11e1-1e23-34d1-f8a40698b226@gmail.com>

MQDs are smaller than a page. The BO size will always be exactly be one 
page.

KFD can allocate MQDs with a suballocator. On some GPUs we allocate MQDs 
together with the queue's control stack in a single BO. And on some GPUs 
we allocate SDMA "MQDs" in bulk together with the HIQ MQD. So relying on 
the BO size would not work for us.

Regards,
   Felix


Am 2023-03-22 um 09:58 schrieb Christian König:
> Am 22.03.23 um 14:26 schrieb Alex Deucher:
>> On Wed, Mar 22, 2023 at 4:48 AM Christian König
>> <ckoenig.leichtzumerken@gmail.com> wrote:
>>> Am 21.03.23 um 20:39 schrieb Alex Deucher:
>>>> It varies by generation and we need to know the size
>>>> to expose this via debugfs.
>>> I suspect we can't just use the BO size for this?
>> We could, but it may be larger than the actual MQD.  Maybe that's not
>> a big deal?
>
> I don't really know either. Maybe just go ahead with this approach 
> here, but I usually try to avoid stuff like that because it can be an 
> additional source of errors when the allocation size is not correct.
>
> Christian.
>
>>
>> Alex
>>
>>
>>> If yes the series is Reviewed-by: Christian König 
>>> <christian.koenig@amd.com>
>>>
>>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>>> ---
>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c  | 2 ++
>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 1 +
>>>>    2 files changed, 3 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
>>>> index c50d59855011..5435f41a3b7f 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
>>>> @@ -404,6 +404,7 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device 
>>>> *adev,
>>>>                                        return r;
>>>>                                }
>>>>
>>>> +                             ring->mqd_size = mqd_size;
>>>>                                /* prepare MQD backup */
>>>>                                adev->gfx.me.mqd_backup[i] = 
>>>> kmalloc(mqd_size, GFP_KERNEL);
>>>>                                if (!adev->gfx.me.mqd_backup[i])
>>>> @@ -424,6 +425,7 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device 
>>>> *adev,
>>>>                                return r;
>>>>                        }
>>>>
>>>> +                     ring->mqd_size = mqd_size;
>>>>                        /* prepare MQD backup */
>>>>                        adev->gfx.mec.mqd_backup[i] = 
>>>> kmalloc(mqd_size, GFP_KERNEL);
>>>>                        if (!adev->gfx.mec.mqd_backup[i])
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h 
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>>>> index 7942cb62e52c..deb9f7bead02 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
>>>> @@ -257,6 +257,7 @@ struct amdgpu_ring {
>>>>        struct amdgpu_bo        *mqd_obj;
>>>>        uint64_t                mqd_gpu_addr;
>>>>        void                    *mqd_ptr;
>>>> +     unsigned                mqd_size;
>>>>        uint64_t                eop_gpu_addr;
>>>>        u32                     doorbell_index;
>>>>        bool                    use_doorbell;
>

      reply	other threads:[~2023-03-22 14:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 19:39 [PATCH 1/2] drm/amdgpu: track MQD size for gfx and compute Alex Deucher
2023-03-21 19:39 ` [PATCH 2/2] drm/amdgpu: add debugfs interface for reading MQDs Alex Deucher
2023-03-22  8:48 ` [PATCH 1/2] drm/amdgpu: track MQD size for gfx and compute Christian König
2023-03-22 13:26   ` Alex Deucher
2023-03-22 13:58     ` Christian König
2023-03-22 14:34       ` Felix Kuehling [this message]

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=213443b2-5caa-5c50-128c-cc50021dd451@amd.com \
    --to=felix.kuehling@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=ckoenig.leichtzumerken@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).