From: zhoucm1 <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: "Christian König"
<deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>,
"Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 1/3] drm/amdgpu: fix gtt mgr available statistics
Date: Wed, 19 Apr 2017 17:15:29 +0800 [thread overview]
Message-ID: <58F72AB1.7000008@amd.com> (raw)
In-Reply-To: <55d01312-8b28-98d1-fef1-3f74d7ade20c-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
On 2017年04月19日 14:59, Christian König wrote:
> Am 19.04.2017 um 08:52 schrieb zhoucm1:
>>
>>
>> On 2017年04月19日 14:38, Christian König wrote:
>>> Am 19.04.2017 um 05:50 schrieb Chunming Zhou:
>>>> gtt_mgr_alloc is called by many places in local driver, while
>>>> gtt_mgr_new is called by get_node in ttm.
>>>
>>> NAK, that can lead to over allocating the address space and we can't
>>> handle that during suspend/resume.
>> I didn't get your mean here.
>>
>> Describe it first from my side, I found this issue on APU like
>> carrizo, vram is little, so gtt is used much more, we always found
>> the gtt cannot be used end up and results in Game failed to allocate
>> memory, but from dumping mm hole table, there are many free hole and
>> memory.
>
> In this case you need to increase the gartsize parameter to the kernel
> module. What is the default size chosen for this? Maybe we need to
> adjust that default.
>
>> The root cause is mgr->available statistic is incorrect, which
>> doesn't match dump mm table.
>
> That's actually correct.
There will be a problem here, memory not mapped in mm table won't be
able to evict by TTM. The root cause is here, we need to find a solution
for it.
And yes, I agree your other opinions.
Regards,
David Zhou
> We don't map all BOs in the GART domain into the actual GART table to
> avoid all the table operations.
>
>> I think mgr->available should only be changed when insert/free node.
>
> No, on suspend/resume we need to be able to add all BOs into the GART
> table. So with your change suspend/resume can potentially fail.
>
> Regards,
> Christian.
>
>>
>>
>> Regards,
>> David Zhou
>>>
>>> Regards,
>>> Christian.
>>>
>>>>
>>>> Change-Id: Ia5a18a3b531a01ad7d47f40e08f778e7b94c048a
>>>> Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
>>>> ---
>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 11 +++++------
>>>> 1 file changed, 5 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
>>>> index 69ab2ee..8a950a5 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
>>>> @@ -124,6 +124,8 @@ int amdgpu_gtt_mgr_alloc(struct
>>>> ttm_mem_type_manager *man,
>>>> r = drm_mm_insert_node_in_range_generic(&mgr->mm, node,
>>>> mem->num_pages,
>>>> mem->page_alignment, 0,
>>>> fpfn, lpfn, sflags, aflags);
>>>> + if (!r)
>>>> + mgr->available -= mem->num_pages;
>>>> spin_unlock(&mgr->lock);
>>>> if (!r) {
>>>> @@ -160,7 +162,6 @@ static int amdgpu_gtt_mgr_new(struct
>>>> ttm_mem_type_manager *man,
>>>> spin_unlock(&mgr->lock);
>>>> return 0;
>>>> }
>>>> - mgr->available -= mem->num_pages;
>>>> spin_unlock(&mgr->lock);
>>>> node = kzalloc(sizeof(*node), GFP_KERNEL);
>>>> @@ -187,9 +188,6 @@ static int amdgpu_gtt_mgr_new(struct
>>>> ttm_mem_type_manager *man,
>>>> return 0;
>>>> err_out:
>>>> - spin_lock(&mgr->lock);
>>>> - mgr->available += mem->num_pages;
>>>> - spin_unlock(&mgr->lock);
>>>> return r;
>>>> }
>>>> @@ -214,9 +212,10 @@ static void amdgpu_gtt_mgr_del(struct
>>>> ttm_mem_type_manager *man,
>>>> return;
>>>> spin_lock(&mgr->lock);
>>>> - if (node->start != AMDGPU_BO_INVALID_OFFSET)
>>>> + if (node->start != AMDGPU_BO_INVALID_OFFSET) {
>>>> drm_mm_remove_node(node);
>>>> - mgr->available += mem->num_pages;
>>>> + mgr->available += mem->num_pages;
>>>> + }
>>>> spin_unlock(&mgr->lock);
>>>> kfree(node);
>>>
>>>
>>
>> _______________________________________________
>> 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
next prev parent reply other threads:[~2017-04-19 9:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-19 3:50 [PATCH 1/3] drm/amdgpu: fix gtt mgr available statistics Chunming Zhou
[not found] ` <1492573810-21127-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-04-19 3:50 ` [PATCH 2/3] drm/amdgpu: add gtt print like vram when dump mm table Chunming Zhou
[not found] ` <1492573810-21127-2-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-04-19 6:41 ` Christian König
2017-04-19 3:50 ` [PATCH 3/3] drm/amdgpu: move gtt usage statistic to gtt mgr Chunming Zhou
[not found] ` <1492573810-21127-3-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2017-04-19 5:54 ` Zhang, Jerry (Junwei)
2017-04-19 6:45 ` Christian König
2017-04-19 6:38 ` [PATCH 1/3] drm/amdgpu: fix gtt mgr available statistics Christian König
[not found] ` <cb40837d-7734-35cb-7983-80c9c2a3943a-5C7GfCeVMHo@public.gmane.org>
2017-04-19 6:52 ` zhoucm1
[not found] ` <58F70923.5060705-5C7GfCeVMHo@public.gmane.org>
2017-04-19 6:59 ` Christian König
[not found] ` <55d01312-8b28-98d1-fef1-3f74d7ade20c-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-04-19 9:15 ` zhoucm1 [this message]
[not found] ` <58F72AB1.7000008-5C7GfCeVMHo@public.gmane.org>
2017-04-19 9:40 ` Christian König
[not found] ` <14328cdc-598d-7b0d-01cb-1a2d3f46a772-5C7GfCeVMHo@public.gmane.org>
2017-04-20 3:10 ` zhoucm1
[not found] ` <58F8268E.2040104-5C7GfCeVMHo@public.gmane.org>
2017-04-20 8:54 ` Christian König
-- strict thread matches above, loose matches on Subject: below --
2017-04-13 9:02 Chunming Zhou
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=58F72AB1.7000008@amd.com \
--to=david1.zhou-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
--cc=deathsimple-ANTagKRnAhcb1SvskN2V4Q@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