<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Ok how about this:<br>
      <br>
      We add a debugfs file which when read returns the GFXOFF status
      and when written with a number disabled GFXOFF for N seconds with
      0 meaning forever.<br>
      <br>
      Umr gets a new commandline option to write to that file before
      reading registers.<br>
      <br>
      This way the user can still disable it if it causes any problems.
      Does that sounds like a plan?<br>
      <br>
      Regards,<br>
      Christian.<br>
      <br>
      Am 21.02.20 um 16:56 schrieb Deucher, Alexander:<br>
    </div>
    <blockquote type="cite"
cite="mid:CH2PR12MB39120922B0E459A5721F0A15F7120@CH2PR12MB3912.namprd12.prod.outlook.com">
      <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>
      <p
        style="font-family:Arial;font-size:10pt;color:#317100;margin:15pt;"
        align="Left">
        [AMD Public Use]<br>
      </p>
      <br>
      <div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          Not at the moment.  But we could add a debugfs file which just
          wraps <font size="2">
            <span style="font-size:11pt">amdgpu_gfx_off_ctrl</span></font>(). 
          That said, maybe we just add a delay here or a use a timer to
          delay turning gfxoff back on again so that we aren't turning
          it on and off so rapidly.</div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          <br>
        </div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          Alex</div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          <br>
        </div>
        <hr style="display:inline-block;width:98%" tabindex="-1">
        <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
            face="Calibri, sans-serif" color="#000000"><b>From:</b>
            Christian König <a class="moz-txt-link-rfc2396E" href="mailto:ckoenig.leichtzumerken@gmail.com"><ckoenig.leichtzumerken@gmail.com></a><br>
            <b>Sent:</b> Friday, February 21, 2020 10:43 AM<br>
            <b>To:</b> Deucher, Alexander
            <a class="moz-txt-link-rfc2396E" href="mailto:Alexander.Deucher@amd.com"><Alexander.Deucher@amd.com></a>; Huang, Ray
            <a class="moz-txt-link-rfc2396E" href="mailto:Ray.Huang@amd.com"><Ray.Huang@amd.com></a>; Liu, Monk
            <a class="moz-txt-link-rfc2396E" href="mailto:Monk.Liu@amd.com"><Monk.Liu@amd.com></a><br>
            <b>Cc:</b> StDenis, Tom <a class="moz-txt-link-rfc2396E" href="mailto:Tom.StDenis@amd.com"><Tom.StDenis@amd.com></a>; Alex
            Deucher <a class="moz-txt-link-rfc2396E" href="mailto:alexdeucher@gmail.com"><alexdeucher@gmail.com></a>; amd-gfx list
            <a class="moz-txt-link-rfc2396E" href="mailto:amd-gfx@lists.freedesktop.org"><amd-gfx@lists.freedesktop.org></a><br>
            <b>Subject:</b> Re: 回复: [PATCH] drm/amd/amdgpu: disable
            GFXOFF around debugfs access to MMIO</font>
          <div> </div>
        </div>
        <div style="background-color:#FFFFFF">
          <div class="x_moz-cite-prefix">Do we have a way to disable
            GFXOFF on the fly?<br>
            <br>
            If not maybe it would be a good idea to add a separate
            debugfs file to do this.<br>
            <br>
            Christian.<br>
            <br>
            Am 21.02.20 um 16:39 schrieb Deucher, Alexander:<br>
          </div>
          <blockquote type="cite">
            <style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
            <p style="font-family:Arial; font-size:10pt; color:#317100;
              margin:15pt" align="Left">
              [AMD Public Use]<br>
            </p>
            <br>
            <div>
              <div
                style="font-family:Calibri,Arial,Helvetica,sans-serif;
                font-size:12pt; color:rgb(0,0,0)">
                If we are trying to debug a reproducible hang, probably
                best to just to disable gfxoff before messing with it to
                remove that as a factor.  Otherwise, the method included
                in this patch is the proper way to disable/enable GFXOFF
                dynamically.</div>
              <div
                style="font-family:Calibri,Arial,Helvetica,sans-serif;
                font-size:12pt; color:rgb(0,0,0)">
                <br>
              </div>
              <div
                style="font-family:Calibri,Arial,Helvetica,sans-serif;
                font-size:12pt; color:rgb(0,0,0)">
                Alex</div>
              <div
                style="font-family:Calibri,Arial,Helvetica,sans-serif;
                font-size:12pt; color:rgb(0,0,0)">
                <br>
              </div>
              <hr tabindex="-1" style="display:inline-block; width:98%">
              <div id="x_divRplyFwdMsg" dir="ltr"><font
                  style="font-size:11pt" face="Calibri, sans-serif"
                  color="#000000"><b>From:</b> amd-gfx
                  <a class="x_moz-txt-link-rfc2396E"
                    href="mailto:amd-gfx-bounces@lists.freedesktop.org"
                    moz-do-not-send="true">
                    <amd-gfx-bounces@lists.freedesktop.org></a> on
                  behalf of Christian König <a
                    class="x_moz-txt-link-rfc2396E"
                    href="mailto:ckoenig.leichtzumerken@gmail.com"
                    moz-do-not-send="true">
                    <ckoenig.leichtzumerken@gmail.com></a><br>
                  <b>Sent:</b> Friday, February 21, 2020 10:27 AM<br>
                  <b>To:</b> Huang, Ray <a
                    class="x_moz-txt-link-rfc2396E"
                    href="mailto:Ray.Huang@amd.com"
                    moz-do-not-send="true">
                    <Ray.Huang@amd.com></a>; Liu, Monk <a
                    class="x_moz-txt-link-rfc2396E"
                    href="mailto:Monk.Liu@amd.com"
                    moz-do-not-send="true">
                    <Monk.Liu@amd.com></a><br>
                  <b>Cc:</b> StDenis, Tom <a
                    class="x_moz-txt-link-rfc2396E"
                    href="mailto:Tom.StDenis@amd.com"
                    moz-do-not-send="true">
                    <Tom.StDenis@amd.com></a>; Alex Deucher <a
                    class="x_moz-txt-link-rfc2396E"
                    href="mailto:alexdeucher@gmail.com"
                    moz-do-not-send="true">
                    <alexdeucher@gmail.com></a>; amd-gfx list <a
                    class="x_moz-txt-link-rfc2396E"
                    href="mailto:amd-gfx@lists.freedesktop.org"
                    moz-do-not-send="true">
                    <amd-gfx@lists.freedesktop.org></a><br>
                  <b>Subject:</b> Re: 回复: [PATCH] drm/amd/amdgpu:
                  disable GFXOFF around debugfs access to MMIO</font>
                <div> </div>
              </div>
              <div class="x_BodyFragment"><font size="2"><span
                    style="font-size:11pt">
                    <div class="x_PlainText">Am 21.02.20 um 16:23
                      schrieb Huang Rui:<br>
                      > On Fri, Feb 21, 2020 at 11:18:07PM +0800,
                      Liu, Monk wrote:<br>
                      >> Better not use KIQ, because when you use
                      debugfs to read register you usually hit a hang,
                      and by that case KIQ probably already die<br>
                      > If CP is busy, the gfx should be in "on"
                      state at that time, we needn't use KIQ.<br>
                      <br>
                      Yeah, but how do you detect that? Do we have a way
                      to wake up the CP <br>
                      without asking power management to do so?<br>
                      <br>
                      Cause the register debug interface is meant to be
                      used when the ASIC is <br>
                      completed locked up. Sending messages to the SMU
                      is not really going to <br>
                      work in that situation.<br>
                      <br>
                      Regards,<br>
                      Christian.<br>
                      <br>
                      ><br>
                      > Thanks,<br>
                      > Ray<br>
                      ><br>
                      >> -----邮件原件-----<br>
                      >> 发件人: amd-gfx <a
                        class="x_moz-txt-link-rfc2396E"
                        href="mailto:amd-gfx-bounces@lists.freedesktop.org"
                        moz-do-not-send="true">
                        <amd-gfx-bounces@lists.freedesktop.org></a>
                      代表 Huang Rui<br>
                      >> 发送时间: 2020年2月21日 22:34<br>
                      >> 收件人: StDenis, Tom <a
                        class="x_moz-txt-link-rfc2396E"
                        href="mailto:Tom.StDenis@amd.com"
                        moz-do-not-send="true">
                        <Tom.StDenis@amd.com></a><br>
                      >> 抄送: Alex Deucher <a
                        class="x_moz-txt-link-rfc2396E"
                        href="mailto:alexdeucher@gmail.com"
                        moz-do-not-send="true">
                        <alexdeucher@gmail.com></a>; amd-gfx list
                      <a class="x_moz-txt-link-rfc2396E"
                        href="mailto:amd-gfx@lists.freedesktop.org"
                        moz-do-not-send="true">
                        <amd-gfx@lists.freedesktop.org></a><br>
                      >> 主题: Re: [PATCH] drm/amd/amdgpu: disable
                      GFXOFF around debugfs access to MMIO<br>
                      >><br>
                      >> On Wed, Feb 19, 2020 at 10:09:46AM -0500,
                      Tom St Denis wrote:<br>
                      >>> I got some messages after a while:<br>
                      >>><br>
                      >>> [  741.788564] Failed to send Message
                      8.<br>
                      >>> [  746.671509] Failed to send Message
                      8.<br>
                      >>> [  748.749673] Failed to send Message
                      2b.<br>
                      >>> [  759.245414] Failed to send Message
                      7.<br>
                      >>> [  763.216902] Failed to send Message
                      2a.<br>
                      >>><br>
                      >>> Are there any additional locks that
                      should be held?  Because some<br>
                      >>> commands like --top or --waves can do
                      a lot of distinct read<br>
                      >>> operations (causing a lot of
                      enable/disable calls).<br>
                      >>><br>
                      >>> I'm going to sit on this a bit since
                      I don't think the patch is ready<br>
                      >>> for pushing out.<br>
                      >>><br>
                      >> How about use RREG32_KIQ and WREG32_KIQ?<br>
                      >><br>
                      >> Thanks,<br>
                      >> Ray<br>
                      >><br>
                      >>> Tom<br>
                      >>><br>
                      >>> On 2020-02-19 10:07 a.m., Alex
                      Deucher wrote:<br>
                      >>>> On Wed, Feb 19, 2020 at 10:04 AM
                      Tom St Denis <a class="x_moz-txt-link-rfc2396E"
                        href="mailto:tom.stdenis@amd.com"
                        moz-do-not-send="true">
                        <tom.stdenis@amd.com></a> wrote:<br>
                      >>>>> Signed-off-by: Tom St Denis <a
                        class="x_moz-txt-link-rfc2396E"
                        href="mailto:tom.stdenis@amd.com"
                        moz-do-not-send="true">
                        <tom.stdenis@amd.com></a><br>
                      >>>> Please add a patch description. 
                      With that fixed:<br>
                      >>>> Reviewed-by: Alex Deucher <a
                        class="x_moz-txt-link-rfc2396E"
                        href="mailto:alexander.deucher@amd.com"
                        moz-do-not-send="true">
                        <alexander.deucher@amd.com></a><br>
                      >>>><br>
                      >>>>> ---<br>
                      >>>>>   
                      drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3
                      +++<br>
                      >>>>>    1 file changed, 3
                      insertions(+)<br>
                      >>>>><br>
                      >>>>> diff --git
                      a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c<br>
                      >>>>>
                      b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c<br>
                      >>>>> index
                      7379910790c9..66f763300c96 100644<br>
                      >>>>> ---
                      a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c<br>
                      >>>>> +++
                      b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c<br>
                      >>>>> @@ -169,6 +169,7 @@ static
                      int  amdgpu_debugfs_process_reg_op(bool read,
                      struct file *f,<br>
                      >>>>>           if (pm_pg_lock)<br>
                      >>>>>                  
                      mutex_lock(&adev->pm.mutex);<br>
                      >>>>><br>
                      >>>>> +      
                      amdgpu_gfx_off_ctrl(adev, false);<br>
                      >>>>>           while (size) {<br>
                      >>>>>                   uint32_t
                      value;<br>
                      >>>>><br>
                      >>>>> @@ -192,6 +193,8 @@ static
                      int  amdgpu_debugfs_process_reg_op(bool read,
                      struct file *f,<br>
                      >>>>>           }<br>
                      >>>>><br>
                      >>>>>    end:<br>
                      >>>>> +      
                      amdgpu_gfx_off_ctrl(adev, true);<br>
                      >>>>> +<br>
                      >>>>>           if (use_bank) {<br>
                      >>>>>                  
                      amdgpu_gfx_select_se_sh(adev, 0xffffffff,
                      0xffffffff, 0xffffffff);<br>
                      >>>>>                  
                      mutex_unlock(&adev->grbm_idx_mutex);<br>
                      >>>>> --<br>
                      >>>>> 2.24.1<br>
                      >>>>><br>
                      >>>>>
                      _______________________________________________<br>
                      >>>>> amd-gfx mailing list<br>
                      >>>>> <a
                        class="x_moz-txt-link-abbreviated"
                        href="mailto:amd-gfx@lists.freedesktop.org"
                        moz-do-not-send="true">
                        amd-gfx@lists.freedesktop.org</a><br>
                      >>>>> <a
href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F"
                        moz-do-not-send="true">
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2F</a><br>
                      >>>>>
                      lists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7<br>
                      >>>>>
                      C01%7Cmonk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8<br>
                      >>>>>
                      961fe4884e608e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdat<br>
                      >>>>>
                      a=%2FyHkvYU5T%2F4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserve<br>
                      >>>>> d=0<br>
                      >>>
                      _______________________________________________<br>
                      >>> amd-gfx mailing list<br>
                      >>> <a
                        class="x_moz-txt-link-abbreviated"
                        href="mailto:amd-gfx@lists.freedesktop.org"
                        moz-do-not-send="true">
                        amd-gfx@lists.freedesktop.org</a><br>
                      >>> <a
href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist"
                        moz-do-not-send="true">
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist</a><br>
                      >>>
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cmo<br>
                      >>>
                      nk.liu%40amd.com%7Cba45efb26c0240ed036f08d7b6db20aa%7C3dd8961fe4884e60<br>
                      >>>
8e11a82d994e183d%7C0%7C0%7C637178924605524378&amp;sdata=%2FyHkvYU5T%2F<br>
                      >>>
                      4iFxRexsg%2BIdm7sDzyXbjzNpHUGCO7h4k%3D&amp;reserved=0<br>
                      >>
                      _______________________________________________<br>
                      >> amd-gfx mailing list<br>
                      >> <a class="x_moz-txt-link-abbreviated"
                        href="mailto:amd-gfx@lists.freedesktop.org"
                        moz-do-not-send="true">
                        amd-gfx@lists.freedesktop.org</a><br>
                      >> <a
href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CAlexander.Deucher%40amd.com%7C50c08a2474b346c44c0608d7b6e4d3ff%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178966243976347&sdata=yQgD1Ywji%2BimCVr06LD0oSnf4ZHGmoN3s8a5NybPx4E%3D&reserved=0"
originalsrc="https://lists.freedesktop.org/mailman/listinfo/amd-gfx"
shash="LqtLGEoomD1bdinw+EjRXZ2OeqKLF5oWf5aHZFEbAfd8xh8rXUIh8fVv+uoJMV9lkffB2syhnIgBLq2tJlSoZoFMbWd3pDTkmt/cpnIC/ExDYy93x3/F1MKt9QH2q0IeK+cT6UKhA+msphzGLXbA3CpORfb4qAfA9cQ6c5Sj/aw="
                        moz-do-not-send="true">
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0</a><br>
                      >
                      _______________________________________________<br>
                      > amd-gfx mailing list<br>
                      > <a class="x_moz-txt-link-abbreviated"
                        href="mailto:amd-gfx@lists.freedesktop.org"
                        moz-do-not-send="true">
                        amd-gfx@lists.freedesktop.org</a><br>
                      > <a
href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CAlexander.Deucher%40amd.com%7C50c08a2474b346c44c0608d7b6e4d3ff%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178966243986301&sdata=5vafv2zCFbpgaSpgcQzLaEAC3wnqkIvGbrvKH3M11s4%3D&reserved=0"
originalsrc="https://lists.freedesktop.org/mailman/listinfo/amd-gfx"
shash="sNRPT35y/6wAGc9zONfY2DSN5loMxxR+oVuiO5qrFk03ANo8/FqIdLmGd8kP4FMnklSakEDVDNeoS97JRFWxUprHaeWBQ0oR5sa7gvhRu1pOw80jjDWxuhfZlFd9xVwkCV31z4wE5g4aPUlsN7IiAfNzmJwQ3sF2RnQONHZuBF4="
                        moz-do-not-send="true">
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0</a><br>
                      <br>
                      _______________________________________________<br>
                      amd-gfx mailing list<br>
                      <a class="x_moz-txt-link-abbreviated"
                        href="mailto:amd-gfx@lists.freedesktop.org"
                        moz-do-not-send="true">amd-gfx@lists.freedesktop.org</a><br>
                      <a
href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CAlexander.Deucher%40amd.com%7C50c08a2474b346c44c0608d7b6e4d3ff%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178966243986301&sdata=5vafv2zCFbpgaSpgcQzLaEAC3wnqkIvGbrvKH3M11s4%3D&reserved=0"
originalsrc="https://lists.freedesktop.org/mailman/listinfo/amd-gfx"
shash="sNRPT35y/6wAGc9zONfY2DSN5loMxxR+oVuiO5qrFk03ANo8/FqIdLmGd8kP4FMnklSakEDVDNeoS97JRFWxUprHaeWBQ0oR5sa7gvhRu1pOw80jjDWxuhfZlFd9xVwkCV31z4wE5g4aPUlsN7IiAfNzmJwQ3sF2RnQONHZuBF4="
                        moz-do-not-send="true">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Calexander.deucher%40amd.com%7Cf3762304925b4019bfed08d7b6e287e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637178957179179431&amp;sdata=bY7V%2BKOF3gYu4ITGCKgAiRvXUvxPcwsz2zsEJDns3jI%3D&amp;reserved=0</a><br>
                    </div>
                  </span></font></div>
            </div>
          </blockquote>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>