From: James <bold.zone2373@fastmail.com>
To: "Shuah Khan" <skhan@linuxfoundation.org>,
harry.wentland@amd.com, sunpeng.li@amd.com, siqueira@igalia.com,
alexander.deucher@amd.com, christian.koenig@amd.com,
airlied@gmail.com, simona@ffwll.ch, aurabindo.pillai@amd.com,
alex.hung@amd.com
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel-mentees@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/amd/display: replace use of msleep(<20) with usleep_range for better accuracy
Date: Fri, 28 Mar 2025 23:54:34 -0700 [thread overview]
Message-ID: <8b73708c-4613-42a0-9d48-5bf6f0e01ced@app.fastmail.com> (raw)
In-Reply-To: <476c5bb9-79c5-40b7-bba8-b52fb244e90e@linuxfoundation.org>
On Fri, Mar 28, 2025, at 3:46 PM, Shuah Khan wrote:
> On 3/26/25 01:00, James Flowers wrote:
>> msleep < 20ms will often sleep for ~20ms (according to Documentation/timers/timers-howto.rst).
>
> Can you elaborate and explain why this change is necessary?
scripts/checkpatch.pl highlighted it as a possible issue since msleep can cause the delay to be unexpectedly closer to 20ms. However, perhaps it would be better to submit a V2 with the change as usleep_range(10000, 20000) to match the actual delay range that msleep(10) has, which would help avoid a regression like this: https://gitlab.freedesktop.org/drm/amd/-/issues/3559#note_2532546.
Is there any appetite for drm/amd to change instances of msleep(x) (x being < 20) to usleep_range(x*1000, 20000), so that the range of delay is clear to readers unfamiliar with the msleep quirk? Please let me know and I can submit a V2.
There is at least one instance (fixed by commit 57995aa8ffb3e47a74763cf9106d34e9e8be9d8d) in drm/amdgpu where msleep(1) seemed to be causing an unexpectedly long delay, and so was replaced with usleep_range. An issue possibly related to that fix is https://gitlab.freedesktop.org/drm/amd/-/issues/462.
Currently there are 37 msleep(1) calls that I can find in drm/amd. I'm just thinking that optimization opportunities like above could be found more easily if the delay range is made clear?
Best regards,
James Flowers
next prev parent reply other threads:[~2025-03-29 6:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 7:00 [PATCH] drm/amd/display: replace use of msleep(<20) with usleep_range for better accuracy James Flowers
2025-03-28 22:46 ` Shuah Khan
2025-03-29 6:54 ` James [this message]
2025-03-31 12:34 ` Christian König
2025-03-31 18:20 ` Harry Wentland
2025-04-01 4:23 ` James
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8b73708c-4613-42a0-9d48-5bf6f0e01ced@app.fastmail.com \
--to=bold.zone2373@fastmail.com \
--cc=airlied@gmail.com \
--cc=alex.hung@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=linux-kernel-mentees@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=siqueira@igalia.com \
--cc=skhan@linuxfoundation.org \
--cc=sunpeng.li@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox