Repository navigation
drm/apple: isolate Type-C reconnect request budgets; cover two topology mutants - #3530
RyanTheTide wants to merge 2 commits into
Conversation
A reconnect worker can fail after another caller has queued a new request for the same fabric session, or for a sessionless output. Its failure then consumes the new request's retry budget and can replace that request's deadline with the old worker's retry delay. Resetting the counter under hpd_mutex alone does not distinguish these requests. Give each queued request a generation and a fresh budget under hpd_mutex. Snapshot that generation before connecting, and account for a failure or re-arm a retry only while it still owns the request. If a replacement is already pending when an old worker starts, leave it for the queued invocation. Retries continue to re-arm directly, without creating a new request or replenishing their own budget. Centralize the counter reset in the enqueue helper and remove callers' resets, including the unlocked resets in the display fabric. Successful connects still return immediately with the same transport calls; their counter needs no reset because each new request initializes it. Add host regressions using the actual enqueue and worker functions for same-session and sessionless overlaps, pending replacements, exhausted budgets and successful connects with the existing retry limits. Fixes: 9fd048b ("drm: apple: recover Type-C displays across link interruptions") Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Give the 10-bit candidate an H17G method profile so the test rejects treating every non-default profile as RGB8-only. Also put the native26 candidate first in a pipeline array to catch iteration that skips index zero. Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
There was a problem hiding this comment.
Verdict: FINISH, then merge at 2b2b96b8
Blockers:
- Hosted CI at
2b2b96b8(21 jobs:apple-build,host-tests,kunit,pr-text,readiness, KUnit suites) is currentlyQUEUED; wait for green CI. - Missing exact-head hardware row (J700 s2idle reconnect + external-display unplug/replug cycles plus one regression Mac; noted as queued in
Not yet:).
Checked: no Apple material, no AI attribution, human DCO Signed-off-by on both commits, no chip/board/firmware gates, no parameters or hardcoded safety limits, full diff (+186/-20 across 6 files) verified, typec_reconnect_generation and typec_reconnect_tries are consistently guarded by hpd_mutex without holding hpd_mutex across dcp_dptx_connect*() calls, dcp_typec_reconnect_work() bails early on delayed_work_pending() and checks generation != dcp->typec_reconnect_generation before consuming budget or re-arming retries, dcp-fabric-topology-test.c covers ext26_first (index 0) and non-default 10-bit profile (DCP_IOMFB_METHODS_H17G), host lifecycle suite (36/36 ASan/UBSan) + KUnit (7/7) + arm64 LLVM W=1 + checkpatch --strict clean, PR body has Tested: and Risk: two-way, branch is MERGEABLE against main.
Evidence
drivers/gpu/drm/apple/dcp.c,dcp-fabric.c,dcp-internal.h(d23b5dbaf0): removes unlockeddcp->typec_reconnect_tries = 0resets from all callers (dcp_typec_route_apply,dcp_tb_queue_reconnect,dcp_follow_attach,dcp_external_ready,dcp_external_retry_work,dcp_typec_attach_locked,dcp_poweron) and centralizes generation increment + tries reset indcp_queue_typec_reconnect_locked()underhpd_mutex. On connect failure,dcp_typec_reconnect_work()re-acquireshpd_mutexand ignores the failure ifgeneration != dcp->typec_reconnect_generation, preventing a stale worker from exhausting or overwriting a newer request's retry budget/deadline.drivers/gpu/drm/apple/dcp-fabric-topology-test.c(2b2b96b8db): setsDCP_IOMFB_METHODS_H17GonRGB8_PLAINand addsext26_firstordering assertion.tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py&run.py: compiles and exercises productiondcp_queue_typec_reconnect_locked()anddcp_typec_reconnect_work()across all 6(sessionless, flow)combinations for budget exhaustion, already-pending replacement, mid-connect replacement, success, and stale session.- Code is clean; ready to approve and merge once CI is green and the queued hardware rows land at
2b2b96b8.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: MERGE at 2b2b96b8db96
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: no Apple material, no AI attribution, human DCO Signed-off-by on both commits, no chip/board/firmware gates, no parameters or hardcoded safety limits, full diff (+186/-20 across 6 files) verified, typec_reconnect_generation and typec_reconnect_tries are consistently guarded by hpd_mutex without holding hpd_mutex across dcp_dptx_connect*() calls, dcp_typec_reconnect_work() bails early on delayed_work_pending() and checks generation != dcp->typec_reconnect_generation before consuming budget or re-arming retries, dcp-fabric-topology-test.c covers ext26_first (index 0) and non-default 10-bit profile (DCP_IOMFB_METHODS_H17G), host lifecycle suite (36/36 ASan/UBSan) + KUnit (7/7) + arm64 LLVM W=1 + checkpatch --strict clean, PR body has Tested: and Risk: two-way, branch is MERGEABLE against main.
Follow-ups (not blocking): queued CI; J700 s2idle reconnect + unplug/replug row
DjDeveloperr
left a comment
There was a problem hiding this comment.
Approve at 2b2b96b8db96. Every queued request now bumps typec_reconnect_generation and resets the tries under hpd_mutex. A worker re-reads the generation before counting a failure or re-arming, and returns when a newer request is already pending. Retries re-arm without bumping the generation, so one request keeps one budget. Dropping the scattered typec_reconnect_tries = 0 resets is safe, because every one of those sites queues through dcp_queue_typec_reconnect_locked(). The topology KUnit change is test-only. The J700 replug/s2idle row and one regression Mac are the remaining gate.
|
J773g (M4 mini, T8132, 27.2) |
What: Two drm/apple follow-ups. (1) Type-C reconnect: a failing old reconnect worker could use up a newer request's retry budget, or replace its deadline. Each queued request now gets a generation number and its own budget under hpd_mutex, and a worker only counts a failure or re-arms a retry while it still owns its request. (2) The fabric topology KUnit (follow-up to linux#2833) now covers native26 at index 0 and a non-default 10-bit profile, so the two mutants that used to survive now fail.
Tested: Build and host tests only, no Mac row yet. Arm64 LLVM W=1 builds dcp.o and dcp-fabric.o with no warnings. The DCP lifecycle host suite passes 36/36 under ASan/UBSan, and removing any one of the three safeguards makes it fail. Topology KUnit passes 7/7, and each old mutant now fails a new assertion. Strict checkpatch is clean.
Risk: two-way · Type-C/USB-C external displays on every Mac. The success path makes the same transport calls as before.
Not yet: a Neo (J700) row with s2idle reconnect and external-display unplug/replug cycles, plus one regression Mac. Both go in the next combined boot (lanes/HWROWS-QUEUE.md).
Details
The counter reset moves into the enqueue helper. The callers' resets are removed, including the unlocked resets in dcp-fabric.c. A replacement request that is already pending is left for its own queued run, and retries re-arm without refilling their budget.
Evidence
Fixes: 9fd048b. Source items: LINUX-BACKLOG-B.md:105 (reproduced retry-budget bug, part of draft linux#2364), REVIEW-WAVE-3.md:30 (#2833 mutants).