From: "Christian König" <christian.koenig@amd.com>
To: "Timur Kristóf" <timur.kristof@gmail.com>,
amd-gfx@lists.freedesktop.org, Alexander.Deucher@amd.com,
"Prike Liang" <Prike.Liang@amd.com>,
"Mario Limonciello" <mario.limonciello@amd.com>
Subject: Re: [PATCH] drm/amdgpu: Fix validating flush_gpu_tlb_pasid()
Date: Mon, 19 Jan 2026 11:12:02 +0100 [thread overview]
Message-ID: <0b3603e5-f6d1-4be8-80dc-e9aaaac48e40@amd.com> (raw)
In-Reply-To: <20260118125746.40221-1-timur.kristof@gmail.com>
On 1/18/26 13:57, Timur Kristóf wrote:
> When a function holds a lock and we return without unlocking it,
> it deadlocks the kernel. We should always unlock before returning.
>
> This commit fixes suspend/resume on SI.
> Tested on two Tahiti GPUs: FirePro W9000 and R9 280X.
>
> Fixes: bc2dea30038a ("drm/amdgpu: validate the flush_gpu_tlb_pasid()")
> Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 0e67fa4338ff..4fa24be1bf45 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -769,7 +769,7 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid,
> struct amdgpu_ring *ring = &adev->gfx.kiq[inst].ring;
> struct amdgpu_kiq *kiq = &adev->gfx.kiq[inst];
> unsigned int ndw;
> - int r, cnt = 0;
> + int r = 0, cnt = 0;
Please don't initialize return values in the declaration, that is usually considered bad coding style.
> uint32_t seq;
>
> /*
> @@ -782,7 +782,7 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid,
> if (!adev->gmc.flush_pasid_uses_kiq || !ring->sched.ready) {
>
> if (!adev->gmc.gmc_funcs->flush_gpu_tlb_pasid)
> - return 0;
> + goto error_unlock_reset;
Ah, yes good catch!
With the change to r initialization dropped: Reviewed-by: Christian König <christian.koenig@amd.com>
Regards,
Christian.
>
> if (adev->gmc.flush_tlb_needs_extra_type_2)
> adev->gmc.gmc_funcs->flush_gpu_tlb_pasid(adev, pasid,
> @@ -797,7 +797,6 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid,
> adev->gmc.gmc_funcs->flush_gpu_tlb_pasid(adev, pasid,
> flush_type, all_hub,
> inst);
> - r = 0;
> } else {
> /* 2 dwords flush + 8 dwords fence */
> ndw = kiq->pmf->invalidate_tlbs_size + 8;
next prev parent reply other threads:[~2026-01-19 10:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-18 12:57 [PATCH] drm/amdgpu: Fix validating flush_gpu_tlb_pasid() Timur Kristóf
2026-01-19 1:57 ` Liang, Prike
2026-01-19 5:27 ` Liang, Prike
2026-01-19 9:00 ` Timur Kristóf
2026-01-19 10:33 ` Christian König
2026-01-19 11:44 ` Liang, Prike
2026-01-19 10:12 ` Christian König [this message]
2026-01-19 11:20 ` Timur Kristóf
2026-01-19 11:47 ` Liang, Prike
-- strict thread matches above, loose matches on Subject: below --
2026-01-19 12:07 Prike Liang
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=0b3603e5-f6d1-4be8-80dc-e9aaaac48e40@amd.com \
--to=christian.koenig@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Prike.Liang@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=mario.limonciello@amd.com \
--cc=timur.kristof@gmail.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