lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:   Sat, 28 Jul 2018 21:26:18 +0200
From:   Paul Menzel <pmenzel+amd-gfx@...gen.mpg.de>
To:     amd-gfx@...ts.freedesktop.org
Cc:     linux-kernel@...r.kernel.org
Subject: [RFC] Improve on using delays greater than a few milliseconds

Dear Linux folks,


Trying to decrease the boot time, mostly with ftrace by using [1], I 
noticed a lot of delays. Out of curiosity I searched for all calls of 
`mdelay()` in the driver *amdgpu*.

> $ git grep mdelay drivers/gpu/drm/amd/amdgpu
> drivers/gpu/drm/amd/amdgpu/atom.c:              mdelay(count);
> drivers/gpu/drm/amd/amdgpu/atombios_encoders.c:                 mdelay(1);
> drivers/gpu/drm/amd/amdgpu/cik.c:               mdelay(10);
> drivers/gpu/drm/amd/amdgpu/cik.c:               mdelay(10);
> drivers/gpu/drm/amd/amdgpu/cik.c:               mdelay(10);
> drivers/gpu/drm/amd/amdgpu/cik.c:                               mdelay(100);
> drivers/gpu/drm/amd/amdgpu/cik_ih.c:    mdelay(1);
> drivers/gpu/drm/amd/amdgpu/cz_ih.c:     mdelay(1);
> drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/iceland_ih.c:        mdelay(1);
> drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c:          mdelay(5);
> drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c:          mdelay(1);
> drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c:          mdelay(5);
> drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c:          mdelay(5);
> drivers/gpu/drm/amd/amdgpu/psp_v10_0.c: mdelay(20);
> drivers/gpu/drm/amd/amdgpu/psp_v10_0.c: mdelay(20);
> drivers/gpu/drm/amd/amdgpu/psp_v3_1.c:  mdelay(20);
> drivers/gpu/drm/amd/amdgpu/psp_v3_1.c:  mdelay(20);
> drivers/gpu/drm/amd/amdgpu/psp_v3_1.c:  mdelay(20);
> drivers/gpu/drm/amd/amdgpu/psp_v3_1.c:  mdelay(20);
> drivers/gpu/drm/amd/amdgpu/psp_v3_1.c:  mdelay(1000);
> drivers/gpu/drm/amd/amdgpu/si.c:                                mdelay(100);
> drivers/gpu/drm/amd/amdgpu/si_ih.c:     mdelay(1);
> drivers/gpu/drm/amd/amdgpu/tonga_ih.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:                  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:                  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:                  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:                  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:                          mdelay(20);
> drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c:                          mdelay(30);
> drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:                  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:                  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:          mdelay(1);
> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:          mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:          mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:                          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:                  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:                  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:          mdelay(1);
> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:          mdelay(5);
> drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/vce_v2_0.c:                  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vce_v2_0.c:                  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vce_v2_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vce_v2_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vce_v2_0.c:  mdelay(100);
> drivers/gpu/drm/amd/amdgpu/vce_v2_0.c:          mdelay(1);
> drivers/gpu/drm/amd/amdgpu/vce_v2_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/vce_v3_0.c:                  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vce_v3_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vce_v3_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vce_v3_0.c:          mdelay(100);
> drivers/gpu/drm/amd/amdgpu/vce_v3_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/vce_v3_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/vce_v4_0.c:                  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vce_v4_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vce_v4_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vce_v4_0.c:  mdelay(100);
> drivers/gpu/drm/amd/amdgpu/vce_v4_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/vce_v4_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:                  mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:          mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:  mdelay(1);
> drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c:  mdelay(5);
> drivers/gpu/drm/amd/amdgpu/vega10_ih.c: mdelay(1);
> drivers/gpu/drm/amd/amdgpu/vi.c:                mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vi.c:                mdelay(10);
> drivers/gpu/drm/amd/amdgpu/vi.c:                mdelay(10);

Looking through it, there are a lot of delays over ten milliseconds. 
Quite a few of 100 ms and once one second. I am wondring, why in these 
cases a while loop cannot check if the condition, that is waited for, 
became true. If the hardware engineers really designed the device that 
way, they should be contacted to improve that design in the future.

Do you you think the situation could be improved? I know, I am not a 
amdgfx developer – that datasheets are (often) missing –, but could the 
proposal below help? That could be checked during reviews.

For delays higher than five seconds, a comment must be added, why that 
delay is needed. Citing the datasheet name, revision and section is enough.

Additionally, for delays greater than 20 ms, a FIXME comment should be 
added and the situation explained in the commit message.


Kind regards,

Paul


[1]: https://01.org/suspendresume

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ