From: sashiko-bot@kernel.org
To: "Rob Clark" <robin.clark@oss.qualcomm.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [RFT PATCH v2] drm/msm: Fix separate_gpu_kms for multi-gpu
Date: Thu, 03 Dec 2026 22:48:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-248755@kernel.org> (raw)
In-Reply-To: <20261203222900.28311-1-robin.clark@oss.qualcomm.com>
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 <robin.clark@oss.qualcomm.com>
> 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 <robin.clark@oss.qualcomm.com>
[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;
>
> - if (!msm_separate_gpu_kms_components())
> + if (!msm_separate_gpu_kms_components(&pdev->dev, true))
> return component_add(&pdev->dev, &a3xx_ops);
>
> 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() == 0 guard removed, gpu_idx > num_disp is false
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 [KMS] (1=on (default), 0=disab
> module_param(modeset, bool, 0600);
>
> /*
> - * separate_gpu_kms (tristate):
> - * -1 (default): decide automatically based on hardware topology. Split devices
> - * if there is more than one GPU or more than one display 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 devices
> + * are #'d, with the n'th gpu being paired off with the n'th display, until
> + * we run out of gpu or display devices at which point any remaining devices
> + * are stand-alone (ie. either gpu-only or display-only).
> */
> -static int separate_gpu_kms = -1;
> +static bool separate_gpu_kms = 0;
> MODULE_PARM_DESC(separate_gpu_kms,
> - "Use separate DRM device for the GPU (-1=auto (default), 0=single DRM device, 1=separate DRM devices)");
> -module_param(separate_gpu_kms, int, 0400);
> + "Use separate DRM device for the GPU (0=single DRM device per pair of GPU+DPU, 1=separate 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 = 0 initializer.
[ ... ]
> + if (is_gpu) {
> + int gpu_idx = msm_count_gpus(dev->of_node);
> + int num_disp = 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 = msm_count_gpus(NULL);
> + int disp_idx = 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 != msm_count_gpus(np))
> + continue;
> + ret = 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 == 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.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203222900.28311-1-robin.clark@oss.qualcomm.com?part=1
prev parent reply other threads:[~2026-12-03 22:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 22:28 [RFT PATCH v2] drm/msm: Fix separate_gpu_kms for multi-gpu Rob Clark
2026-12-03 22:48 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-248755@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.