AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Marek Olšák" <maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: amd-gfx mailing list
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH libdrm 6/6] amdgpu: always add all BOs to lockup table
Date: Fri, 10 Aug 2018 15:06:11 +0200	[thread overview]
Message-ID: <7c186502-199a-88cc-e5cf-6d3106bcc184@gmail.com> (raw)
In-Reply-To: <CAAxE2A51vBrphE3CVPVeKixKpxS3q0vqJ8NUkMfp+bM1M3qHbA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Why should it? Adding the handle is now not more than setting an array 
entry.

I've tested with allocating 250k BOs of 4k size each and there wasn't 
any measurable performance differences.

Christian.

Am 09.08.2018 um 18:56 schrieb Marek Olšák:
> I don't think this is a good idea. Can you please explain why this
> won't cause performance regressions?
>
> Thanks
> Marek
>
> On Fri, Aug 3, 2018 at 7:34 AM, Christian König
> <ckoenig.leichtzumerken@gmail.com> wrote:
>> This way we can always find a BO structure by its handle.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>>   amdgpu/amdgpu_bo.c | 14 ++++----------
>>   1 file changed, 4 insertions(+), 10 deletions(-)
>>
>> diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
>> index 02592377..422c7c99 100644
>> --- a/amdgpu/amdgpu_bo.c
>> +++ b/amdgpu/amdgpu_bo.c
>> @@ -87,6 +87,10 @@ int amdgpu_bo_alloc(amdgpu_device_handle dev,
>>
>>          bo->handle = args.out.handle;
>>
>> +       pthread_mutex_lock(&bo->dev->bo_table_mutex);
>> +       r = handle_table_insert(&bo->dev->bo_handles, bo->handle, bo);
>> +       pthread_mutex_unlock(&bo->dev->bo_table_mutex);
>> +
>>          pthread_mutex_init(&bo->cpu_access_mutex, NULL);
>>
>>          if (r)
>> @@ -171,13 +175,6 @@ int amdgpu_bo_query_info(amdgpu_bo_handle bo,
>>          return 0;
>>   }
>>
>> -static void amdgpu_add_handle_to_table(amdgpu_bo_handle bo)
>> -{
>> -       pthread_mutex_lock(&bo->dev->bo_table_mutex);
>> -       handle_table_insert(&bo->dev->bo_handles, bo->handle, bo);
>> -       pthread_mutex_unlock(&bo->dev->bo_table_mutex);
>> -}
>> -
>>   static int amdgpu_bo_export_flink(amdgpu_bo_handle bo)
>>   {
>>          struct drm_gem_flink flink;
>> @@ -240,14 +237,11 @@ int amdgpu_bo_export(amdgpu_bo_handle bo,
>>                  return 0;
>>
>>          case amdgpu_bo_handle_type_kms:
>> -               amdgpu_add_handle_to_table(bo);
>> -               /* fall through */
>>          case amdgpu_bo_handle_type_kms_noimport:
>>                  *shared_handle = bo->handle;
>>                  return 0;
>>
>>          case amdgpu_bo_handle_type_dma_buf_fd:
>> -               amdgpu_add_handle_to_table(bo);
>>                  return drmPrimeHandleToFD(bo->dev->fd, bo->handle,
>>                                            DRM_CLOEXEC | DRM_RDWR,
>>                                            (int*)shared_handle);
>> --
>> 2.14.1
>>
>> _______________________________________________
>> 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:[~2018-08-10 13:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03 11:34 [PATCH libdrm 1/6] amdgpu: stop using the hash table for fd_tab Christian König
     [not found] ` <20180803113458.28560-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-03 11:34   ` [PATCH libdrm 2/6] amdgpu: add handle table implementation v2 Christian König
     [not found]     ` <20180803113458.28560-2-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-06  8:34       ` Zhang, Jerry (Junwei)
2018-08-03 11:34   ` [PATCH libdrm 3/6] amdgpu: use handle table for KMS handles Christian König
2018-08-03 11:34   ` [PATCH libdrm 4/6] amdgpu: use handle table for flink names Christian König
2018-08-03 11:34   ` [PATCH libdrm 5/6] amdgpu: remove the hash table implementation Christian König
2018-08-03 11:34   ` [PATCH libdrm 6/6] amdgpu: always add all BOs to lockup table Christian König
     [not found]     ` <20180803113458.28560-6-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2018-08-03 13:52       ` Michel Dänzer
     [not found]         ` <98a57d99-4016-8896-1791-d5550cc2c277-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-08-03 13:54           ` Christian König
     [not found]             ` <faabbb5b-fc6a-3c7e-a051-ce4283f45241-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-03 14:30               ` Deucher, Alexander
2018-08-09 16:56       ` Marek Olšák
     [not found]         ` <CAAxE2A51vBrphE3CVPVeKixKpxS3q0vqJ8NUkMfp+bM1M3qHbA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-10 13:06           ` Christian König [this message]
     [not found]             ` <7c186502-199a-88cc-e5cf-6d3106bcc184-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-08-10 15:55               ` Marek Olšák
2018-08-06  2:25   ` [PATCH libdrm 1/6] amdgpu: stop using the hash table for fd_tab Zhang, Jerry (Junwei)

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=7c186502-199a-88cc-e5cf-6d3106bcc184@gmail.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=maraeo-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