From: "Michel Dänzer" <michel@daenzer.net>
To: "Quan, Evan" <Evan.Quan@amd.com>,
"Deucher, Alexander" <Alexander.Deucher@amd.com>,
"Koenig, Christian" <Christian.Koenig@amd.com>
Cc: "Liu, Leo" <Leo.Liu@amd.com>, "Zhu, James" <James.Zhu@amd.com>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/amdgpu: Cancel delayed work when GFXOFF is disabled
Date: Mon, 16 Aug 2021 12:43:32 +0200 [thread overview]
Message-ID: <19353c73-1be3-9e62-f2a0-f63fcf6c71bc@daenzer.net> (raw)
In-Reply-To: <DM6PR12MB26191AE1AF962B3F7CC02E87E4FD9@DM6PR12MB2619.namprd12.prod.outlook.com>
On 2021-08-16 12:20 p.m., Quan, Evan wrote:
> [AMD Official Use Only]
>
> Hi Michel,
>
> The patch seems reasonable to me(especially the cancel_delayed_work_sync() part).
> However, can you explain more about the code below?
> What's the race issue here exactly?
>
> + /* mutex_lock could deadlock with cancel_delayed_work_sync in amdgpu_gfx_off_ctrl. */
> + if (!mutex_trylock(&adev->gfx.gfx_off_mutex)) {
> + /* If there's a bug which causes amdgpu_gfx_off_ctrl to be called with enable=true
> + * when adev->gfx.gfx_off_req_count is already 0, we might race with that.
> + * Re-schedule to make sure gfx off will be re-enabled in the HW eventually.
> + */
> + schedule_delayed_work(&adev->gfx.gfx_off_delay_work, AMDGPU_GFX_OFF_DELAY_ENABLE);
> + return;
> + }
If amdgpu_gfx_off_ctrl was called with enable=true when adev->gfx.gfx_off_req_count == 0 already, it could have prevented amdgpu_device_delay_enable_gfx_off from locking the mutex.
v3 solves this by only scheduling the work when adev->gfx.gfx_off_req_count transitions from 1 to 0, which means it no longer needs to lock the mutex.
--
Earthling Michel Dänzer | https://redhat.com
Libre software enthusiast | Mesa and X developer
next prev parent reply other threads:[~2021-08-16 10:43 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-11 16:52 [PATCH 1/2] drm/amdgpu: Use mod_delayed_work in amdgpu_gfx_off_ctrl Michel Dänzer
2021-08-11 16:52 ` [PATCH 2/2] drm/amdgpu: Use mod_delayed_work in JPEG/UVD/VCE/VCN ring_end_use hooks Michel Dänzer
2021-08-11 20:34 ` Alex Deucher
2021-08-11 21:00 ` Zhu, James
2021-08-11 21:34 ` AW: " Koenig, Christian
2021-08-11 22:12 ` Zhu, James
2021-08-11 22:22 ` Zhu, James
2021-08-12 2:42 ` Quan, Evan
2021-08-12 5:55 ` AW: " Koenig, Christian
2021-08-12 8:11 ` Michel Dänzer
2021-08-12 11:33 ` Lazar, Lijo
2021-08-12 16:54 ` Michel Dänzer
2021-08-13 4:23 ` Lazar, Lijo
2021-08-13 10:31 ` Michel Dänzer
2021-08-13 11:18 ` Lazar, Lijo
2021-08-16 7:33 ` Christian König
2021-08-12 2:43 ` [PATCH 1/2] drm/amdgpu: Use mod_delayed_work in amdgpu_gfx_off_ctrl Quan, Evan
2021-08-13 10:29 ` [PATCH] drm/amdgpu: Cancel delayed work when GFXOFF is disabled Michel Dänzer
2021-08-13 11:50 ` Lazar, Lijo
2021-08-13 13:34 ` Michel Dänzer
2021-08-13 14:14 ` Lazar, Lijo
2021-08-13 14:40 ` Michel Dänzer
2021-08-13 15:07 ` Lazar, Lijo
2021-08-13 16:00 ` Michel Dänzer
2021-08-16 4:13 ` Lazar, Lijo
2021-08-16 10:45 ` Michel Dänzer
2021-08-16 7:38 ` Christian König
2021-08-16 10:38 ` Michel Dänzer
2021-08-16 10:20 ` Quan, Evan
2021-08-16 10:43 ` Michel Dänzer [this message]
2021-08-16 10:35 ` [PATCH v3] " Michel Dänzer
2021-08-16 11:33 ` Lazar, Lijo
2021-08-16 12:06 ` Christian König
2021-08-16 15:06 ` Michel Dänzer
2021-08-16 19:02 ` Alex Deucher
2021-08-17 7:51 ` Quan, Evan
2021-08-17 8:17 ` Lazar, Lijo
2021-08-17 8:35 ` Michel Dänzer
2021-08-17 8:23 ` [PATCH] " Michel Dänzer
2021-08-17 9:12 ` Lazar, Lijo
2021-08-17 9:26 ` Michel Dänzer
2021-08-17 9:37 ` Lazar, Lijo
2021-08-17 9:59 ` Michel Dänzer
2021-08-17 10:37 ` Lazar, Lijo
2021-08-17 11:06 ` Michel Dänzer
2021-08-17 11:49 ` Lazar, Lijo
2021-08-17 12:55 ` Lazar, Lijo
2021-08-17 9:33 ` Quan, Evan
2021-08-18 21:56 ` Alex Deucher
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=19353c73-1be3-9e62-f2a0-f63fcf6c71bc@daenzer.net \
--to=michel@daenzer.net \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=Evan.Quan@amd.com \
--cc=James.Zhu@amd.com \
--cc=Leo.Liu@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
/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;
as well as URLs for NNTP newsgroup(s).