All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Felix Kuehling <felix.kuehling-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] drm/amd/amdgpu: not allow gtt size exceed system memory size
Date: Tue, 14 Nov 2017 09:58:05 +0100	[thread overview]
Message-ID: <a5ddf0b2-ee3e-3684-1c94-cdf0126f12ea@gmail.com> (raw)
In-Reply-To: <d0cbf4ad-1ba3-9348-bdd4-8cee543603e2-5C7GfCeVMHo@public.gmane.org>

Am 13.11.2017 um 23:34 schrieb Felix Kuehling:
> On 2017-11-10 07:02 AM, Christian König wrote:
>> Am 10.11.2017 um 12:33 schrieb Roger He:
>>> since sometimes VRAM size is bigger than system memory
>>>
>>> Change-Id: I5b14d18ed7a9f79810cc50c023ac9e240bddf101
>>> Signed-off-by: Roger He <Hongbo.He@amd.com>
>>> ---
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 11 ++++++++---
>>>    1 file changed, 8 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> index cdbdf67..f103ccc 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>>> @@ -1330,9 +1330,14 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
>>>        DRM_INFO("amdgpu: %uM of VRAM memory ready\n",
>>>             (unsigned) (adev->mc.real_vram_size / (1024 * 1024)));
>>>    -    if (amdgpu_gtt_size == -1)
>>> -        gtt_size = max((AMDGPU_DEFAULT_GTT_SIZE_MB << 20),
>>> -                   adev->mc.mc_vram_size);
>>> +    if (amdgpu_gtt_size == -1) {
>>> +        struct sysinfo si;
>>> +
>>> +        si_meminfo(&si);
>>> +        gtt_size = min(max((AMDGPU_DEFAULT_GTT_SIZE_MB << 20),
>>> +                   adev->mc.mc_vram_size),
>>> +                   ((uint64_t)si.totalram * si.mem_unit));
>> TTM starts to try to swap things out when more than 50% of system
>> memory are used, 75% is the default hard limit where it starts to
>> block new allocations.
>>
>> So I would go with 75% here as well and code this as:
> I believe those limits can be tweaked in
> /sys/devices/virtual/drm/ttm/memory_accounting. Therefore I'd be against
> hard-coding strict limits in the driver.

Well, it's not a strict limit. You can still overwrite it with a module 
parameter.

Regards,
Christian.

>
> Regards,
>    Felix
>
>> gtt_size = AMDGPU_DEFAULT_GTT_SIZE_MB << 20;
>> gtt_size = max(gtt_size, adev->mc.mc_vram_size);
>> gtt_size = min(gtt_size, ((uint64_t)si.totalram * si.mem_unit) * 75 /
>> 100);
>>
>>
>> Regards,
>> Christian.
>>
>>> +
>>
>>> +    }
>>>        else
>>>            gtt_size = (uint64_t)amdgpu_gtt_size << 20;
>>>        r = ttm_bo_init_mm(&adev->mman.bdev, TTM_PL_TT, gtt_size >>
>>> PAGE_SHIFT);
>>
>> _______________________________________________
>> 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


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

      parent reply	other threads:[~2017-11-14  8:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 11:33 [PATCH] drm/amd/amdgpu: not allow gtt size exceed system memory size Roger He
     [not found] ` <1510313635-16473-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
2017-11-10 12:02   ` Christian König
     [not found]     ` <f83b76d4-1538-8648-4910-9953395af5be-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-11-10 12:23       ` He, Roger
     [not found]         ` <MWHPR1201MB01271934D0A23FFFAF7A20E0FD540-3iK1xFAIwjq9imrIu4W8xGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-11-10 12:28           ` Christian König
2017-11-13 22:34       ` Felix Kuehling
     [not found]         ` <d0cbf4ad-1ba3-9348-bdd4-8cee543603e2-5C7GfCeVMHo@public.gmane.org>
2017-11-14  8:58           ` Christian König [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=a5ddf0b2-ee3e-3684-1c94-cdf0126f12ea@gmail.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=felix.kuehling-5C7GfCeVMHo@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.