From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387830; b=Bj8/JC5nsLL+VITgEPESH5BYslrTs/kcX1Oq+H7jadhfDJ2iWXfCpcJngbpXbdPc9XMG 3nPm74JFMrdeERkcClok9Cd+B/MbYjB5atFRSzK6D4WHY9plq0DCFC6mIjYiGob3ICUCj Imvbj3vjgNZIT6RLj0+3jJA4OJE0hZiAlytOd8BGnwl6d+ofOYqjIYM2t/ee+4LndK7P9 8N1ezA0mFHNepRHVrB73rXhtWXxhwf9m1ugN5CcL5EbOw4ngTuhPm2Lv5pmQ06p3s4PMx sJenzTco0Vg0vZf+1YmiIBch3wiVsJyomvglSWROLaQ1ihWFIh2RqKOFEoYvYazKwQA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387830; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=OnPiGdki7jmg+Ziq4yqMuq2mOT/Rf4gfYt5SkUPvNaM=; b=qBOxW3n0xD4IUhUryPjapqAIcyjWPKAUs2iKzYC4Pm4lgD74bmMA2FdqgUpYQgL0yM9F 2Dyq1IQ6VYx3hf3Kob+dG+HRd5H68c6X3S80I59TpqpJln3CEQWXZrwGFggcBg9K8lpYh qXtv2dCHLeSkZHlihc4YmMRB1JGkwbjnajL+7Cmiqw/eNGHuBkrQJBIgkAyJU+gCQWe4e p60h8lXSoe2FE1wO3Ukniimu6vUb7dqSVyEfEd09W1JD0kjZ6DB0vr8Eyy6a99nrb4iUC cl8bVVZCiAAflXssRkJVa2bWaIbGxHtIbMLwgIN/9e1GbmwYB+qu32nFLmBoAlkEgsg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="Z/slOXpn"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4F00606A322; Fri, 4 Dec 2026 12:37:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Z/slOXpn Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BC1A1F000C2; Fri, 4 Dec 2026 12:37:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387830; bh=OnPiGdki7jmg+Ziq4yqMuq2mOT/Rf4gfYt5SkUPvNaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Z/slOXpnkhJMN6TkpNPF/IdAyVg0eMi8CCp0vZZGaQ+MN4tOtYXQRrlyNrJ4HvrkH j8EHsqufRHTZe3Dmu2LY9KfYclaeEjlFlNpRGHucvhNx2qxtyURrmGvdQzzT+idymx jnAbG22qRQPoc5hhDg/n7imOBhyUd/bpE8Hizgec= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Boris Brezillon , Steven Price , =?UTF-8?q?Adri=C3=A1n=20Larumbe?= , Sasha Levin Subject: [PATCH 6.1 0376/1059] drm/panfrost: Fix PM refcnt and autosuspend issues at device probe/remove Date: Fri, 4 Dec 2026 18:58:27 +0900 Message-ID: <20261204100654.026963000@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Adrián Larumbe [ Upstream commit e9672bf9382ff80be21d586f88e50339b85f5766 ] During device probe(), failure to do a PM get() will leave the usage_count set to 0, which is the value assigned at device creation time. That means when the autosuspend delay expires, runtime suspend callback won't be invoked, so the device will remain powered on forever. On top of that, failure to call PM put() during device unplug means Panfrost device's PM usage_count increases monotonically for every new module reload. The outcome of both of the above meant that: - Devfreq OPP transition notifications would be printed all the time, even when no jobs are being submitted. This quickly fills the kernel ring buffer with junk. - Because MMU interrupts are only enabled when the device is reset, the very first job targeting the tiler heap BO after device probe() would always time out, since the driver's PM runtime resume callback would not be invoked. To fix the above: - Manually adjust the PM refcnt at device probe and removal time. - Ensure pm_runtime_dont_use_autosuspend is called in the wind-down path. - Call pm_runtime_put_autosuspend() when device is ready to accept jobs Fixes: 635430797d3f ("drm/panfrost: Rework runtime PM initialization") Fixes: 876b15d2c88d ("drm/panfrost: Fix module unload") Reviewed-by: Boris Brezillon Reviewed-by: Steven Price Link: https://patch.msgid.link/20261012-claude-fixes-v15-6-bc0a6c498553@collabora.com Signed-off-by: Adrián Larumbe [ sashal: Adapted context to the older tree (pfdev->dev instead of pfdev->base.dev, with the shrinker init and drm_dev_put kept), placing put_autosuspend after the shrinker init. ] Signed-off-by: Sasha Levin --- drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index 59415a84cff71..42d2854939ba8 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -593,6 +593,11 @@ static int panfrost_probe(struct platform_device *pdev) goto err_out0; } + /* The reason we must manually set the PM status and usage counter is + * we have just powered the device up but did not go through the PM + * runtime resume callback, so we need to update these ourselves. + */ + pm_runtime_get_noresume(pfdev->dev); pm_runtime_set_active(pfdev->dev); pm_runtime_mark_last_busy(pfdev->dev); pm_runtime_enable(pfdev->dev); @@ -609,12 +614,16 @@ static int panfrost_probe(struct platform_device *pdev) panfrost_gem_shrinker_init(ddev); + pm_runtime_put_autosuspend(pfdev->dev); + return 0; err_out1: + pm_runtime_dont_use_autosuspend(pfdev->dev); pm_runtime_disable(pfdev->dev); panfrost_device_fini(pfdev); pm_runtime_set_suspended(pfdev->dev); + pm_runtime_put_noidle(pfdev->dev); err_out0: drm_dev_put(ddev); return err; @@ -629,9 +638,11 @@ static int panfrost_remove(struct platform_device *pdev) panfrost_gem_shrinker_cleanup(ddev); pm_runtime_get_sync(pfdev->dev); + pm_runtime_dont_use_autosuspend(pfdev->dev); pm_runtime_disable(pfdev->dev); panfrost_device_fini(pfdev); pm_runtime_set_suspended(pfdev->dev); + pm_runtime_put_noidle(pfdev->dev); drm_dev_put(ddev); return 0; -- 2.53.0