drm/amdgpu: Fix validating flush_gpu_tlb_pasid()
Subsystems (2)
PATCH 1/1 drm/amdgpu: Fix validating flush_gpu_tlb_pasid()
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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +2 -3
@@ -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 ;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;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 ;
Signature · 1 line
2.52.0
[Public]
Thank you for the fix. Could you please add the following the tags?
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
Regards,
Prike
Quoted 58 lines
-----Original Message-----
From: Timur Kristóf <[email protected]>
Sent: Sunday, January 18, 2026 8:58 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Liang, Prike <[email protected]>; Limonciello, Mario <[email protected]>
Cc: Timur Kristóf <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix validatingflush_gpu_tlb_pasid()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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -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 ;uint32_t seq;/*drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -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;if (adev->gmc.flush_tlb_needs_extra_type_2)adev->gmc.gmc_funcs->flush_gpu_tlb_pasid(adev, pasid,drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-1@@ -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;--
2.52.0
[Public]
In order to avoid being blocked by the lock issue on some older GFX, I will push the patch to amd-staging-drm-next. If you have any concerns, please let me know.
Regards,
Prike
Quoted 80 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liang, Prike
Sent: Monday, January 19, 2026 9:58 AM
To: Timur Kristóf <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Limonciello, Mario <[email protected]>; Dan Carpenter <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Fix validatingflush_gpu_tlb_pasid()[Public]
Thank you for the fix. Could you please add the following the tags?
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/Reviewed-by Prike Liang <[email protected]>Regards,
PrikeQuoted 58 lines
-----Original Message-----
From: Timur Kristóf <[email protected]>
Sent: Sunday, January 18, 2026 8:58 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Liang, Prike <[email protected]>; Limonciello, Mario <[email protected]>
Cc: Timur Kristóf <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix validatingflush_gpu_tlb_pasid()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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -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 ;uint32_t seq;/*drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -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;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;--
2.52.0
Quoted 7 lines · Prike
[Public]
In order to avoid being blocked by the lock issue on some older GFX, I will push the patch to amd-staging-drm-next.
If you have any concerns, please
let me know.
Hi Prike,
Thank you, feel free to add the necessary tags and push the patch.
Best regards,
Timur
Quoted 5 lines
Quoted 5 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liang, Prike
Sent: Monday, January 19, 2026 9:58 AM
Quoted 2 lines
Quoted 2 lines
To: Timur Kristóf <[email protected]>;
[email protected];
Deucher, Alexander
Quoted 121 lines
Quoted 119 lines
<[email protected]>; Koenig, Christian <[email protected]>; Limonciello, Mario <[email protected]>; Dan Carpenter <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Fix validatingflush_gpu_tlb_pasid()[Public]
Thank you for the fix. Could you please add the following the tags?
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/Reviewed-by Prike Liang <[email protected]>Regards,
Prike
Quoted 88 lines
-----Original Message-----
From: Timur Kristóf <[email protected]>
Sent: Sunday, January 18, 2026 8:58 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Liang, Prike <[email protected]>; Limonciello, Mario <[email protected]>
Cc: Timur Kristóf <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix validatingflush_gpu_tlb_pasid()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 <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -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 ;uint32_t seq; /*drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -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; 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_tpasid,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;--
2.52.0
Christian König
maintainerQuoted 4 lines · Prike
[Public]
In order to avoid being blocked by the lock issue on some older GFX, I will push the patch to amd-staging-drm-next. If you have any concerns, please let me know.
I only had a coding style comment on the patch and also gave my rb with that as well.
So if you haven't pushed it yet please fix what I've pointed out. Otherwise it is not much of an issue.
Regards,
Christian.
Quoted 85 lines
Regards,
PrikeQuoted 80 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liang, Prike
Sent: Monday, January 19, 2026 9:58 AM
To: Timur Kristóf <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Limonciello, Mario <[email protected]>; Dan Carpenter <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Fix validatingflush_gpu_tlb_pasid()[Public]
Thank you for the fix. Could you please add the following the tags?
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/Reviewed-by Prike Liang <[email protected]>Regards,
PrikeQuoted 58 lines
-----Original Message-----
From: Timur Kristóf <[email protected]>
Sent: Sunday, January 18, 2026 8:58 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Liang, Prike <[email protected]>; Limonciello, Mario <[email protected]>
Cc: Timur Kristóf <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix validatingflush_gpu_tlb_pasid()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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -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 ;uint32_t seq;/*drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -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;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;--
2.52.0
[Public]
Regards,
Prike
Quoted 16 lines
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Monday, January 19, 2026 6:33 PM
To: Liang, Prike <[email protected]>; Timur Kristóf <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Limonciello, Mario <[email protected]>; Dan Carpenter <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fix validatingflush_gpu_tlb_pasid()Quoted 3 lines · Prike
[Public]
In order to avoid being blocked by the lock issue on some older GFX, I will push
the patch to amd-staging-drm-next.
Quoted 1 line
If you have any concerns, please let me know.
Quoted 8 lines
I only had a coding style comment on the patch and also gave my rb with that as well.
So if you haven't pushed it yet please fix what I've pointed out. Otherwise it is not much of an issue.
Regards,
Christian.
The patch is still running in the CI pipeline. I’ll revise it to improve the patch style.
Quoted 89 lines
Quoted 89 lines
Regards,
PrikeQuoted 84 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liang, Prike
Sent: Monday, January 19, 2026 9:58 AM
To: Timur Kristóf <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Limonciello, Mario <[email protected]>; Dan Carpenter <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Fix validatingflush_gpu_tlb_pasid()[Public]
Thank you for the fix. Could you please add the following the tags?
| Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: | https://lore.kernel.org/r/[email protected]/Reviewed-by Prike Liang <[email protected]>Regards,
PrikeQuoted 59 lines
-----Original Message-----
From: Timur Kristóf <[email protected]>
Sent: Sunday, January 18, 2026 8:58 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Liang, Prike <[email protected]>; Limonciello, Mario <[email protected]>
Cc: Timur Kristóf <[email protected]>
Subject: [PATCH] drm/amdgpu: Fix validatingflush_gpu_tlb_pasid()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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -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 ;uint32_t seq;/*drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -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;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;--
2.52.0
Christian König
maintainerQuoted 17 lines · Timur Kristóf
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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid, · line 772
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1@@ -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.
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid, · line 785
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1uint32_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 <[email protected]>
Regards,
Christian.
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-1if (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 ;
Quoted 25 lines · Central European Standard Time Christian König
Quoted 24 lines · Timur Kristóf
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 <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.cindex0e67fa4338ff..4fa24be1bf45100644drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-0@@ -769,7 +769,7 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct
amdgpu_device*adev,uint16_tpasid,>drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-0struct amdgpu_ring *ring = &adev->gfx.kiq[inst].ring;struct amdgpu_kiq *kiq = &adev->gfx.kiq[inst];unsigned int ndw;
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid, · line 772
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1-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.
The initialization is necessary, otherwise the function will return an uninitialized value when flush_gpu_tlb_pasid==NULL
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-0uint32_t seq;/* @@ -782,7 +782,7 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct
amdgpu_device*adev,uint16_tpasid,>drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-0if (!adev->gmc.flush_pasid_uses_kiq || !ring->sched.ready) {if (!adev->gmc.gmc_funcs->flush_gpu_tlb_pasid)
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid, · line 785
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1-return 0 ; + goto error_unlock_reset;Ah, yes good catch!
With the change to r initialization dropped: Reviewed-by: Christian König <[email protected]>
If I drop it, then it will regress again because it returns an uninitialized value.
Quoted 6 lines
Regards,
Christian.Quoted 2 lines
if (
adev->gmc.flush_tlb_needs_extra_type_2)
Quoted 8 lines
Quoted 1 line
adev->gmc.gmc_funcs-
flush_gpu_tlb_pasid(adev, pasid,
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-0@@ -797,7 +797,6 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct
amdgpu_device*adev,uint16_tpasid,>
adev->gmc.gmc_funcs->flush_gpu_tlb_pasid(adev, pasid,
flush_type, all_hub,
Quoted 1 line
Quoted 1 line
inst);
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-1- r =0 ; }else {/* 2 dwords flush + 8 dwords fence */ ndw = kiq->pmf->invalidate_tlbs_size +8 ;
[Public]
Regards,
Prike
Quoted 37 lines
-----Original Message-----
From: Timur Kristóf <[email protected]>
Sent: Monday, January 19, 2026 7:21 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>; Limonciello, Mario <[email protected]>; Koenig, Christian <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fix validatingflush_gpu_tlb_pasid()Quoted 26 lines · Central European Standard Time Christian König
Quoted 25 lines · Timur Kristóf
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 <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.cindex0e67fa4338ff..4fa24be1bf45100644drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-0@@ -769,7 +769,7 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct
amdgpu_device*adev,uint16_tpasid,>
structamdgpu_ring*ring = &adev->gfx.kiq[inst].ring; structamdgpu_kiq*kiq = &adev->gfx.kiq[inst]; unsigned int ndw;
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
- 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.
The initialization is necessary, otherwise the function will return an uninitialized value when flush_gpu_tlb_pasid==NULL
We can initialize the r before goto error_unlock_reset.
Quoted 47 lines
Quoted 10 lines
Quoted 10 lines
uint32_tseq;/*
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-0@@ -782,7 +782,7 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct
amdgpu_device*adev,uint16_tpasid,>
if (!adev->gmc.flush_pasid_uses_kiq || !ring->sched.ready) {if (!adev->gmc.gmc_funcs->flush_gpu_tlb_pasid)Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c int amdgpu_gmc_flush_gpu_tlb_pasid(struct amdgpu_device *adev, uint16_t pasid, · line 785
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +1
-1-return 0 ; + goto error_unlock_reset;Ah, yes good catch!
With the change to r initialization dropped: Reviewed-by: Christian König <[email protected]>
If I drop it, then it will regress again because it returns an uninitialized value.
Quoted 6 lines
Regards,
Christian.Quoted 2 lines
if (adev->gmc.flush_tlb_needs_extra_type_2)Quoted 8 lines
Quoted 1 line
adev->gmc.gmc_funcs-flush_gpu_tlb_pasid(adev, pasid,
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-0@@ -797,7 +797,6 @@ int amdgpu_gmc_flush_gpu_tlb_pasid(struct
amdgpu_device*adev,uint16_tpasid,>adev->gmc.gmc_funcs->flush_gpu_tlb_pasid(adev, pasid,
flush_type,all_hub,Quoted 1 line
Quoted 1 line
inst);
Quoted 7 lines
Quoted 7 lines
- r = 0;
} else {/* 2 dwords flush + 8 dwords fence */ ndw = kiq->pmf->invalidate_tlbs_size + 8;