Re: 答复: 答复: 答复: 答复: [PATCH] drm/amdgpu: adjust gtt memory size
Christian König
deathsimple at vodafone.de
Fri Jul 22 13:02:56 UTC 2016
Yeah sounds good to me.
Could we make a global ttm function returning how much system memory can
be used at the same time?
This way we could make those values depend on each other, e.g. when
somebody modifies the TTM value we automatically change the GART size as
well.
Regards,
Christian.
Am 22.07.2016 um 08:06 schrieb Wang, Ken:
>
> thanks Felix,
>
> I see that logci in TTM as well, so choose 1/2 of system memory as
> up limit seems good enough here? if no object I will fix the overflow
> issue and send the review again.
>
> ------------------------------------------------------------------------
> *发件人:* amd-gfx <amd-gfx-bounces at lists.freedesktop.org> 代表 Felix
> Kuehling <felix.kuehling at amd.com>
> *发送时间:* 2016年7月22日 3:19:38
> *收件人:* amd-gfx at lists.freedesktop.org
> *主题:* Re: 答复: 答复: 答复: [PATCH] drm/amdgpu: adjust gtt memory size
>
> TTM limits system memory allocations to 1/2 system memory for regular
> processes, or 3/4 for privileged processes.
>
>
> For compute we opted to make the GART bigger than system memory to
> allow for fragmentation. However, we argued that you don't really need
> GART for most buffers anyways, since they are never accessed in VMID
> 0. They need to be mapped in some VM page table, but never in the GART
> table. So I think the long-term goal should be to remove the need to
> allocate GART addresses for system memory BOs. Then you could get away
> with a quite small GART size.
>
>
> Regards,
>
> Felix
>
>
> On 16-07-21 08:04 AM, Christian König wrote:
>>>
>>> we can add people in if necessary here. so the initial though of
>>> this change is with latest big memory GPU released, the remote
>>> memory goes very large, like Polaris10.
>>>
>>> According to the windows WDDM, remote memory size is half of the
>>> system memory, I don't know what was discussed before, Please let me
>>> know if there're use case indeed need that big of remote memory.
>>>
>> Well that is at least something that makes sense.
>>
>> Previous discussions where always settled around making GART bigger
>> than VRAM and not the other way around.
>>
>> Anyway I think a prerequisite to this is actually allowing half of
>> system memory to be allocated for GART and I'm not sure if that is
>> currently the case. TTM has a limitation for that as well, but I off
>> hand don't remember how high much it was.
>>
>> I think we should use the same value which TTM uses for the upper
>> limit here.
>>
>> Regards,
>> Christian.
>>
>> Am 21.07.2016 um 13:56 schrieb Wang, Qingqing:
>>>
>>> alright, I didn't realize you're not in that thread.
>>>
>>> we can add people in if necessary here. so the initial though of
>>> this change is with latest big memory GPU released, the remote
>>> memory goes very large, like Polaris10.
>>>
>>> According to the windows WDDM, remote memory size is half of the
>>> system memory, I don't know what was discussed before, Please let me
>>> know if there're use case indeed need that big of remote memory.
>>>
>>> ------------------------------------------------------------------------
>>> *发件人:* Christian König <deathsimple at vodafone.de>
>>> *发送时间:* 2016年7月21日 19:48:17
>>> *收件人:* Wang, Qingqing; amd-gfx at lists.freedesktop.org
>>> *主题:* Re: 答复: 答复: [PATCH] drm/amdgpu: adjust gtt memory size
>>> Am 21.07.2016 um 13:15 schrieb Wang, Qingqing:
>>>>
>>>> Actually that discussion was held long ago internally but we never
>>>> got a conclusion on this IIRC. So we should probably continue the
>>>> discussion on this thread now.
>>>>
>>>> -there is a thread for this topic yesterday, some people are not in
>>>> amd-gfx mail list, we'd better discuss in the internal thread.
>>>>
>>> No, exactly for this reason we have the public mailing list. I for
>>> example wasn't part of the internal thread either.
>>>
>>> Christian.
>>>
>>>> ------------------------------------------------------------------------
>>>> *发件人:* Christian König <deathsimple at vodafone.de>
>>>> *发送时间:* 2016年7月21日 17:48:41
>>>> *收件人:* Wang, Qingqing; amd-gfx at lists.freedesktop.org
>>>> *主题:* Re: 答复: [PATCH] drm/amdgpu: adjust gtt memory size
>>>> Am 21.07.2016 um 11:16 schrieb Wang, Qingqing:
>>>>>
>>>>> This doesn't work on 32bit systems since totalram is a long (IIRC)
>>>>> and
>>>>> so this will certainly overflow.
>>>>>
>>>>> -- can you be more specific, how could the overflow happen?
>>>>>
>>>>
>>>> Both values are 32bit on a 32bit system, so as soon as you have
>>>> more than 4GB installed this will overflow.
>>>>
>>>> You need to cast the long to a 64bit value to avoid that.
>>>>
>>>>>
>>>>> Additional if I remember correctly we didn't ended the discussion on
>>>>> what to do here with a conclusion.
>>>>>
>>>>> -- ok, since it happens in anther mail list, we should stop
>>>>> talking about it here, you can send out your ideas there.
>>>>>
>>>>
>>>> Actually that discussion was held long ago internally but we never
>>>> got a conclusion on this IIRC. So we should probably continue the
>>>> discussion on this thread now.
>>>>
>>>> Regards,
>>>> Christian.
>>>>
>>>>> ------------------------------------------------------------------------
>>>>> *发件人:* amd-gfx <amd-gfx-bounces at lists.freedesktop.org> 代表
>>>>> Christian König <deathsimple at vodafone.de>
>>>>> *发送时间:* 2016年7月21日 16:53:05
>>>>> *收件人:* Wang, Qingqing; amd-gfx at lists.freedesktop.org
>>>>> *主题:* Re: [PATCH] drm/amdgpu: adjust gtt memory size
>>>>> Am 21.07.2016 um 09:46 schrieb Ken Wang:
>>>>> > Change-Id: If00d5b97ba9e30f9b7f68fdfc134a0f8b3ad2add
>>>>> > Signed-off-by: Ken Wang <Qingqing.Wang at amd.com>
>>>>> > ---
>>>>> > drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 7 ++++++-
>>>>> > drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 7 ++++++-
>>>>> > 2 files changed, 12 insertions(+), 2 deletions(-)
>>>>> >
>>>>> > diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>>>>> b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>>>>> > index a3b6048..0b095d5 100644
>>>>> > --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>>>>> > +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
>>>>> > @@ -336,6 +336,11 @@ static int gmc_v7_0_mc_init(struct
>>>>> amdgpu_device *adev)
>>>>> > {
>>>>> > u32 tmp;
>>>>> > int chansize, numchan;
>>>>> > + u64 sysmem_size;
>>>>> > + struct sysinfo si;
>>>>> > +
>>>>> > + si_meminfo(&si);
>>>>> > + sysmem_size = si.totalram * si.mem_unit;
>>>>>
>>>>> This doesn't work on 32bit systems since totalram is a long (IIRC)
>>>>> and
>>>>> so this will certainly overflow.
>>>>>
>>>>> Additional if I remember correctly we didn't ended the discussion on
>>>>> what to do here with a conclusion.
>>>>>
>>>>> Regards,
>>>>> Christian.
>>>>>
>>>>> >
>>>>> > /* Get VRAM informations */
>>>>> > tmp = RREG32(mmMC_ARB_RAMCFG);
>>>>> > @@ -392,7 +397,7 @@ static int gmc_v7_0_mc_init(struct
>>>>> amdgpu_device *adev)
>>>>> > * size equal to the 1024 or vram, whichever is larger.
>>>>> > */
>>>>> > if (amdgpu_gart_size == -1)
>>>>> > - adev->mc.gtt_size = max((1024ULL << 20),
>>>>> adev->mc.mc_vram_size);
>>>>> > + adev->mc.gtt_size = max((1024ULL << 20),
>>>>> min(adev->mc.mc_vram_size, sysmem_size/2));
>>>>> > else
>>>>> > adev->mc.gtt_size = (uint64_t)amdgpu_gart_size << 20;
>>>>> >
>>>>> > diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>>>>> b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>>>>> > index 02b6872..790bf7a 100644
>>>>> > --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>>>>> > +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>>>>> > @@ -413,6 +413,11 @@ static int gmc_v8_0_mc_init(struct
>>>>> amdgpu_device *adev)
>>>>> > {
>>>>> > u32 tmp;
>>>>> > int chansize, numchan;
>>>>> > + u64 sysmem_size;
>>>>> > + struct sysinfo si;
>>>>> > +
>>>>> > + si_meminfo(&si);
>>>>> > + sysmem_size = si.totalram * si.mem_unit;
>>>>> >
>>>>> > /* Get VRAM informations */
>>>>> > tmp = RREG32(mmMC_ARB_RAMCFG);
>>>>> > @@ -469,7 +474,7 @@ static int gmc_v8_0_mc_init(struct
>>>>> amdgpu_device *adev)
>>>>> > * size equal to the 1024 or vram, whichever is larger.
>>>>> > */
>>>>> > if (amdgpu_gart_size == -1)
>>>>> > - adev->mc.gtt_size = max((1024ULL << 20),
>>>>> adev->mc.mc_vram_size);
>>>>> > + adev->mc.gtt_size = max((1024ULL << 20),
>>>>> min(adev->mc.mc_vram_size, sysmem_size/2));
>>>>> > else
>>>>> > adev->mc.gtt_size = (uint64_t)amdgpu_gart_size << 20;
>>>>> >
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> amd-gfx mailing list
>>>>> amd-gfx at lists.freedesktop.org
>>>>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>>>>
>>>>
>>>
>>
>>
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20160722/d018df4a/attachment-0001.html>
More information about the amd-gfx
mailing list