dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Kuehling <felix.kuehling-5C7GfCeVMHo@public.gmane.org>
To: Oded Gabbay <oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: amd-gfx list
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	Jan Vesely <jan.vesely-kgbqMDwikbSVc3sceRu5cw@public.gmane.org>,
	Maling list - DRI developers
	<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 1/1] drm/amdkfd: Do not ignore requested queue size during allocation
Date: Tue, 21 Nov 2017 11:30:48 -0500	[thread overview]
Message-ID: <77963976-376a-beb5-ba2c-8b40c5a690da@amd.com> (raw)
In-Reply-To: <CAFCwf12ZeO=6F-EQ_MFgSEugxMSAFNe+OkGT_gZBMp34VzFAcA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>


On 2017-11-21 06:44 AM, Oded Gabbay wrote:
> Thanks Felix for catching that, For some reason I remembered  EOP
> buffer should be the same size of the queue.

The EOP queue size is hard-coded to prop.eop_ring_buffer_size =
PAGE_SIZE for kernel queues in initialize in kfd_kernel_queue.c. I'm not
too familiar with the HW/FW details. But I see this comment in
kfd_mqd_manager_vi.c:

        /*
         * HW does not clamp this field correctly. Maximum EOP queue size
         * is constrained by per-SE EOP done signal count, which is 8-bit.
         * Limit is 0xFF EOP entries (= 0x7F8 dwords). CP will not submit
         * more than (EOP entry count - 1) so a queue size of 0x800 dwords
         * is safe, giving a maximum field value of 0xA.
         */

With that the maximum possible EOP queue size would be two pages,
regardless of the queue size.

> Then we can remove the queue size parameter from that function ?

Not the way the code is currently organized. Currently struct
kernel_queue_ops is shared for ASIC-independent and ASIC-specific queue
ops. The ASIC-independent initialize function in kfd_kernel_queue.c
still needs this parameter.

That said, the kernel_queue stuff could be cleaned up a bit in general.
IMO the hardware-independent functions don't really need to be called
through function pointers. The ASIC-specific function pointers don't
need to be in the kernel_queue structure, they could be in kfd_dev.

Regards,
  Felix

>
> On Mon, Nov 20, 2017 at 9:22 PM, Felix Kuehling <felix.kuehling@amd.com> wrote:
>> I think this patch is not correct. The EOP-mem is not associated with
>> the queue size. The EOP buffer is a separate buffer used by the firmware
>> to handle command completion. As I understand it, this allows more
>> concurrency, while still making it look like all commands in the queue
>> are completing in order.
>>
>> Regards,
>>   Felix
>>
>>
>> On 2017-11-19 03:19 AM, Oded Gabbay wrote:
>>> On Thu, Nov 16, 2017 at 11:36 PM, Jan Vesely <jan.vesely@rutgers.edu> wrote:
>>>> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
>>>> ---
>>>>  drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_vi.c | 5 +++--
>>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_vi.c b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_vi.c
>>>> index f1d48281e322..b3bee39661ab 100644
>>>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_vi.c
>>>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue_vi.c
>>>> @@ -37,15 +37,16 @@ static bool initialize_vi(struct kernel_queue *kq, struct kfd_dev *dev,
>>>>                         enum kfd_queue_type type, unsigned int queue_size)
>>>>  {
>>>>         int retval;
>>>> +       unsigned int size = ALIGN(queue_size, PAGE_SIZE);
>>>>
>>>> -       retval = kfd_gtt_sa_allocate(dev, PAGE_SIZE, &kq->eop_mem);
>>>> +       retval = kfd_gtt_sa_allocate(dev, size, &kq->eop_mem);
>>>>         if (retval != 0)
>>>>                 return false;
>>>>
>>>>         kq->eop_gpu_addr = kq->eop_mem->gpu_addr;
>>>>         kq->eop_kernel_addr = kq->eop_mem->cpu_ptr;
>>>>
>>>> -       memset(kq->eop_kernel_addr, 0, PAGE_SIZE);
>>>> +       memset(kq->eop_kernel_addr, 0, size);
>>>>
>>>>         return true;
>>>>  }
>>>> --
>>>> 2.13.6
>>>>
>>>> _______________________________________________
>>>> amd-gfx mailing list
>>>> amd-gfx@lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>>> Thanks!
>>> Applied to -next tree
>>> Oded
>>> _______________________________________________
>>> amd-gfx mailing list
>>> amd-gfx@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-11-21 16:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16 21:36 [PATCH 1/1] drm/amdkfd: Do not ignore requested queue size during allocation Jan Vesely
     [not found] ` <20171116213631.3987-1-jan.vesely-kgbqMDwikbSVc3sceRu5cw@public.gmane.org>
2017-11-19  8:19   ` Oded Gabbay
     [not found]     ` <CAFCwf10MTrBcGn1kejNvn9AcHDsCiW85HkC6bSmYfY=1shGJxQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-20 19:22       ` Felix Kuehling
     [not found]         ` <21e77adc-4fbe-a3e9-0a02-5d84eb201561-5C7GfCeVMHo@public.gmane.org>
2017-11-21 11:44           ` Oded Gabbay
     [not found]             ` <CAFCwf12ZeO=6F-EQ_MFgSEugxMSAFNe+OkGT_gZBMp34VzFAcA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-21 16:30               ` Felix Kuehling [this message]
2017-11-29 21:43         ` Jan Vesely
     [not found]           ` <1511991803.2978.67.camel-kgbqMDwikbSVc3sceRu5cw@public.gmane.org>
2017-11-29 21:58             ` Felix Kuehling
2017-11-30 23:51               ` Jan Vesely
     [not found]                 ` <1512085889.3631.50.camel-kgbqMDwikbSVc3sceRu5cw@public.gmane.org>
2017-12-01 17:10                   ` Felix Kuehling
2017-12-01 17:15                   ` Felix Kuehling
2017-12-01 19:37                   ` Felix Kuehling

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=77963976-376a-beb5-ba2c-8b40c5a690da@amd.com \
    --to=felix.kuehling-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=jan.vesely-kgbqMDwikbSVc3sceRu5cw@public.gmane.org \
    --cc=oded.gabbay-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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