From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67FF3606A323 for ; Mon, 16 Nov 2026 15:31:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Xbe3j8tT; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.a=rsa-sha256 header.s=mail header.b=u5NEm9uP DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=WvVxjhDr6PH1YQhTnL5bLmhdjGqsDenf5T3+Em4JVrw=; b=Xbe3j8tTzLe4kBWTyygF9ZI+kd k72rLqReaOElRj75nkV5vub/S0Aj4TbV26ssndfPdnjbGmNBBlLqiFQLHQqHzUHvct5NNjbzRRWYk indZnMqLjkz8U+sgHuF+gTFs1A3Z0njsOmvyv8riyVyVR6+IArK2nKGld6AjP+BstGJjCN2lolW5u iwqp5pR45hHRPsySuF6sVkr0/+N/kdozsHOgSpVfxBdVp+xeWIAKFtx/7XJOX9WWb4TQVRYl7LYZh no24mzZQ9ETu4x+BmhpOkd3RrDaSXSxXWRroFRO8/DTUeJES4AIHmcYCCm5pTswQ+fakwBEQ4EEdz rC+FhPiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xSygP-000000034u6-1jY3; Mon, 16 Nov 2026 15:31:49 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xSygK-000000034rS-1G07; Mon, 16 Nov 2026 15:31:48 +0000 Received: from killaraus.ideasonboard.com (2001-14ba-7086-3000--a06.rev.dnainternet.fi [IPv6:2001:14ba:7086:3000::a06]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CBD0B4BB; Mon, 16 Nov 2026 16:29:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1794842954; bh=mEdGgykLNB2Omw7cxl+sjvA+5dUdNlstZtzg025H4SM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=u5NEm9uPXYzEZpITU3vAG6PWDU+yJ/ZUR9lwtykQcZvUmia4ANO5bLGKFNdRerkqp wRbNWdsoUXMzU2lYUA4UIaS+ONcqlmgU/Cjc1gQn6ZqOuR9AdSHt0aepGReo/J6+3L Ol/mw3pEjmM1ctFcVrGxmj1JeKN+Kd2CdQXuP+hw= Date: Mon, 16 Nov 2026 17:31:39 +0200 From: Laurent Pinchart To: Frank.Li@oss.nxp.com Cc: Frank Li , "Rafael J. Wysocki" , linux-pm@vger.kernel.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Maarten Lankhorst , Maxime Ripard , Thomas Hellstrom , Simona Vetter , David Airlie , Matthew Brost , Thomas Zimmermann , Patrik Jakobsson , Alessio Belle , Luigi Santivetti , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Bard Liao , Pierre-Louis Bossart , Peter Ujfalusi , Kai Vehmanen , Robin Murphy , Yong Wu , AngeloGioacchino Del Regno , Matthias Brugger , Heiko Stuebner , Mauro Carvalho Chehab , Dafna Hirschfeld , Michael Tretter , Daniel Baluta , Will Deacon , Vijendar Mukunda , dri-devel@lists.freedesktop.org, imagination@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-sound@vger.kernel.org, sound-open-firmware@alsa-project.org, imx@lists.linux.dev Subject: Re: [PATCH v2 2/2] PM: runtime: fix stub pm_runtime_get_if_in_use() for !CONFIG_PM Message-ID: <20261116153139.GB1763944@killaraus.ideasonboard.com> References: <20261116152513.2676573-1-Frank.Li@oss.nxp.com> <20261116152513.2676573-2-Frank.Li@oss.nxp.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20261116152513.2676573-2-Frank.Li@oss.nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261116_073144_487079_E9BADE08 X-CRM114-Status: GOOD ( 32.01 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hi Frank, On Mon, Nov 16, 2026 at 10:25:11AM -0500, Frank.Li@oss.nxp.com wrote: > From: Frank Li > > The stub for pm_runtime_get_if_in_use() under !CONFIG_PM currently > returns -EINVAL. The real implementation returns: > 1 - device is active and its usage counter is non-zero (bumped) > 0 - device is not in use or not active (counter not bumped) > -EINVAL - runtime PM disabled for this device > > When CONFIG_PM is not set every device is permanently "active" and > always considered "in use", so the stub must return 1, mirroring > __pm_runtime_resume() which already returns 1 in the same build. > > Returning -EINVAL breaks callers that test the return value with > comparisons other than "!= 0 / == 0": > > drivers/gpu/drm/i915/intel_runtime_pm.c: > if (intel_runtime_pm_get_if_in_use(rpm)) > which wraps to: ret = pm_runtime_get_if_in_use(); return ret > 0; > With -EINVAL the wrapper returns false, causing an incorrect error > path in the GT fence revocation code. > > drivers/gpu/drm/xe/xe_pm.c: > if (pm_runtime_get_if_in_use(xe->drm.dev) > 0) > With -EINVAL the condition is false; xe_pm_runtime_get_if_in_use() > returns false, so callers believe the device is not usable. > > drivers/gpu/drm/gma500/power.c: > return pm_runtime_get_if_in_use(dev) == 1; > -EINVAL != 1, so the helper always returns false when !CONFIG_PM. > > drivers/gpu/drm/imagination/pvr_power.c: > if (pm_runtime_get_if_in_use(...) <= 0) > -EINVAL <= 0 is true, so the driver always takes the "requeue" error > path instead of proceeding with the active device. > > sound/soc/sof/debug.c: > if (pm_runtime_get_if_in_use(sdev->dev) == 1) > -EINVAL != 1, so d3_prevented is never set, corrupting exception > debug accounting. > > drivers/iommu/mtk_iommu.c: > if (pm_runtime_get_if_in_use(dom->plat_dev->dev) <= 0) > -EINVAL <= 0 skips the TLB flush, leaving stale IOMMU mappings. > > drivers/iommu/rockchip-iommu.c: > Three call sites use WARN_ON_ONCE(err < 0) or similar patterns. > -EINVAL < 0 triggers a spurious WARNING on every call. > > drivers/media/i2c/isl7998x.c: > if (pm_runtime_get_if_in_use(dev) <= 0) (two call sites) > -EINVAL <= 0 causes the driver to always skip register programming > when !CONFIG_PM. > > drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c: > if (pm_runtime_get_if_in_use(dev) <= 0) (two call sites) > -EINVAL <= 0 prevents any debug statistics from being collected. > > Fixes: 9d58aa46291d ("drm/i915: Fix the GT fence revocation runtime PM logic") > Fixes: cbb6a7413b17 ("drm/xe: Introduce xe_pm_runtime_get_noresume for inner callers") > Fixes: 672c473576ca ("drm/gma500: Rewrite power management code") > Fixes: 727538a4bbff ("drm/imagination: Implement power management") > Fixes: b30289e7fa92 ("ASoC: SOF: Fix runtime pm usage counter balance after fw exception") > Fixes: c0b57581b73b ("iommu/mediatek: Add power-domain operation") > Fixes: 0f181d3cf7d9 ("iommu/rockchip: Add runtime PM support") > Fixes: 51ef2be546e2 ("media: i2c: isl7998x: Add driver for Intersil ISL7998x") > Fixes: cbb819c363c5 ("media: rkisp1: debug: Collect input status by sampling ISP_FLAGS_SHD") I don't think this one is right. The rkisp1 driver only runs on ARCH_MXC and ARCH_ROCKCHIP, which select CONFIG_PM. The same may be true for some of the other fixes tags. > Signed-off-by: Frank Li > --- > Change in v2 > - new patches. > > Cc: "Rafael J. Wysocki" > Cc: linux-pm@vger.kernel.org > Cc: Jani Nikula > Cc: Joonas Lahtinen > Cc: Rodrigo Vivi > Cc: Tvrtko Ursulin > Cc: Maarten Lankhorst > Cc: Maxime Ripard > Cc: "Thomas Hellstrom" > Cc: Simona Vetter > Cc: David Airlie > Cc: Matthew Brost > Cc: Thomas Zimmermann > Cc: Patrik Jakobsson > Cc: Alessio Belle > Cc: Luigi Santivetti > Cc: Liam Girdwood > Cc: Mark Brown > Cc: Jaroslav Kysela > Cc: Takashi Iwai > Cc: Bard Liao > Cc: Pierre-Louis Bossart > Cc: Peter Ujfalusi > Cc: Kai Vehmanen > Cc: Robin Murphy > Cc: Yong Wu > Cc: AngeloGioacchino Del Regno > Cc: Matthias Brugger > Cc: Heiko Stuebner > Cc: Mauro Carvalho Chehab > Cc: Dafna Hirschfeld > Cc: Laurent Pinchart > Cc: Michael Tretter > Cc: Daniel Baluta > Cc: Will Deacon > Cc: Vijendar Mukunda > Cc: dri-devel@lists.freedesktop.org > Cc: imagination@lists.freedesktop.org > Cc: intel-gfx@lists.freedesktop.org > Cc: intel-xe@lists.freedesktop.org > Cc: iommu@lists.linux.dev > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-mediatek@lists.infradead.org > Cc: linux-media@vger.kernel.org > Cc: linux-rockchip@lists.infradead.org > Cc: linux-sound@vger.kernel.org > Cc: sound-open-firmware@alsa-project.org > Cc: imx@lists.linux.dev > --- > include/linux/pm_runtime.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h > index de9e7518ecef2..1d983fe55a16a 100644 > --- a/include/linux/pm_runtime.h > +++ b/include/linux/pm_runtime.h > @@ -276,7 +276,7 @@ static inline int pm_schedule_suspend(struct device *dev, unsigned int delay) > } > static inline int pm_runtime_get_if_in_use(struct device *dev) > { > - return -EINVAL; > + return 1; > } > static inline int pm_runtime_get_if_active(struct device *dev) > { -- Regards, Laurent Pinchart