From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 7C9D5606A31C for ; Sun, 29 Nov 2026 14:00:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GIhGMmZ5 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D671310E10A; Sun, 29 Nov 2026 14:00:22 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8C79910E10A for ; Sun, 29 Nov 2026 14:00:16 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 58E58417BD; Sun, 29 Nov 2026 14:00:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 275A61F000C1; Sun, 29 Nov 2026 14:00:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795960816; bh=+MVZ41GpyEC7XA/IW6en9W2+VdqjNVN1oG4TsmkAq4E=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=GIhGMmZ5UpIjDbT0QfAL8BekB1p/STI/ELiHG6T4HaXIv9/OKXY7rNxz0tKCa3lyH 6vIi6CVuwf8fmpgKRqRHCeX2rdfZeC3X1vkDdxxPPFOO8aZeuRN1qy3zlSLbG2zAq0 pUumBupj9ZjhQiGj/F8nYMiVsgpKpk5tveCpftme9Ym1J3CU9TndPYmPy7hOeD1aYv Nx0GOKIrCzjJTyt2um5Js08Ow9kcX5lYEW/w8nulQvoUdJmHEDVcD7IDlRxrj76yd6 It4+4bei8XqYC+8vp+GtIwUkM/A9eHYqERWVqrWOvy08lDtT+pDlcmBStZVLXOMRnc N5jt9c/pAnUkg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] drm/tegra: nvjpg: fix runtime PM setup in probe To: "Jiawen Liu" <1298662399@qq.com> Cc: dri-devel@lists.freedesktop.org In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Nov 2026 14:00:15 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-Archived-By: Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] drm/tegra: nvjpg: double runtime PM disable across nvjpg_exit() and nvjpg_remove() - [Medium] drm/tegra: nvjpg: pm_runtime_enable() called after host1x_client_register() in nvjpg_probe() - [Medium] drm/tegra: nvjpg: runtime PM disabled after falcon_exit() in nvjpg_remove() -- commit 38180484ce9eb95d6bcaa5e7c4e2dae6f0f9c4fd Author: Jiawen Liu <1298662399@qq.com> drm/tegra: nvjpg: fix runtime PM setup in probe This commit replaces devm_pm_runtime_enable() with pm_runtime_enable() in nvjpg_probe() and adds runtime PM cleanup to nvjpg_remove(). > diff --git a/drivers/gpu/drm/tegra/nvjpg.c b/drivers/gpu/drm/tegra/nvjpg.c > index e302a8d1f6e7f..0b6a8467f5183 100644 > --- a/drivers/gpu/drm/tegra/nvjpg.c > +++ b/drivers/gpu/drm/tegra/nvjpg.c > @@ -292,7 +292,7 @@ static int nvjpg_probe(struct platform_device *pdev) > =20 > pm_runtime_use_autosuspend(dev); > pm_runtime_set_autosuspend_delay(dev, 500); > - devm_pm_runtime_enable(dev); > + pm_runtime_enable(dev); [Severity: Medium] Should pm_runtime_enable() be called before host1x_client_register() (and disabled on registration failure), as in gr2d_probe() and gr3d_probe()? Because tegra_nvjpg_driver is the last entry in drivers[], calling host1x_client_register() as the final Host1x subdevice synchronously runs host1x_drm_probe() -> nvjpg_init() -> drm_dev_register() before host1x_client_register() returns. Channel submissions to NVJPG during that window hit pm_runtime_resume_and_get() while runtime PM is still disabled and fail with -EACCES. Also, if host1x_drm_probe() fails after host1x_device_init(), its error path runs host1x_device_exit() -> nvjpg_exit() -> pm_runtime_force_suspend() -> pm_runtime_disable(), incrementing dev->power.disable_depth from 1 to 2 so that pm_runtime_enable() here leaves runtime PM disabled. > =20 > return 0; > =20 > @@ -308,6 +308,8 @@ static void nvjpg_remove(struct platform_device *pdev) > =20 > host1x_client_unregister(&nvjpg->client.base); > falcon_exit(&nvjpg->falcon); > + pm_runtime_dont_use_autosuspend(&pdev->dev); > + pm_runtime_disable(&pdev->dev); [Severity: Medium] Does calling pm_runtime_disable() here after host1x_client_unregister() disable runtime PM twice? When the composite Host1x device is active, host1x_client_unregister() calls host1x_device_exit() -> nvjpg_exit(), which already runs: drivers/gpu/drm/tegra/nvjpg.c:nvjpg_exit() { ... pm_runtime_dont_use_autosuspend(client->dev); pm_runtime_force_suspend(client->dev); ... } pm_runtime_force_suspend() calls pm_runtime_disable() and leaves dev->power.disable_depth at 1, so the second pm_runtime_disable() in nvjpg_remove() increments disable_depth to 2 for a single pm_runtime_enable() in nvjpg_probe(). Because pm_runtime_reinit() does not reset disable_depth on unbind, a subsequent re-probe only decrements disable_depth from 2 to 1, leaving runtime PM disabled and causing all NVJPG submissions to fail with -EACCES. As in ace01e2af387 ("drm/tegra: gr2d/gr3d: Contain PM in the gr*d_probe/gr*d_remove"), runtime PM enable and disable should be contained in probe and remove rather than mixed with pm_runtime_force_suspend() in nvjpg_exit(). [Severity: Medium] Should pm_runtime_dont_use_autosuspend() and pm_runtime_disable() also run before falcon_exit(), matching vic_remove() and nvdec_remove()? __device_release_driver() calls pm_runtime_get_sync() and pm_runtime_put_sync() right before nvjpg_remove(), which leaves the device RPM_ACTIVE while the 500 ms autosuspend timer is pending. When nvjpg_exit() has not force-suspended the device, falcon_exit() tears down the Falcon firmware while runtime PM is still active, and pm_runtime_dont_use_autosuspend() can then trigger nvjpg_runtime_suspend() after falcon_exit() has already run. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/tencent_A7D12B6489A= E96132560FAEF56E5517D5106@qq.com?part=3D1