From nobody Tue Sep 29 12:02:21 2026 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FEEC37BE84 for ; Fri, 7 Aug 2026 14:56:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786114605; cv=none; b=guc5Mx+SA2jn2zkYEy7DLo4HkrGMgDzHTTc6/Q3fhqOMIEytLk+8lRLGqYZfMIkzbWP0wt/7LCR09SZ3cQrXlNotDE4QOQX2LJcDfQLYGQPDqjH8Abmdy1QoSl3c0LnWTCQhA7+/9Th9NO88l2OdSh05uim7JS+buoA4p4GSh34= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786114605; c=relaxed/simple; bh=cL8HrvSMWLk3ueN41jzyIySzqYqIFUhQenjN5Rcvuug=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XCh3Bqrc7HFQhU76VbXfPb8o0ol28JBHrH9cabwS/J1P6MTz2eplbkjz1GY8Fc/Lj/h2qDLYxr8bVHQcbnHkdO1tVqE7TeogsqzazE6OARjte6t8ptdb3VIKIyai1MHwbjEgosAV2fiQiuqdPkxL3PjHE+HuWNEmtXFUn0MlEYk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=T0Lup/2b; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T0Lup/2b" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2cedda2ce6fso30424775ad.1 for ; Fri, 07 Aug 2026 07:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786114599; x=1786719399; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=G/8xx2t4WO7QVCjZ7uGwrmqxOJTEUaxIvRYS3m/7Bno=; b=T0Lup/2bpUaieTmuzvsZblu2j2QTNPjkUPQPeyXuIQkPrwhNnoi0yWSpnnEVTB462C gIgacuNcP2r4IvS6qbgLZl2BqKHeTlAyEc5xRgPzrbJPkgcb3USRKCIAsRIAwXSCdbzB zMRACiI1NW38drk0oYJbWGmL6tIwy1XwHj90l1eNic1wIIbiv8DnYSalbOPvFdln1oTm 8FEjEuc6ojJUyKyYw6aK/Xm+9Om5oLRSWCsix5V4NKFx+wWwdMWFrRj0piWbIxlWUjcC ghw8k3NlPnvOMmVgkmWm3GqB+hsfgd8F+kEL3+pQXGoczFw9ocXML4rJ/qlKGXSdGh60 mEKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786114599; x=1786719399; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=G/8xx2t4WO7QVCjZ7uGwrmqxOJTEUaxIvRYS3m/7Bno=; b=QB1UZPgOr2oRQyDcSa+nps8pBOtApXPcfJABBUkuzOiIed6GcZ11Z1Zo2hn6pFZdQM n0JROfoli1q9nf3QCM/6GAAoqEd3oPhLcbzjbKAvTkf0tHq3982Gtl30/4bCY9N0u8aM 1lsGsOEwZQWPoep2hT4EksVkWLq9wDNyHkRTigMVEA9Twpb68jFvdf9GCGbTL0ct3QLb ADEduOJIDr71EISxeqeYUUmO/zpvVHr4G4aGP4cRo+2XNEMCoFOqc4VOzN83Ly8mfYvu hcN/QE97K1VSfvWTyJTjl6emWHdA0u1ld+RejHO5+ohYPOts3RImPrBmt4i1psomKUTj kLvQ== X-Forwarded-Encrypted: i=1; AHgh+RqvU9s8+6BlS4tHjm5EPOkleZgsc3IBNGuP2rGziVJAI2DndnndJzVbjumDVfVuM1fuw50fgsRbPxWqc/I=@vger.kernel.org X-Gm-Message-State: AOJu0YyhpGFuolrH2B/FEiG2M3NHhriPabde66x7suvsZH6jVSpiyW5c 99an8rTR9R5hG/I34XrqUqUsf5Sy19QBBUgjib2uHQb6jFyHz6i8X23S X-Gm-Gg: AR+sD12XeYa2vSM2TYcXZNHuZI/lp8ReBuoeQ0kumIOZ+ahU3m5YnScItVERj3RwhkA GDiMj1rlO3FR4LXe29bIxeX3Rqg+me/Loe0W22vdi4+ddaibwE6xjsshP1CUsqmOaQOJm/GumiJ n8Y2xYRtcRBYXlGvPZWPWSFGei4WLz+MeLEcx6ZLA2ItbD8IElXcnFDO1w/OKxoROz6KHTiZxm+ iWvNwkr49Gmo4ACOX5ZPTEnI8XhvAwm55mCWYFhqnNXGpeyiaLmWceeqZz05x40Q2Sxe8j76jbL tK1pLY4wmNjA6u82CzDNo+MR3H4T4xd2uyd509rbPR4Yy6Z7UEjI8gZ2iZN0TNcFopxzWH+j1gx OBzM8PELZkctAtDbDBSY/wv9ojQpvKaxpF2gn9bZ/C8WrEJdT5cfh7cfqA3fKwKMqHrjf1/MCWL vjdmHVNt121oKyUl9ctj25if6Jp7ZILU28e48Tqkrw0uk= X-Received: by 2002:a17:902:d485:b0:2c9:d55d:2d3 with SMTP id d9443c01a7336-2d2a20b6c2cmr23611005ad.15.1786114598695; Fri, 07 Aug 2026 07:56:38 -0700 (PDT) Received: from lgs.. ([2001:250:5800:1000::f280]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d14dbeaa95sm10653235ad.38.2026.08.07.07.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2026 07:56:38 -0700 (PDT) From: Guangshuo Li To: Karol Wachowski , Andrzej Kacprowski , Oded Gabbay , Jeff Hugo , Jacek Lawrynowicz , Simona Vetter , Krystian Pradzynski , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: Guangshuo Li Subject: [PATCH] accel/ivpu: fix usage_count leak when autosuspend_delay is negative Date: Fri, 7 Aug 2026 22:54:16 +0800 Message-ID: <20260807145416.2518999-1-lgs201920130244@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ivpu_pm_init() calls pm_runtime_use_autosuspend(), but the autosuspend setting is not disabled when the device is removed or when initialization fails after runtime PM setup. When the autosuspend delay is negative, the runtime PM core increments usage_count to prevent runtime suspend. Without a matching pm_runtime_dont_use_autosuspend(), this reference is not dropped and usage_count remains unbalanced. Call pm_runtime_dont_use_autosuspend() from ivpu_pm_disable() to clean up the autosuspend state during normal device teardown. Also undo the autosuspend setting when ivpu_boot() fails after ivpu_pm_init(). This issue was found by manual code inspection. Fixes: 852be13f3bd3 ("accel/ivpu: Add PM support") Signed-off-by: Guangshuo Li Reviewed-by: Karol Wachowski --- drivers/accel/ivpu/ivpu_drv.c | 4 +++- drivers/accel/ivpu/ivpu_pm.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/accel/ivpu/ivpu_drv.c b/drivers/accel/ivpu/ivpu_drv.c index 35e506074d5f..633c90e73f2c 100644 --- a/drivers/accel/ivpu/ivpu_drv.c +++ b/drivers/accel/ivpu/ivpu_drv.c @@ -756,13 +756,15 @@ static int ivpu_dev_init(struct ivpu_device *vdev) =20 ret =3D ivpu_boot(vdev); if (ret) - goto err_ipc_fini; + goto err_pm_fini; =20 ivpu_job_done_consumer_init(vdev); ivpu_pm_enable(vdev); =20 return 0; =20 +err_pm_fini: + pm_runtime_dont_use_autosuspend(vdev->drm.dev); err_ipc_fini: ivpu_ipc_fini(vdev); err_fw_fini: diff --git a/drivers/accel/ivpu/ivpu_pm.c b/drivers/accel/ivpu/ivpu_pm.c index c1ce8329790e..20dc8ec7d70a 100644 --- a/drivers/accel/ivpu/ivpu_pm.c +++ b/drivers/accel/ivpu/ivpu_pm.c @@ -445,6 +445,7 @@ void ivpu_pm_enable(struct ivpu_device *vdev) =20 void ivpu_pm_disable(struct ivpu_device *vdev) { + pm_runtime_dont_use_autosuspend(vdev->drm.dev); pm_runtime_get_noresume(vdev->drm.dev); pm_runtime_forbid(vdev->drm.dev); } --=20 2.43.0