From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44C9ACD6E75 for ; Thu, 4 Jun 2026 18:36:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 576B111A1DF; Thu, 4 Jun 2026 18:36:40 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="D/UXNPOc"; dkim-atps=neutral Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id DEEA511A1DF for ; Thu, 4 Jun 2026 18:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1780598197; bh=J2tMmpfpffjYHUKqd22jmHnuknxxEYkkDIfg3tN9Mqk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=D/UXNPOcx7I+GKpsDZ/xAz+Lgd+PDfBo9R0hc/LTzyZpe4z8jr7Wua1Q/tRcjklJE ZFu4gi7ABj5u/TdOsxsBnl3gNmc1dzv4He73X5xHMmBYtoaXEV7hkUXQmhPeJYiUXV yes2FuDrn6CL1dxzczSSCNt5jcdpMJoRVbY72fzTlhpvd9MP9oIo3djUy6O2tRHARC uOPjVVwMrcvlFuEbvC5RKdO32/wGXOJj5PbQr/FV5Yp1rkgX3Ch2dGLXV8eVY+pO7+ JsP2OFhp5FOrOUzq8UKHsE5UtnL3hFfKmchTpnSoAL5FC33jsGgPJ1Caux2mf8kLUW VIG6ooj8mjotQ== Received: from fedora-2.home (unknown [100.64.0.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 82B9017E02C2; Thu, 4 Jun 2026 20:36:36 +0200 (CEST) Date: Thu, 4 Jun 2026 20:36:31 +0200 From: Boris Brezillon To: =?UTF-8?B?QWRyacOhbg==?= Larumbe Cc: Rob Herring , Steven Price , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Faith Ekstrand , "Marty E. Plummer" , Tomeu Vizoso , Eric Anholt , Alyssa Rosenzweig , Robin Murphy , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Collabora Kernel Team , Neil Armstrong Subject: Re: [PATCH v2 6/7] drm/panfrost: Fix PM usage_count mishandling Message-ID: <20260604203631.20e76f5f@fedora-2.home> In-Reply-To: <20260604-claude-fixes-v2-6-57c6bd4c1655@collabora.com> References: <20260604-claude-fixes-v2-0-57c6bd4c1655@collabora.com> <20260604-claude-fixes-v2-6-57c6bd4c1655@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Thu, 04 Jun 2026 18:35:25 +0100 Adri=C3=A1n Larumbe wrote: > 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. >=20 > 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. >=20 > The combined outcome of both of the above was 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. >=20 > Even direr than that was the fact MMU interrupts are only enabled when > the device is reset, so after device probe() the very first job targeting > the tiler heap BO would always time out, because the driver's PM runtime > resume callback would not be invoked. >=20 > Signed-off-by: Adri=C3=A1n Larumbe > Fixes: 635430797d3f ("drm/panfrost: Rework runtime PM initialization") > Fixes: 876b15d2c88d ("drm/panfrost: Fix module unload") > --- > drivers/gpu/drm/panfrost/panfrost_drv.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/pa= nfrost/panfrost_drv.c > index 2d4b6aa95c66..545fbf2c8d0c 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_drv.c > +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c > @@ -989,6 +989,7 @@ static int panfrost_probe(struct platform_device *pde= v) > pm_runtime_set_active(pfdev->base.dev); > pm_runtime_mark_last_busy(pfdev->base.dev); > pm_runtime_enable(pfdev->base.dev); > + pm_runtime_get_noresume(pfdev->base.dev); > pm_runtime_set_autosuspend_delay(pfdev->base.dev, 50); /* ~3 frames */ > pm_runtime_use_autosuspend(pfdev->base.dev); > =20 > @@ -1000,10 +1001,12 @@ static int panfrost_probe(struct platform_device = *pdev) > if (err < 0) > goto err_out1; > =20 > + pm_runtime_put_autosuspend(pfdev->base.dev); > =20 > return 0; > =20 > err_out1: > + pm_runtime_put_noidle(pfdev->base.dev); Do we really need this get_noresume/put_noidle dance, can't use call pm_runtime_dont_use_autosuspend() instead like is done in panthor, or is panthor broken too? > pm_runtime_disable(pfdev->base.dev); > panfrost_device_fini(pfdev); > pm_runtime_set_suspended(pfdev->base.dev); > @@ -1018,8 +1021,9 @@ static void panfrost_remove(struct platform_device = *pdev) > drm_dev_unregister(&pfdev->base); > =20 > pm_runtime_get_sync(pfdev->base.dev); > - pm_runtime_disable(pfdev->base.dev); > panfrost_device_fini(pfdev); > + pm_runtime_put_noidle(pfdev->base.dev); > + pm_runtime_disable(pfdev->base.dev); > pm_runtime_set_suspended(pfdev->base.dev); > } > =20 >=20