From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FD063603D8 for ; Thu, 13 Aug 2026 07:12:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786605182; cv=none; b=m0UVXUIFcf8Mm0xCmnKpJy49flmhjBVaYH5yEmBDtIBXIjNac2SQQ4NIzLlwDFbiSakQwyj/CoDyuyVCbrHTbQl1uT3a/iyR5KysFaWY8a+9l0ql5w2amrHvLS2mkjEc0s4pzciAKs/r2Uil/9d+ndCoEsLxYQx/zjtmeVn54wo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786605182; c=relaxed/simple; bh=6eBWF9r0sKOU45Eyb2ShiZJvSuVlbZ6/CTZ1ieUnrDk=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=A8MXeSFeczvJitz1SQ5w3EKlGxZzwtlts7WlqQLfbZpzvoPkAFnbAJm/oRyz+w8xEsVR1/0DI1rgWOjAKNjJiXnJWkUOHunw4gXn2kdS2kTEiXoOw/6fpJD8/hSCj6g/9qmD3d0Y3pbY7Ey96xPxp+oWSI0EbMPzneUDBNPAvS0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=SAHdfyX2; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SAHdfyX2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1786605179; x=1818141179; h=message-id:date:mime-version:subject:to:references:from: in-reply-to:content-transfer-encoding; bh=6eBWF9r0sKOU45Eyb2ShiZJvSuVlbZ6/CTZ1ieUnrDk=; b=SAHdfyX2Vpqsd+c2GAYFnnQoOvW6yow+hXw9xVeyUx90N+Cte9VWjyZV xe5mLTKy+7XzqcBdD1XwEDjC9N5WcZigis011SoExOE1P1QtkJuWnKDOq cLfSo01EIUOQJcYJv7NcjtVgnrXz0jHT6QobKiJF3b2kqK9X+aZqYX7cf vvtPwrNcJ8wGn2/rEGt0qrT9LYv5AGRQWykepAyg4qQ3S6bA3+fX1oRAf 4XOjYtfRHDD1GMszd2kccp1plYzvs/JdflKe2sMVRWCCAt4RGXrmyuryR OBwHYUWBHmd8Xb0Iqz/hwuFH/aNBpGYhp35EB4oGEX6XzglO2PoLYbpMO w==; X-CSE-ConnectionGUID: Xo160K19SryDROtb/WXkYw== X-CSE-MsgGUID: E0DisjBKQuOyz9cn8xGJsQ== X-IronPort-AV: E=McAfee;i="6800,10657,11873"; a="87296659" X-IronPort-AV: E=Sophos;i="6.25,220,1779174000"; d="scan'208";a="87296659" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2026 00:12:56 -0700 X-CSE-ConnectionGUID: GdGNcBpwRDm0zUtUCBrc/A== X-CSE-MsgGUID: 4BhJFFtzQleUb8kTCEXDaA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,220,1779174000"; d="scan'208";a="257641162" Received: from kpleskax-mobl2.ger.corp.intel.com (HELO [10.94.252.39]) ([10.94.252.39]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2026 00:12:53 -0700 Message-ID: <4c656606-b91f-4e12-8e39-3b89ec0c13cd@linux.intel.com> Date: Thu, 13 Aug 2026 09:12:49 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] accel/ivpu: fix usage_count leak when autosuspend_delay is negative To: Guangshuo Li , Andrzej Kacprowski , Oded Gabbay , Jeff Hugo , Jacek Lawrynowicz , Simona Vetter , Krystian Pradzynski , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20260807145416.2518999-1-lgs201920130244@gmail.com> Content-Language: en-US From: "Wachowski, Karol" In-Reply-To: <20260807145416.2518999-1-lgs201920130244@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 07-Aug-26 16:54, Guangshuo Li wrote: > 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 Hello, Thanks for the submission. > --- > 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) > > ret = ivpu_boot(vdev); > if (ret) > - goto err_ipc_fini; > + goto err_pm_fini; This leaves err_ipc_fini label unused, could you please remove that label below and keep both pm_runtime_dont_use_autosuspend(vdev->drm.dev) and ivpu_ipc_fini(vdev) under err_pm_fini. Otherwise compiler will complain about unused label. > > ivpu_job_done_consumer_init(vdev); > ivpu_pm_enable(vdev); > > return 0; > > +err_pm_fini: > + pm_runtime_dont_use_autosuspend(vdev->drm.dev); > err_ipc_fini: Remove err_ipc_fini here. Once that gets fixed: Reviewed-by: Karol Wachowski > 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) > > 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); > }