mirror of
https://github.com/torvalds/linux.git
synced 2026-03-07 23:04:33 +01:00
When an application issues a query IOCTL while auto suspend is running,
a deadlock can occur. The query path holds dev_lock and then calls
pm_runtime_resume_and_get(), which waits for the ongoing suspend to
complete. Meanwhile, the suspend callback attempts to acquire dev_lock
and blocks, resulting in a deadlock.
Fix this by releasing dev_lock before calling pm_runtime_resume_and_get()
and reacquiring it after the call completes. Also acquire dev_lock in the
resume callback to keep the locking consistent.
Fixes: 063db45183 ("accel/amdxdna: Enhance runtime power management")
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260211204644.722758-1-lizhi.hou@amd.com
29 lines
698 B
C
29 lines
698 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (C) 2025, Advanced Micro Devices, Inc.
|
|
*/
|
|
|
|
#ifndef _AMDXDNA_PM_H_
|
|
#define _AMDXDNA_PM_H_
|
|
|
|
#include "amdxdna_pci_drv.h"
|
|
|
|
int amdxdna_pm_suspend(struct device *dev);
|
|
int amdxdna_pm_resume(struct device *dev);
|
|
int amdxdna_pm_resume_get(struct amdxdna_dev *xdna);
|
|
void amdxdna_pm_suspend_put(struct amdxdna_dev *xdna);
|
|
void amdxdna_pm_init(struct amdxdna_dev *xdna);
|
|
void amdxdna_pm_fini(struct amdxdna_dev *xdna);
|
|
|
|
static inline int amdxdna_pm_resume_get_locked(struct amdxdna_dev *xdna)
|
|
{
|
|
int ret;
|
|
|
|
mutex_unlock(&xdna->dev_lock);
|
|
ret = amdxdna_pm_resume_get(xdna);
|
|
mutex_lock(&xdna->dev_lock);
|
|
|
|
return ret;
|
|
}
|
|
|
|
#endif /* _AMDXDNA_PM_H_ */
|