答复: 答复: 答复: [PATCH] drm/amdgpu: adjust gtt memory size

Wang, Qingqing Qingqing.Wang at amd.com
Thu Jul 21 11:56:17 UTC 2016


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><mailto:deathsimple at vodafone.de>
发送时间: 2016年7月21日 17:48:41
收件人: Wang, Qingqing; amd-gfx at lists.freedesktop.org<mailto: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><mailto:amd-gfx-bounces at lists.freedesktop.org> 代表 Christian König <deathsimple at vodafone.de><mailto:deathsimple at vodafone.de>
发送时间: 2016年7月21日 16:53:05
收件人: Wang, Qingqing; amd-gfx at lists.freedesktop.org<mailto: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><mailto: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<mailto: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/20160721/92242d7f/attachment-0001.html>


More information about the amd-gfx mailing list