From mboxrd@z Thu Jan 1 00:00:00 1970 From: bugzilla-daemon@freedesktop.org Subject: [Bug 107375] Raven: `amdgpu_device_ip_resume_phase2()` takes 750 ms Date: Wed, 25 Jul 2018 13:28:01 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0944031741==" Return-path: Received: from culpepper.freedesktop.org (culpepper.freedesktop.org [131.252.210.165]) by gabe.freedesktop.org (Postfix) with ESMTP id 20CE96E6B5 for ; Wed, 25 Jul 2018 13:28:01 +0000 (UTC) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0944031741== Content-Type: multipart/alternative; boundary="15325252810.b5cECA63.11606" Content-Transfer-Encoding: 7bit --15325252810.b5cECA63.11606 Date: Wed, 25 Jul 2018 13:28:00 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D107375 Bug ID: 107375 Summary: Raven: `amdgpu_device_ip_resume_phase2()` takes 750 ms Product: DRI Version: DRI git Hardware: Other OS: All Status: NEW Severity: normal Priority: medium Component: DRM/AMDgpu Assignee: dri-devel@lists.freedesktop.org Reporter: pmenzel+bugs.freedesktop@molgen.mpg.de Created attachment 140810 --> https://bugs.freedesktop.org/attachment.cgi?id=3D140810&action=3Dedit 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) w= ith 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()= `. =E2=80=A2 amdgpu_device_ip_resume_phase2 [amdgpu] (747.134 ms @ 97.889371) =E2=80=A2 psp_resume [amdgpu] (673.370 ms @ 97.889371) [=E2=80=A6] =E2=80=A2 psp_hw_start [amdgpu] (88.577 ms @ 97.889379) [=E2=80=A6] =E2=80=A2 psp_np_fw_load [amdgpu] (584.783 ms @ 97.977957) [=E2=80=A6] =E2=80=A2 dm_resume [amdgpu] (44.992 ms @ 98.567232) [=E2=80=A6] =E2=80=A2 dc_link_detect [amdgpu] (17.777 ms @ 98.568212) (EDID read takes 8 ms?) [=E2=80=A6] =E2=80=A2 drm_atomic_helper_resume (25.139 ms @ 98.587030) [=E2=80=A6] [=E2=80=A6] 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 psp_cmd_submit_buf(struct psp_context *psp, struct amdgpu_firmware_info *ucode, struct psp_gfx_cmd_resp *cmd, uint64_t fence_mc_addr, int index) { int ret; memset(psp->cmd_buf_mem, 0, PSP_CMD_BUFFER_SIZE); memcpy(psp->cmd_buf_mem, cmd, sizeof(struct psp_gfx_cmd_resp)); ret =3D psp_cmd_submit(psp, ucode, psp->cmd_buf_mc_addr, fence_mc_addr, index); while (*((unsigned int *)psp->fence_buf) !=3D index) { msleep(1); } return ret; } ``` Also, I wonder why the sleep in the trace is 3 ms instead of 1 ms like in t= he code. [1]: https://01.org/suspendresume [2]: https://cgit.freedesktop.org/~agd5f/linux/log/?h=3Damd-staging-drm-next [3]: https://bugs.freedesktop.org/show_bug.cgi?id=3D107278 --=20 You are receiving this mail because: You are the assignee for the bug.= --15325252810.b5cECA63.11606 Date: Wed, 25 Jul 2018 13:28:01 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated
Bug ID 107375
Summary Raven: `amdgpu_device_ip_resume_phase2()` takes 750 ms
Product DRI
Version DRI git
Hardware Other
OS All
Status NEW
Severity normal
Priority medium
Component DRM/AMDgpu
Assignee dri-devel@lists.freedesktop.org
Reporter pmenzel+bugs.freedesktop@molgen.mpg.de

Created attac=
hment 140810 [details]
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) w=
ith
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()=
`.

=E2=80=A2   amdgpu_device_ip_resume_phase2 [amdgpu] (747.134 ms @ 97.88=
9371)
    =E2=80=A2   psp_resume [amdgpu] (673.370 ms @ 97.889371)
        [=E2=80=A6]
        =E2=80=A2   psp_hw_start [amdgpu] (88.577 ms @ 97.889379)
        [=E2=80=A6]
        =E2=80=A2   psp_np_fw_load [amdgpu] (584.783 ms @ 97.977957)
    [=E2=80=A6]
    =E2=80=A2   dm_resume [amdgpu] (44.992 ms @ 98.567232)
        [=E2=80=A6]
        =E2=80=A2   dc_link_detect [amdgpu] (17.777 ms @ 98.568212)
            (EDID read takes 8 ms?)
        [=E2=80=A6]
        =E2=80=A2   drm_atomic_helper_resume (25.139 ms @ 98.587030)
        [=E2=80=A6]
    [=E2=80=A6]

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
psp_cmd_submit_buf(struct psp_context *psp,
                   struct amdgpu_firmware_info *ucode,
                   struct psp_gfx_cmd_resp *cmd, uint64_t fence_mc_addr,
                   int index)
{
        int ret;

        memset(psp->cmd_buf_mem, 0, PSP_CMD_BUFFER_SIZE);

        memcpy(psp->cmd_buf_mem, cmd, sizeof(struct psp_gfx_cmd_resp));

        ret =3D psp_cmd_submit(psp, ucode, psp->cmd_buf_mc_addr,
                             fence_mc_addr, index);

        while (*((unsigned int *)psp->fence_buf) !=3D index) {
                msleep(1);
        }

        return ret;
}
```

Also, I wonder why the sleep in the trace is 3 ms instead of 1 ms like in t=
he
code.


[1]: https://01.org/suspendresume<=
/a>
[2]: https://cgit.freedesktop.org/~agd5f/linux/log/?h=3Damd-stagin=
g-drm-next
[3]: https://bugs.freedesktop.org/show_bug.=
cgi?id=3D107278


You are receiving this mail because:
  • You are the assignee for the bug.
= --15325252810.b5cECA63.11606-- --===============0944031741== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============0944031741==--