<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:pmenzel+bugs.freedesktop@molgen.mpg.de" title="Paul Menzel <pmenzel+bugs.freedesktop@molgen.mpg.de>"> <span class="fn">Paul Menzel</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Raven: pci_pm_suspend takes over 1 second"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107277">bug 107277</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEEDINFO
           </td>
           <td>NEW
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Raven: pci_pm_suspend takes over 1 second"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107277#c6">Comment # 6</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Raven: pci_pm_suspend takes over 1 second"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=107277">bug 107277</a>
              from <span class="vcard"><a class="email" href="mailto:pmenzel+bugs.freedesktop@molgen.mpg.de" title="Paul Menzel <pmenzel+bugs.freedesktop@molgen.mpg.de>"> <span class="fn">Paul Menzel</span></a>
</span></b>
        <pre>(In reply to Paul Menzel from <a href="show_bug.cgi?id=107277#c3">comment #3</a>)
<span class="quote">> (In reply to Christian König from <a href="show_bug.cgi?id=107277#c2">comment #2</a>)</span >

[…]

<span class="quote">> > > amdgpu_device_ip_suspend [amdgpu] (694.390 ms @ 75.000977)
> > 
> > This is hardware teardown and rather interesting and the only point we could
> > actually do something. Can you figure out what takes so long here?

> I’ll try to figure that out.</span >

I increased the maximum depth to 10, and according to the trace the loop in
`gfx_v9_0_enter_rlc_safe_mode()` is the culprit. Also, in all the function is
called three times.

static void gfx_v9_0_enter_rlc_safe_mode(struct amdgpu_device *adev)
{
        uint32_t rlc_setting, data;
        unsigned i;

        if (adev->gfx.rlc.in_safe_mode)
                return;

        /* if RLC is not enabled, do nothing */
        rlc_setting = RREG32_SOC15(GC, 0, mmRLC_CNTL);
        if (!(rlc_setting & RLC_CNTL__RLC_ENABLE_F32_MASK))
                return;

        if (adev->cg_flags &
            (AMD_CG_SUPPORT_GFX_CGCG | AMD_CG_SUPPORT_GFX_MGCG |
             AMD_CG_SUPPORT_GFX_3D_CGCG)) {
                data = RLC_SAFE_MODE__CMD_MASK;
                data |= (1 << RLC_SAFE_MODE__MESSAGE__SHIFT);
                WREG32_SOC15(GC, 0, mmRLC_SAFE_MODE, data);

                /* wait for RLC_SAFE_MODE */
                for (i = 0; i < adev->usec_timeout; i++) {
                        if (!REG_GET_FIELD(SOC15_REG_OFFSET(GC, 0,
mmRLC_SAFE_MODE), RLC_SAFE_MODE, CMD))
                                break;
                        udelay(1);
                }
                adev->gfx.rlc.in_safe_mode = true;
        }
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>