linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] gpu: drm: amd: amdgpu: possible ABBA deadlock in amdgpu_set_power_dpm_force_performance_level() and amdgpu_debugfs_process_reg_op()
@ 2021-09-15  9:39 Jia-Ju Bai
  2021-12-09  3:34 ` Jia-Ju Bai
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2021-09-15  9:39 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	Hawking.Zhang, Felix.Kuehling, ray.huang, lee.jones
  Cc: amd-gfx, dri-devel, linux-kernel

Hello,

My static analysis tool reports a possible ABBA deadlock in the amdgpu 
driver in Linux 5.10:

amdgpu_debugfs_process_reg_op()
   mutex_lock(&adev->grbm_idx_mutex); --> Line 250 (Lock A)
   mutex_lock(&adev->pm.mutex); --> Line 259 (Lock B)

amdgpu_set_power_dpm_force_performance_level()
   mutex_lock(&adev->pm.mutex); --> Line 381 (Lock B)
     pp_dpm_force_performance_level() --> function pointer via 
"amdgpu_dpm_force_performance_level()"
       pp_dpm_en_umd_pstate()
         amdgpu_device_ip_set_clockgating_state()
           gfx_v7_0_set_clockgating_state() --> function pointer via 
"funcs->set_clockgating_state()"
             gfx_v7_0_enable_mgcg()
               mutex_lock(&adev->grbm_idx_mutex); --> Line 3646 (Lock A)
               mutex_lock(&adev->grbm_idx_mutex); --> Line 3697 (Lock A)

When amdgpu_debugfs_process_reg_op() and 
amdgpu_set_power_dpm_force_performance_level() are concurrently 
executed, the deadlock can occur.

I am not quite sure whether this possible deadlock is real and how to 
fix it if it is real.
Any feedback would be appreciated, thanks :)

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>


Best wishes,
Jia-Ju Bai

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] gpu: drm: amd: amdgpu: possible ABBA deadlock in amdgpu_set_power_dpm_force_performance_level() and amdgpu_debugfs_process_reg_op()
  2021-09-15  9:39 [BUG] gpu: drm: amd: amdgpu: possible ABBA deadlock in amdgpu_set_power_dpm_force_performance_level() and amdgpu_debugfs_process_reg_op() Jia-Ju Bai
@ 2021-12-09  3:34 ` Jia-Ju Bai
  0 siblings, 0 replies; 2+ messages in thread
From: Jia-Ju Bai @ 2021-12-09  3:34 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, daniel,
	Hawking.Zhang, Felix.Kuehling, ray.huang, lee.jones
  Cc: amd-gfx, dri-devel, linux-kernel

Hello,

Could you please provide the feedback to my previous report?
Thanks a lot :)


Best wishes,
Jia-Ju Bai

On 2021/9/15 17:39, Jia-Ju Bai wrote:
> Hello,
>
> My static analysis tool reports a possible ABBA deadlock in the amdgpu 
> driver in Linux 5.10:
>
> amdgpu_debugfs_process_reg_op()
>   mutex_lock(&adev->grbm_idx_mutex); --> Line 250 (Lock A)
>   mutex_lock(&adev->pm.mutex); --> Line 259 (Lock B)
>
> amdgpu_set_power_dpm_force_performance_level()
>   mutex_lock(&adev->pm.mutex); --> Line 381 (Lock B)
>     pp_dpm_force_performance_level() --> function pointer via 
> "amdgpu_dpm_force_performance_level()"
>       pp_dpm_en_umd_pstate()
>         amdgpu_device_ip_set_clockgating_state()
>           gfx_v7_0_set_clockgating_state() --> function pointer via 
> "funcs->set_clockgating_state()"
>             gfx_v7_0_enable_mgcg()
>               mutex_lock(&adev->grbm_idx_mutex); --> Line 3646 (Lock A)
>               mutex_lock(&adev->grbm_idx_mutex); --> Line 3697 (Lock A)
>
> When amdgpu_debugfs_process_reg_op() and 
> amdgpu_set_power_dpm_force_performance_level() are concurrently 
> executed, the deadlock can occur.
>
> I am not quite sure whether this possible deadlock is real and how to 
> fix it if it is real.
> Any feedback would be appreciated, thanks :)
>
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
>
>
> Best wishes,
> Jia-Ju Bai


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-09  3:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15  9:39 [BUG] gpu: drm: amd: amdgpu: possible ABBA deadlock in amdgpu_set_power_dpm_force_performance_level() and amdgpu_debugfs_process_reg_op() Jia-Ju Bai
2021-12-09  3:34 ` Jia-Ju Bai

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).