AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chunming Zhou <zhoucm1-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
	<ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/2] drm/amdgpu: allow GTT overcommit during bind
Date: Mon, 16 Oct 2017 17:42:31 +0800	[thread overview]
Message-ID: <eb30bfdf-e5ce-dc2d-1cdf-19f424894b74@amd.com> (raw)
In-Reply-To: <20171016092646.1625-2-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>



On 2017年10月16日 17:26, Christian König wrote:
> From: Christian König <christian.koenig@amd.com>
>
> While binding BOs to GART we need to allow a bit overcommit in the GTT
> domain.
If allowing overcommit, will the new node not over the GART mc range? 
Which is also allowed?

Regards,
David Zhou
>   Otherwise we can never use the full GART space when GART size=GTT size.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> index 0d15eb7d31d7..33535d347734 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> @@ -169,7 +169,8 @@ static int amdgpu_gtt_mgr_new(struct ttm_mem_type_manager *man,
>   	int r;
>   
>   	spin_lock(&mgr->lock);
> -	if (atomic64_read(&mgr->available) < mem->num_pages) {
> +	if ((&tbo->mem == mem || tbo->mem.mem_type != TTM_PL_TT) &&
> +	    atomic64_read(&mgr->available) < mem->num_pages) {
>   		spin_unlock(&mgr->lock);
>   		return 0;
>   	}
> @@ -244,8 +245,9 @@ static void amdgpu_gtt_mgr_del(struct ttm_mem_type_manager *man,
>   uint64_t amdgpu_gtt_mgr_usage(struct ttm_mem_type_manager *man)
>   {
>   	struct amdgpu_gtt_mgr *mgr = man->priv;
> +	s64 result = man->size - atomic64_read(&mgr->available);
>   
> -	return (u64)(man->size - atomic64_read(&mgr->available)) * PAGE_SIZE;
> +	return (result > 0 ? result : 0) * PAGE_SIZE;
>   }
>   
>   /**
> @@ -265,7 +267,7 @@ static void amdgpu_gtt_mgr_debug(struct ttm_mem_type_manager *man,
>   	drm_mm_print(&mgr->mm, printer);
>   	spin_unlock(&mgr->lock);
>   
> -	drm_printf(printer, "man size:%llu pages, gtt available:%llu pages, usage:%lluMB\n",
> +	drm_printf(printer, "man size:%llu pages, gtt available:%lld pages, usage:%lluMB\n",
>   		   man->size, (u64)atomic64_read(&mgr->available),
>   		   amdgpu_gtt_mgr_usage(man) >> 20);
>   }

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

  parent reply	other threads:[~2017-10-16  9:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16  9:26 [PATCH 1/2] drm/amdgpu: linear validate first then bind to GART Christian König
     [not found] ` <20171016092646.1625-1-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-10-16  9:26   ` [PATCH 2/2] drm/amdgpu: allow GTT overcommit during bind Christian König
     [not found]     ` <20171016092646.1625-2-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-10-16  9:42       ` Chunming Zhou [this message]
     [not found]         ` <eb30bfdf-e5ce-dc2d-1cdf-19f424894b74-5C7GfCeVMHo@public.gmane.org>
2017-10-16 11:40           ` Christian König
     [not found]             ` <8a8ade87-e51c-3aab-b5c0-207dbee60ef9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-17  4:11               ` Chunming Zhou
     [not found]                 ` <88d7a8da-821d-396a-1fb9-84454478b7c4-5C7GfCeVMHo@public.gmane.org>
2017-10-17  7:46                   ` Christian König
     [not found]                     ` <d23f395f-df2e-8cba-c973-253111e92f61-5C7GfCeVMHo@public.gmane.org>
2017-10-17  8:15                       ` Chunming Zhou
     [not found]                         ` <621ab89b-83a7-1947-ecec-e371433bcaa6-5C7GfCeVMHo@public.gmane.org>
2017-10-17  8:27                           ` Christian König
     [not found]                             ` <d5ea66a0-134c-ac18-5056-ecf62d7b6dab-5C7GfCeVMHo@public.gmane.org>
2017-10-17  8:34                               ` Zhu, Rex
2017-10-17  8:34                               ` Chunming Zhou
     [not found]                                 ` <ce043b07-a962-c62e-451c-74b02c577fce-5C7GfCeVMHo@public.gmane.org>
2017-10-17  8:37                                   ` Chunming Zhou
2017-10-16 17:44   ` [PATCH 1/2] drm/amdgpu: linear validate first then bind to GART Deucher, Alexander

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=eb30bfdf-e5ce-dc2d-1cdf-19f424894b74@amd.com \
    --to=zhoucm1-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=ckoenig.leichtzumerken-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