<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Yeah sounds good to me.<br>
      <br>
      Could we make a global ttm function returning how much system
      memory can be used at the same time?<br>
      <br>
      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.<br>
      <br>
      Regards,<br>
      Christian.<br>
      <br>
      Am 22.07.2016 um 08:06 schrieb Wang, Ken:<br>
    </div>
    <blockquote
cite="mid:CY1PR12MB0508280B4E4E1408F5ECAD24EC0A0@CY1PR12MB0508.namprd12.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
        <p>thanks Felix,</p>
        <p>   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.<br>
        </p>
      </div>
      <hr style="display:inline-block;width:98%" tabindex="-1">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
          color="#000000" face="Calibri, sans-serif"><b>发件人:</b> amd-gfx
          <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx-bounces@lists.freedesktop.org"><amd-gfx-bounces@lists.freedesktop.org></a> 代表 Felix
          Kuehling <a class="moz-txt-link-rfc2396E" href="mailto:felix.kuehling@amd.com"><felix.kuehling@amd.com></a><br>
          <b>发送时间:</b> 2016年7月22日 3:19:38<br>
          <b>收件人:</b> <a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
          <b>主题:</b> Re: 答复: 答复: 答复: [PATCH] drm/amdgpu: adjust gtt
          memory size</font>
        <div> </div>
      </div>
      <div>
        <p>TTM limits system memory allocations to 1/2 system memory for
          regular processes, or 3/4 for privileged processes.</p>
        <p><br>
        </p>
        <p>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.<br>
        </p>
        <p><br>
        </p>
        <p>Regards,</p>
        <p>  Felix<br>
        </p>
        <br>
        <div class="moz-cite-prefix">On 16-07-21 08:04 AM, Christian
          König wrote:<br>
        </div>
        <blockquote
          cite="mid:3839ef42-6275-99d8-9aee-54143a971f0b@vodafone.de"
          type="cite">
          <div class="moz-cite-prefix">
            <blockquote type="cite">
              <p>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.</p>
              <p>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.</p>
            </blockquote>
            Well that is at least something that makes sense.<br>
            <br>
            Previous discussions where always settled around making GART
            bigger than VRAM and not the other way around.<br>
            <br>
            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.<br>
            <br>
            I think we should use the same value which TTM uses for the
            upper limit here.<br>
            <br>
            Regards,<br>
            Christian.<br>
            <br>
            Am 21.07.2016 um 13:56 schrieb Wang, Qingqing:<br>
          </div>
          <blockquote
cite="mid:SN1PR12MB0511DD6F60EAFDB326320B46EC090@SN1PR12MB0511.namprd12.prod.outlook.com"
            type="cite">
            <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
            <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
              <p>alright, I didn't realize you're not in that thread. </p>
              <p>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.</p>
              <p>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.</p>
            </div>
            <hr style="display:inline-block;width:98%" tabindex="-1">
            <div id="divRplyFwdMsg" dir="ltr"><font
                style="font-size:11pt" color="#000000" face="Calibri,
                sans-serif"><b>发件人:</b> Christian König
                <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
                  href="mailto:deathsimple@vodafone.de">
                  <deathsimple@vodafone.de></a><br>
                <b>发送时间:</b> 2016年7月21日 19:48:17<br>
                <b>收件人:</b> Wang, Qingqing; <a moz-do-not-send="true"
                  class="moz-txt-link-abbreviated"
                  href="mailto:amd-gfx@lists.freedesktop.org">
                  amd-gfx@lists.freedesktop.org</a><br>
                <b>主题:</b> Re: 答复: 答复: [PATCH] drm/amdgpu: adjust gtt
                memory size</font>
              <div> </div>
            </div>
            <div>
              <div class="moz-cite-prefix">Am 21.07.2016 um 13:15
                schrieb Wang, Qingqing:<br>
              </div>
              <blockquote
cite="mid:SN1PR12MB051120166EEFC6A65C7BB795EC090@SN1PR12MB0511.namprd12.prod.outlook.com"
                type="cite">
                <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
                <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
                  <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
                    <p><span style="color: rgb(33, 33, 33); font-size:
                        15px;">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.</span><br>
                    </p>
                    <p><font color="#212121"><span style="font-size:
                          15px;">-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.</span></font></p>
                  </div>
                </div>
              </blockquote>
              No, exactly for this reason we have the public mailing
              list. I for example wasn't part of the internal thread
              either.<br>
              <br>
              Christian.<br>
              <br>
              <blockquote
cite="mid:SN1PR12MB051120166EEFC6A65C7BB795EC090@SN1PR12MB0511.namprd12.prod.outlook.com"
                type="cite">
                <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
                  <hr style="display:inline-block;width:98%"
                    tabindex="-1">
                  <div id="divRplyFwdMsg" dir="ltr"><font
                      style="font-size:11pt" color="#000000"
                      face="Calibri, sans-serif"><b>发件人:</b> Christian
                      König
                      <a moz-do-not-send="true"
                        class="moz-txt-link-rfc2396E"
                        href="mailto:deathsimple@vodafone.de">
                        <deathsimple@vodafone.de></a><br>
                      <b>发送时间:</b> 2016年7月21日 17:48:41<br>
                      <b>收件人:</b> Wang, Qingqing; <a
                        moz-do-not-send="true"
                        class="moz-txt-link-abbreviated"
                        href="mailto:amd-gfx@lists.freedesktop.org">
                        amd-gfx@lists.freedesktop.org</a><br>
                      <b>主题:</b> Re: 答复: [PATCH] drm/amdgpu: adjust gtt
                      memory size</font>
                    <div> </div>
                  </div>
                  <div>
                    <div class="moz-cite-prefix">Am 21.07.2016 um 11:16
                      schrieb Wang, Qingqing:<br>
                    </div>
                    <blockquote
cite="mid:SN1PR12MB0511612A271156A2EFC7B449EC090@SN1PR12MB0511.namprd12.prod.outlook.com"
                      type="cite">
                      <meta name="Generator" content="Microsoft Exchange
                        Server">
                      <!-- converted from text -->
                      <meta content="text/html; charset=UTF-8">
                      <div dir="ltr">
                        <div id="x_divtagdefaultwrapper"
                          style="font-size:12pt; color:#000000;
                          background-color:#FFFFFF;
                          font-family:Calibri,Arial,Helvetica,sans-serif">
                          <p><font size="2"><span style="font-size:10pt">This
                                doesn't work on 32bit systems since
                                totalram is a long (IIRC) and
                                <br>
                                so this will certainly overflow.</span></font></p>
                          <p>-- can you be more specific, how could the
                            overflow happen?</p>
                        </div>
                      </div>
                    </blockquote>
                    <br>
                    Both values are 32bit on a 32bit system, so as soon
                    as you have more than 4GB installed this will
                    overflow.<br>
                    <br>
                    You need to cast the long to a 64bit value to avoid
                    that.<br>
                    <br>
                    <blockquote
cite="mid:SN1PR12MB0511612A271156A2EFC7B449EC090@SN1PR12MB0511.namprd12.prod.outlook.com"
                      type="cite">
                      <div dir="ltr">
                        <div id="x_divtagdefaultwrapper"
                          style="font-size:12pt; color:#000000;
                          background-color:#FFFFFF;
                          font-family:Calibri,Arial,Helvetica,sans-serif">
                          <p><br>
                          </p>
                          <p><font size="2"><span style="font-size:10pt">Additional
                                if I remember correctly we didn't ended
                                the discussion on
                                <br>
                                what to do here with a conclusion.</span></font></p>
                          <p>-- ok, since it happens in anther mail
                            list, we should stop talking about it here,
                            you can send out your ideas there.<br>
                          </p>
                        </div>
                      </div>
                    </blockquote>
                    <br>
                    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.<br>
                    <br>
                    Regards,<br>
                    Christian.<br>
                    <br>
                    <blockquote
cite="mid:SN1PR12MB0511612A271156A2EFC7B449EC090@SN1PR12MB0511.namprd12.prod.outlook.com"
                      type="cite">
                      <div dir="ltr">
                        <div id="x_divtagdefaultwrapper"
                          style="font-size:12pt; color:#000000;
                          background-color:#FFFFFF;
                          font-family:Calibri,Arial,Helvetica,sans-serif">
                        </div>
                        <hr tabindex="-1" style="display:inline-block;
                          width:98%">
                        <div id="x_divRplyFwdMsg" dir="ltr"><font
                            style="font-size:11pt" color="#000000"
                            face="Calibri, sans-serif"><b>发件人:</b>
                            amd-gfx
                            <a moz-do-not-send="true"
                              class="moz-txt-link-rfc2396E"
                              href="mailto:amd-gfx-bounces@lists.freedesktop.org">
<amd-gfx-bounces@lists.freedesktop.org></a> 代表 Christian König <a
                              moz-do-not-send="true"
                              class="moz-txt-link-rfc2396E"
                              href="mailto:deathsimple@vodafone.de">
                              <deathsimple@vodafone.de></a><br>
                            <b>发送时间:</b> 2016年7月21日 16:53:05<br>
                            <b>收件人:</b> Wang, Qingqing; <a
                              moz-do-not-send="true"
                              class="moz-txt-link-abbreviated"
                              href="mailto:amd-gfx@lists.freedesktop.org">
                              amd-gfx@lists.freedesktop.org</a><br>
                            <b>主题:</b> Re: [PATCH] drm/amdgpu: adjust
                            gtt memory size</font>
                          <div> </div>
                        </div>
                      </div>
                      <font size="2"><span style="font-size:10pt;">
                          <div class="PlainText">Am 21.07.2016 um 09:46
                            schrieb Ken Wang:<br>
                            > Change-Id:
                            If00d5b97ba9e30f9b7f68fdfc134a0f8b3ad2add<br>
                            > Signed-off-by: Ken Wang <a
                              moz-do-not-send="true"
                              class="moz-txt-link-rfc2396E"
                              href="mailto:Qingqing.Wang@amd.com">
                              <Qingqing.Wang@amd.com></a><br>
                            > ---<br>
                            >   drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
                            | 7 ++++++-<br>
                            >   drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
                            | 7 ++++++-<br>
                            >   2 files changed, 12 insertions(+), 2
                            deletions(-)<br>
                            ><br>
                            > diff --git
                            a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
                            b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c<br>
                            > index a3b6048..0b095d5 100644<br>
                            > ---
                            a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c<br>
                            > +++
                            b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c<br>
                            > @@ -336,6 +336,11 @@ static int
                            gmc_v7_0_mc_init(struct amdgpu_device *adev)<br>
                            >   {<br>
                            >        u32 tmp;<br>
                            >        int chansize, numchan;<br>
                            > +     u64 sysmem_size;<br>
                            > +     struct sysinfo si;<br>
                            > +<br>
                            > +     si_meminfo(&si);<br>
                            > +     sysmem_size = si.totalram *
                            si.mem_unit;<br>
                            <br>
                            This doesn't work on 32bit systems since
                            totalram is a long (IIRC) and <br>
                            so this will certainly overflow.<br>
                            <br>
                            Additional if I remember correctly we didn't
                            ended the discussion on <br>
                            what to do here with a conclusion.<br>
                            <br>
                            Regards,<br>
                            Christian.<br>
                            <br>
                            >   <br>
                            >        /* Get VRAM informations */<br>
                            >        tmp = RREG32(mmMC_ARB_RAMCFG);<br>
                            > @@ -392,7 +397,7 @@ static int
                            gmc_v7_0_mc_init(struct amdgpu_device *adev)<br>
                            >         * size equal to the 1024 or
                            vram, whichever is larger.<br>
                            >         */<br>
                            >        if (amdgpu_gart_size == -1)<br>
                            > -             adev->mc.gtt_size =
                            max((1024ULL << 20),
                            adev->mc.mc_vram_size);<br>
                            > +             adev->mc.gtt_size =
                            max((1024ULL << 20),
                            min(adev->mc.mc_vram_size,
                            sysmem_size/2));<br>
                            >        else<br>
                            >                adev->mc.gtt_size =
                            (uint64_t)amdgpu_gart_size << 20;<br>
                            >   <br>
                            > diff --git
                            a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
                            b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c<br>
                            > index 02b6872..790bf7a 100644<br>
                            > ---
                            a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c<br>
                            > +++
                            b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c<br>
                            > @@ -413,6 +413,11 @@ static int
                            gmc_v8_0_mc_init(struct amdgpu_device *adev)<br>
                            >   {<br>
                            >        u32 tmp;<br>
                            >        int chansize, numchan;<br>
                            > +     u64 sysmem_size;<br>
                            > +     struct sysinfo si;<br>
                            > +<br>
                            > +     si_meminfo(&si);<br>
                            > +     sysmem_size = si.totalram *
                            si.mem_unit;<br>
                            >   <br>
                            >        /* Get VRAM informations */<br>
                            >        tmp = RREG32(mmMC_ARB_RAMCFG);<br>
                            > @@ -469,7 +474,7 @@ static int
                            gmc_v8_0_mc_init(struct amdgpu_device *adev)<br>
                            >         * size equal to the 1024 or
                            vram, whichever is larger.<br>
                            >         */<br>
                            >        if (amdgpu_gart_size == -1)<br>
                            > -             adev->mc.gtt_size =
                            max((1024ULL << 20),
                            adev->mc.mc_vram_size);<br>
                            > +             adev->mc.gtt_size =
                            max((1024ULL << 20),
                            min(adev->mc.mc_vram_size,
                            sysmem_size/2));<br>
                            >        else<br>
                            >                adev->mc.gtt_size =
                            (uint64_t)amdgpu_gart_size << 20;<br>
                            >   <br>
                            <br>
                            <br>
_______________________________________________<br>
                            amd-gfx mailing list<br>
                            <a moz-do-not-send="true"
                              class="moz-txt-link-abbreviated"
                              href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
                            <a moz-do-not-send="true"
                              href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
                          </div>
                        </span></font></blockquote>
                    <p><br>
                    </p>
                  </div>
                </div>
              </blockquote>
              <p><br>
              </p>
            </div>
          </blockquote>
          <p><br>
          </p>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <br>
          <pre wrap="">_______________________________________________
amd-gfx mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
</pre>
        </blockquote>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
amd-gfx mailing list
<a class="moz-txt-link-abbreviated" href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a>
</pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>