Raven: `amdgpu_device_ip_resume_phase2()` takes 750 ms
Submitted by Paul Menzel
Assigned to Default DRI bug account
Link to original bug (#107375)
Description
Created attachment 140810
HTML output of sudo ./sleepgraph.py -config config/suspend-callgraph.cfg
(devicelist: amdgpu, maxdepth: 12)
Profiling the suspend and resume time [1] on a MSI B350M MORTAR (MS-7A37) with AMD Ryzen 3 2200G with Radeon Vega Graphics with Linux 4.18-rc6+ and amd-staging-drm-next [2], pci_pm_suspend()
takes over one second, which is too long [3], cf. bug 107278 [3].
The majority of that, 750 ms, is spent in amdgpu_device_ip_resume_phase2()
.
• amdgpu_device_ip_resume_phase2 [amdgpu] (747.134 ms @ 97.889371)
• psp_resume [amdgpu] (673.370 ms @ 97.889371)
[…]
• psp_hw_start [amdgpu] (88.577 ms @ 97.889379)
[…]
• psp_np_fw_load [amdgpu] (584.783 ms @ 97.977957)
[…]
• dm_resume [amdgpu] (44.992 ms @ 98.567232)
[…]
• dc_link_detect [amdgpu] (17.777 ms @ 98.568212)
(EDID read takes 8 ms?)
[…]
• drm_atomic_helper_resume (25.139 ms @ 98.587030)
[…]
[…]
In the PSP code the problem is psp_cmd_submit_buf()
, which takes from 45 ms to 141 ms. Something is wrong there.
static int<br>
psp_cmd_submit_buf(struct psp_context *psp,<br>
struct amdgpu_firmware_info *ucode,<br>
struct psp_gfx_cmd_resp *cmd, uint64_t fence_mc_addr,<br>
int index)<br>
{<br>
int ret;<br>
<br>
memset(psp->cmd_buf_mem, 0, PSP_CMD_BUFFER_SIZE);<br>
<br>
memcpy(psp->cmd_buf_mem, cmd, sizeof(struct psp_gfx_cmd_resp));<br>
<br>
ret = psp_cmd_submit(psp, ucode, psp->cmd_buf_mc_addr,<br>
fence_mc_addr, index);<br>
<br>
while (*((unsigned int *)psp->fence_buf) != index) {<br>
msleep(1);<br>
}<br>
<br>
return ret;<br>
}<br>
```<br>
<br>
Also, I wonder why the sleep in the trace is 3 ms instead of 1 ms like in the code.<br>
<br>
<br>
[1]: https://01.org/suspendresume<br>
[2]: https://cgit.freedesktop.org/~agd5f/linux/log/?h=amd-staging-drm-next<br>
[3]: https://bugs.freedesktop.org/show_bug.cgi?id=107278<br>
<br>
**Attachment 140810**, "HTML output of `sudo ./sleepgraph.py -config config/suspend-callgraph.cfg` (devicelist: amdgpu, maxdepth: 12)": <br>
[tokeiihto_mem.html](/uploads/fcbc5932a8fcb49a49952b6f795591d5/tokeiihto_mem.html)<br>
### Blocking
* [Bug 107278](https://bugs.freedesktop.org/show_bug.cgi?id=107278)