<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - `ttm_bo_handle_move_mem` sometimes takes more than 50 ms"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=111305">111305</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>`ttm_bo_handle_move_mem` sometimes takes more than 50 ms
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>DRI
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>XOrg git
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DRM/AMDgpu
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dri-devel@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>pmenzel+bugs.freedesktop.org@molgen.mpg.de
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=144954" name="attach_144954" title="Screenshot from callgraph excerpt">attachment 144954</a> <a href="attachment.cgi?id=144954&action=edit" title="Screenshot from callgraph excerpt">[details]</a></span>
Screenshot from callgraph excerpt

With Linux 5.3-rc3 and pm-graph’s `sleepgraph.py` [1] measuring suspend times
on the Dell OptiPlex 5040 with an external AMD graphics card, the driver needs
2.1 seconds to suspend the device, which is too long.

    $ lspci -nn -s 01:
    01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc.
[AMD/ATI] Oland XT [Radeon HD 8670 / R7 250/350] [1002:6610] (rev 81)
    01:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Cape
Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series] [1002:aab0]

Here is the time:

    0000:01:00.0 suspend (2170.017 ms @ 5037.143762 to 5039.313779)

Looking into the call graph, 1.4 s are spent in `ttm_bo_evict_mm`.

    ttm_bo_evict_mm [ttm] (1438.050 ms @ 5037.601941)

As you can see in the attached screenshot, there are some
`ttm_bo_handle_move_mem` call which take several milliseconds adding up to the
long time.

    - ttm_mem_evict_first [ttm] (304.860 ms @ 5037.705809)
        _raw_spin_lock
        mutex_trylock (0.000 ms @ 5037.705809)
        + ttm_bo_del_from_lru [ttm]
        - ttm_bo_evict [ttm] (304.857 ms @ 5037.705810)
            amdgpu_evict_flags [amdgpu] (0.000 ms @ 5037.705810)
            ttm_bo_mem_space [ttm] (0.001 ms @ 5037.705811)
            ttm_bo_handle_move_mem [ttm] (304.853 ms @ 5037.705812)

[1]: <a href="https://github.com/intel/pm-graph">https://github.com/intel/pm-graph</a></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>