Skip to content

Commit 7d12a7d

Browse files
jlawrynogregkh
authored andcommitted
accel/ivpu: Fix deadlock in ivpu_ms_cleanup()
commit 9a6f567 upstream. Fix deadlock in ivpu_ms_cleanup() by preventing runtime resume after file_priv->ms_lock is acquired. During a failure in runtime resume, a cold boot is executed, which calls ivpu_ms_cleanup_all(). This function calls ivpu_ms_cleanup() that acquires file_priv->ms_lock and causes the deadlock. Fixes: cdfad4d ("accel/ivpu: Add NPU profiling support") Cc: stable@vger.kernel.org # v6.11+ Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com> Reviewed-by: Lizhi Hou <lizhi.hou@amd.com> Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> Link: https://lore.kernel.org/r/20250325114306.3740022-2-maciej.falkowski@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5c200b7 commit 7d12a7d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/accel/ivpu/ivpu_ms.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
#include <drm/drm_file.h>
7+
#include <linux/pm_runtime.h>
78

89
#include "ivpu_drv.h"
910
#include "ivpu_gem.h"
@@ -299,6 +300,9 @@ int ivpu_ms_get_info_ioctl(struct drm_device *dev, void *data, struct drm_file *
299300
void ivpu_ms_cleanup(struct ivpu_file_priv *file_priv)
300301
{
301302
struct ivpu_ms_instance *ms, *tmp;
303+
struct ivpu_device *vdev = file_priv->vdev;
304+
305+
pm_runtime_get_sync(vdev->drm.dev);
302306

303307
mutex_lock(&file_priv->ms_lock);
304308

@@ -311,6 +315,8 @@ void ivpu_ms_cleanup(struct ivpu_file_priv *file_priv)
311315
free_instance(file_priv, ms);
312316

313317
mutex_unlock(&file_priv->ms_lock);
318+
319+
pm_runtime_put_autosuspend(vdev->drm.dev);
314320
}
315321

316322
void ivpu_ms_cleanup_all(struct ivpu_device *vdev)

0 commit comments

Comments
 (0)