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 21D2B606A322 for ; Thu, 3 Dec 2026 22:48:50 +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=ZIGQl0by Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 846CD112C61; Thu, 3 Dec 2026 22:48:44 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id ABD93112C43 for ; Thu, 3 Dec 2026 22:48:37 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 01BA5447BC; Thu, 3 Dec 2026 22:48:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6A831F000C2; Thu, 3 Dec 2026 22:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796338116; bh=TnO/Mr3xex2O+mrn6xdqt8xlBlyc+BSVVkc/v286OUk=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=ZIGQl0byCGApMko5RJFNvJ7nko66SmZbkHAUDPuj4706OnK9AAGDq3EwGAyVSCjlS w8xBQ77cQxi/CC9/FjE2AunY/LRKDDaf5tMIC54L4Q34l5enHv0iyPMS8MW6Q6tYBp Ql567DE+eOmWPvG5eoc8sNiPb931524KTc9wle9fWy/J977N+aLHpFfpN9CsCyO2n+ QF4GF5EFtH2wHC13helNmJph/iE4Dp/bE0VVCxJYm6yihL/W4nIwHjP65LB7cJnmem T+MAg/iDHqAMvO6+qai2QQ39jd23yylrXjGGyAABU4RQU7cetj1f6UWXE0322P3ifE wZixktkPpV5Dg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [RFT PATCH v2] drm/msm: Fix separate_gpu_kms for multi-gpu To: "Rob Clark" , dri-devel@lists.freedesktop.org In-Reply-To: <20261203222900.28311-1-robin.clark@oss.qualcomm.com> References: <20261203222900.28311-1-robin.clark@oss.qualcomm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 22:48:36 +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=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,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 6 potential issues to consider: - [Medium] drm/msm: spurious GPU matches and missing break in msm_drv_probe() - [Medium] drm/msm: msm_count_gpus() miss lets adreno_probe() bind unrecognized GPUs - [Low] drm/msm: leftover pr_err() debug logging in msm_drv.c - [Low] drm/msm: missing of_node_put() on error return in msm_drv_probe() - [Low] drm/msm: undocumented revert of separate_gpu_kms from tristate int to bool - [Low] drm/msm: missing Fixes trailer for cf27afc3bd6e -- commit 822067c1eca76ec23892df78b025e01b4a98f7fc Author: Rob Clark > drm/msm: Fix separate_gpu_kms for multi-gpu > > The auto mode was falling back to separate devices if the # of GPUs > or # of displays was greater than 1. Rework this so that we pair > up displays and GPUs until we run out of one or the other, and then > create standalone devices for anything remaining. > > Signed-off-by: Rob Clark [Severity: Low] This fixes the auto-selection logic introduced by commit cf27afc3bd6e ("drm/msm: default separate_gpu_kms to auto selection"). Should it include: Fixes: cf27afc3bd6e ("drm/msm: default separate_gpu_kms to auto selection= ") > diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm= /msm/adreno/adreno_device.c > index eb96a2b35518b..64b9824011287 100644 > --- a/drivers/gpu/drm/msm/adreno/adreno_device.c > +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c > @@ -270,7 +270,7 @@ static int adreno_probe(struct platform_device *pdev) > { > int ret; > =20 > - if (!msm_separate_gpu_kms_components()) > + if (!msm_separate_gpu_kms_components(&pdev->dev, true)) > return component_add(&pdev->dev, &a3xx_ops); > =20 > if (!adreno_has_gpu(pdev->dev.of_node)) [Severity: Medium] Can adreno_probe() now bind an unrecognized GPU instead of returning -ENODEV? When an enabled GPU node fails adreno_has_gpu() (such as an unknown chip ID), msm_count_gpus(dev->of_node) skips it and falls through to return the total count of other recognized GPUs (0 on a single-GPU SoC). With the previous msm_count_gpus() =3D=3D 0 guard removed, gpu_idx > num_disp is fal= se whenever that count is at most num_disp, so adreno_probe() returns component_add() with 0 and registers an orphaned component. Checking adreno_has_gpu() before msm_separate_gpu_kms_components() in adreno_probe() avoids binding unrecognized GPUs, and returning 0 when a non-NULL target_np is not found in msm_count_gpus(), msm_count_mdp4(), and msm_count_mdss() avoids returning the total count on a lookup miss. [ ... ] > diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c > index cd59daa02bf94..f7a0d43cd06b1 100644 > --- a/drivers/gpu/drm/msm/msm_drv.c > +++ b/drivers/gpu/drm/msm/msm_drv.c > @@ -56,16 +56,15 @@ MODULE_PARM_DESC(modeset, "Use kernel modesetting [KM= S] (1=3Don (default), 0=3Ddisab > module_param(modeset, bool, 0600); > =20 > /* > - * separate_gpu_kms (tristate): > - * -1 (default): decide automatically based on hardware topology. Spli= t devices > - * if there is more than one GPU or more than one displa= y master. > - * 0: force single DRM device (bind display + GPU) > - * 1: force separate DRM devices > + * When not using separate gpu and kms devices, the display and gpu devi= ces > + * are #'d, with the n'th gpu being paired off with the n'th display, un= til > + * we run out of gpu or display devices at which point any remaining dev= ices > + * are stand-alone (ie. either gpu-only or display-only). > */ > -static int separate_gpu_kms =3D -1; > +static bool separate_gpu_kms =3D 0; > MODULE_PARM_DESC(separate_gpu_kms, > - "Use separate DRM device for the GPU (-1=3Dauto (default), 0=3Dsingle= DRM device, 1=3Dseparate DRM devices)"); > -module_param(separate_gpu_kms, int, 0400); > + "Use separate DRM device for the GPU (0=3Dsingle DRM device per pair = of GPU+DPU, 1=3Dseparate DRM devices)"); > +module_param(separate_gpu_kms, bool, 0400); [Severity: Low] Should the commit message explain changing separate_gpu_kms back from a tristate int to a bool and removing the -1 value? This also shifts multi-display single-GPU systems from separate devices to one combined GPU+display device plus standalone display-only devices. Also, static bool separate_gpu_kms does not need the explicit =3D 0 initializer. [ ... ] > + if (is_gpu) { > + int gpu_idx =3D msm_count_gpus(dev->of_node); > + int num_disp =3D msm_count_mdp4(NULL) + msm_count_mdss(NULL); > + > + pr_err("%s: gpu: %u > %u\n", __func__, gpu_idx, num_disp); > + > + return gpu_idx > num_disp; > + } else { > + int num_gpu =3D msm_count_gpus(NULL); > + int disp_idx =3D msm_display_idx(dev); > + > + pr_err("%s: display: %u > %u\n", __func__, disp_idx, num_gpu); > + > + return disp_idx > num_gpu; > } [Severity: Low] Are these pr_err() calls (and the pr_err() in msm_drv_probe()) leftover debug prints? They log at KERN_ERR on every normal probe, bind, and remove, format signed int values with %u, and the one in msm_drv_probe() uses of_node_full_name() instead of %pOF. [ ... ] > + /* If we are the display, try adding the matching gpu: */ > + for_each_matching_node (np, msm_gpu_match) { > + if (disp_idx !=3D msm_count_gpus(np)) > + continue; > + ret =3D add_gpu_components(master_dev, np, &match); > + if (ret) > + return ret; [Severity: Low] Does this early return leak the reference on np held by for_each_matching_node()? add_gpu_components() currently always returns 0, so the leak is latent, but it should call of_node_put(np) before returning. > + pr_err("%s: matched: %s + %s\n", __func__, > + of_node_full_name(master_dev->of_node), > + of_node_full_name(np)); > + } [Severity: Medium] Can this loop spuriously match disabled or unsupported GPU nodes? When np is disabled or rejected by adreno_has_gpu(), msm_count_gpus(np) falls through and returns the total number of present GPUs. For the display whose disp_idx equals that total, disp_idx =3D=3D msm_count_gpus(np) matches every disabled or unsupported GPU node (add_gpu_components() currently turns it into a no-op because it re-checks msm_gpu_node_present(), but the loop still logs a bogus match). In addition, the loop never breaks after finding the matching GPU, causing nested DT walks and repeated adreno_has_gpu() checks, and the same unmatched-returns-total behavior in msm_count_mdp4() and msm_count_mdss() affects msm_display_idx(). A single-pass loop that skips !msm_gpu_node_present(np), increments a local index, and breaks with of_node_put(np) once it matches disp_idx would avoid these issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203222900.2831= 1-1-robin.clark@oss.qualcomm.com?part=3D1