From: sashiko-bot@kernel.org
To: "Xiao Lu" <xiaolu.xie@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3 2/2] drm/dp_mst: Track allocated_pbn from ALLOCATE_PAYLOAD down-reply
Date: Thu, 24 Sep 2026 09:57:57 +0000 [thread overview]
Message-ID: <20260924095758.50C261F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260924094316.822211-3-xiaolu.xie@intel.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] drm/dp_mst: data race on allocated_pbn can bypass bandwidth limits
- [Medium] drm/dp_mst: bandwidth check fails on shrinking payloads due to stale allocated_pbn
--
commit d52065aed1fa389dfd394c9d3cae48a882973e04
Author: Xiao Lu <xiaolu.xie@intel.com>
drm/dp_mst: Track allocated_pbn from ALLOCATE_PAYLOAD down-reply
This commit stores the reported PBN from an ALLOCATE_PAYLOAD reply. It uses
the larger of the requested and allocated PBN for bandwidth checks to account
for constraints applied by intermediate branches along the path.
> diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
> index 7ce9e212770ad..86a42c5e2debb 100644
> --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
[ ... ]
> @@ -3166,10 +3167,14 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
> */
> ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
> if (ret > 0) {
> - if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
> + if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK) {
> ret = -EINVAL;
> - else
> + } else {
> + if (payload)
> + payload->allocated_pbn =
> + txmsg->reply.u.allocate_payload.allocated_pbn;
[Severity: High]
Can this lockless write to payload->allocated_pbn race with an atomic check?
If a non-blocking atomic commit is executing asynchronously, it receives the
ALLOCATE_PAYLOAD reply and drm_dp_payload_send_msg() updates allocated_pbn
without locks. Concurrently, if userspace initiates a new atomic check,
drm_dp_mst_duplicate_state() will copy the payload struct via kmemdup().
Could this result in the atomic check reading a torn or stale value when
evaluating max(payload->pbn, payload->allocated_pbn) in
drm_dp_mst_atomic_check_port_bw_limit(), potentially bypassing bandwidth
constraints?
> ret = 0;
> + }
> }
> kfree(txmsg);
> fail_put:
[ ... ]
> @@ -4575,6 +4580,7 @@ int drm_dp_atomic_release_time_slots(struct drm_atomic_commit *state,
> drm_dbg_atomic(mgr->dev, "[MST PORT:%p] TU %d -> 0\n", port, payload->time_slots);
> if (!payload->delete) {
> payload->pbn = 0;
> + payload->allocated_pbn = 0;
[Severity: Medium]
Does this properly handle payloads that shrink in size?
Since payload->allocated_pbn is only cleared here when releasing the payload
entirely (during a full deletion), what happens if a commit simply shrinks an
existing payload (for example, switching to a smaller display mode on the
same CRTC)?
In that scenario, drm_dp_atomic_release_time_slots() skips active CRTCs,
meaning allocated_pbn remains at its old, larger value. When the new
bandwidth is checked, max(payload->pbn, payload->allocated_pbn) in
drm_dp_mst_atomic_check_port_bw_limit() would yield the old larger value,
which could falsely prevent the freed bandwidth from being reallocated to
other displays.
> payload->delete = true;
> if (payload->vcpi > 0)
> topology_state->payload_mask &= ~BIT(payload->vcpi - 1);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260924094316.822211-1-xiaolu.xie@intel.com?part=2
prev parent reply other threads:[~2026-09-24 9:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 9:26 [PATCH v2 0/2] drm/dp/mst: fix MST payload PBN accounting Xiao Lu
2026-09-22 9:26 ` [PATCH v2 1/2] drm/i915/dp: fix PBN in ALLOCATE_PAYLOAD request to use actual video bandwidth Xiao Lu
2026-09-22 9:35 ` sashiko-bot
2026-09-22 9:26 ` [PATCH v2 2/2] drm/dp_mst: Track allocated_pbn from ALLOCATE_PAYLOAD down-reply Xiao Lu
2026-09-22 9:41 ` sashiko-bot
2026-09-22 9:35 ` [PATCH v2 0/2] drm/dp/mst: fix MST payload PBN accounting Jani Nikula
2026-09-22 9:39 ` ✗ CI.checkpatch: warning for " Patchwork
2026-09-22 9:41 ` ✓ CI.KUnit: success " Patchwork
2026-09-22 11:42 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-22 12:30 ` ✓ i915.CI.BAT: " Patchwork
2026-09-22 19:39 ` ✓ Xe.CI.FULL: " Patchwork
2026-09-22 23:22 ` ✗ i915.CI.Full: failure " Patchwork
2026-09-24 9:43 ` [PATCH v3 0/2] drm/i915/dp: Fix MST " Xiao Lu
2026-09-24 9:43 ` [PATCH v3 1/2] drm/i915/dp: fix PBN in ALLOCATE_PAYLOAD request to use actual video bandwidth Xiao Lu
2026-09-24 9:51 ` sashiko-bot
2026-09-24 9:43 ` [PATCH v3 2/2] drm/dp_mst: Track allocated_pbn from ALLOCATE_PAYLOAD down-reply Xiao Lu
2026-09-24 9:57 ` 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=20260924095758.50C261F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=xiaolu.xie@intel.com \
/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.