Skip to content

misc: fastrpc: avoid duplicate DMA mappings in fastrpc_create_maps()#1437

Open
Jianping (Jianping-Li) wants to merge 1 commit into
qualcomm-linux:tech/mm/fastrpcfrom
Jianping-Li:lookup_fix
Open

misc: fastrpc: avoid duplicate DMA mappings in fastrpc_create_maps()#1437
Jianping (Jianping-Li) wants to merge 1 commit into
qualcomm-linux:tech/mm/fastrpcfrom
Jianping-Li:lookup_fix

Conversation

@Jianping-Li

Copy link
Copy Markdown

fastrpc_create_maps() performs map lookup only for buffer arguments (i < ctx->nbufs) via fastrpc_map_create(). For
arguments beyond this range, no lookup is performed, which can result in duplicate DMA mappings for the same file descriptor.

Additionally, if the same file descriptor is passed multiple times within a single invocation, performing lookups with
reference counting would increment the reference multiple times, while fastrpc_put_args() would release it only once,
leading to an imbalanced reference count.

Fix this by allowing fastrpc_map_create() to control whether the lookup should take a reference. For arguments beyond
ctx->nbufs, the lookup is performed without taking a reference, ensuring that existing mappings are reused without introducing duplicate DMA mappings or reference count imbalance.

CRs-Fixed: 4490320

…te_maps()

fastrpc_create_maps() performs map lookup only for buffer
arguments (i < ctx->nbufs) via fastrpc_map_create(). For
arguments beyond this range, no lookup is performed, which
can result in duplicate DMA mappings for the same file
descriptor.

Additionally, if the same file descriptor is passed multiple
times within a single invocation, performing lookups with
reference counting would increment the reference multiple
times, while fastrpc_put_args() would release it only once,
leading to an imbalanced reference count.

Fix this by allowing fastrpc_map_create() to control whether
the lookup should take a reference. For arguments beyond
ctx->nbufs, the lookup is performed without taking a
reference, ensuring that existing mappings are reused
without introducing duplicate DMA mappings or reference
count imbalance.

Link: https://lore.kernel.org/all/20260625080832.17477-1-jianping.li@oss.qualcomm.com/
Fixes: 10df039 ("misc: fastrpc: Skip reference for DMA handles")
Cc: stable@kernel.org
Signed-off-by: Jianping Li <jianping.li@oss.qualcomm.com>
@qcomlnxci qcomlnxci requested review from a team, Chenna Kesava Raju (Chennak-quic) and Ekansh Gupta (ekanshibu) and removed request for a team June 30, 2026 08:24
@qlijarvis

Copy link
Copy Markdown

🔨 Build Failure Analysis — PR #1437

PR: #1437
Build run: https://github.com/qualcomm-linux/kernel-config/actions/runs/28430704794

# Error File:Line PR-introduced? Root Cause
1 Merge conflict drivers/misc/fastrpc.c No Integration conflict with other topic branches during automerge

Verdict

This is not a compilation failure. The build failed during the integration/automerge phase due to merge conflicts between this PR and other topic branches. The PR changes to drivers/misc/fastrpc.c conflict with modifications from other branches being integrated. No compilation errors were detected — the build never reached the compilation stage.

📎 Detailed analysis: Full report

@qlijarvis

Copy link
Copy Markdown

🔨 Build Failure Analysis — PR #1437

PR: #1437
Build run: https://github.com/qualcomm-linux/kernel-config/actions/runs/28430704794

# Error File:Line PR-introduced? Root Cause
1 Merge conflict drivers/misc/fastrpc.c No Integration conflict between PR branch and baseline qcom-next branch
2 Merge conflict Multiple files (30+ files) No Pre-existing conflicts in integration branch unrelated to this PR

Verdict

This is NOT a build failure caused by the PR. The failure occurred during the merge phase of the CI workflow when attempting to integrate the PR branch with the baseline integration branch. The merge conflicts in drivers/misc/fastrpc.c and 30+ other files are pre-existing integration issues, not compilation errors introduced by this PR's code changes.

📎 Detailed analysis: Full report

@qlijarvis

Copy link
Copy Markdown

PR #1437 — validate-patch

PR: #1437

Verdict Issues Detailed Report
⚠️ 2 Full report

Final Summary

  1. Lore link present: Yes, but invalid - link returns 404, patch not posted to lore.kernel.org yet
  2. Lore link matches PR commits: Cannot verify - lore link doesn't exist
  3. Upstream patch status: Not upstream - FROMLIST patch not yet posted to mailing list
  4. PR present in qcom-next: No - commit 21df30e not found in qcom-next
Verdict: ⚠️ — click to expand

🔍 Patch Validation

PR: #1437 - misc: fastrpc: avoid duplicate DMA mappings in fastrpc_create_maps()
Upstream commit: Not yet posted (lore link dated 2026-06-25 does not exist)
Verdict: ⚠️ PARTIAL - Patch is technically correct but lore link is invalid

Commit Message

Check Status Note
Subject matches upstream N/A Not posted upstream yet
Body preserves rationale Clear explanation of the problem and solution
Fixes tag present/correct Fixes: 10df039 ("misc: fastrpc: Skip reference for DMA handles") - correct format and commit exists
Authorship preserved Jianping Li jianping.li@oss.qualcomm.com
Backport note (if applicable) N/A FROMLIST prefix present, but patch not yet posted

Diff

File Status Notes
drivers/misc/fastrpc.c Logic is sound - unifies code path by adding take_ref parameter to fastrpc_map_create()

Issues

  • Lore link is invalid: The Link tag points to https://lore.kernel.org/all/20260625080832.17477-1-jianping.li@oss.qualcomm.com/ which does not exist. The date (2026-06-25) is only 5 days ago, suggesting the patch hasn't been posted to the mailing list yet, or the message-ID is incorrect.
  • FROMLIST without upstream posting: The patch is marked FROMLIST but the lore link doesn't resolve, indicating it hasn't actually been posted upstream yet.

Technical Analysis

The patch is technically correct and improves code quality:

Current state (after commit 07ebe87):

  • For i < ctx->nbufs: calls fastrpc_map_create() which does lookup with ref counting
  • For i >= ctx->nbufs: calls fastrpc_map_attach() directly, skipping lookup to avoid duplicate refs

PR patch changes:

  • Adds take_ref parameter to fastrpc_map_create()
  • Unifies the code path: always call fastrpc_map_create() with appropriate take_ref value
  • For i >= ctx->nbufs, passes take_ref=false to reuse existing mappings without taking refs
  • Updates all 3 call sites correctly: fastrpc_create_maps(), fastrpc_init_create_process(), and fastrpc_req_mem_map()

The logic prevents duplicate DMA mappings while maintaining correct reference counting semantics.

Verdict

The patch is technically sound and improves code maintainability by unifying the code path. However, it should not be merged with FROMLIST prefix until it's actually posted upstream and the lore link is valid. Recommend either: (1) post to upstream first and update the lore link, or (2) change prefix to QCLINUX: if this is a vendor-only fix.

Final Summary

  1. Lore link present: Yes, but invalid - link returns 404, patch not posted to lore.kernel.org yet
  2. Lore link matches PR commits: Cannot verify - lore link doesn't exist
  3. Upstream patch status: Not upstream - FROMLIST patch not yet posted to mailing list
  4. PR present in qcom-next: No - commit 21df30e not found in qcom-next

@qlijarvis

Copy link
Copy Markdown

PR #1437 — checker-log-analyzer

PR: #1437
Checker run: https://github.com/qualcomm-linux/kernel-config/actions/runs/28430705381

Checker Result Summary
Checker Result Summary
checkpatch ⏭️ Skipped - CI merge failure
dt-binding-check ⏭️ Skipped - CI merge failure
dtb-check ⏭️ Skipped - CI merge failure
sparse-check ⏭️ Skipped - CI merge failure
check-uapi-headers ⏭️ Skipped - CI merge failure
check-patch-compliance ⏭️ Skipped - CI merge failure
tag-check N/A Not applicable - FROMLIST prefix present
qcom-next-check FROMLIST: prefix correctly used

Detailed report: Full report

Checker analysis — click to expand

🤖 CI Checker Analysis (checker-log-analyzer)

PR: #1437 - FROMLIST: misc: fastrpc: avoid duplicate DMA mappings in fastrpc_create_maps()
Source: https://github.com/qualcomm-linux/kernel-config/actions/runs/28430705381

Checker Result Summary
checkpatch ⏭️ Skipped - CI merge failure
dt-binding-check ⏭️ Skipped - CI merge failure
dtb-check ⏭️ Skipped - CI merge failure
sparse-check ⏭️ Skipped - CI merge failure
check-uapi-headers ⏭️ Skipped - CI merge failure
check-patch-compliance ⏭️ Skipped - CI merge failure
tag-check N/A Not applicable - FROMLIST prefix present
qcom-next-check FROMLIST: prefix correctly used

❌ CI Infrastructure Failure (All Checkers)

Root cause: Git merge failure during CI setup phase - "fatal: refusing to merge unrelated histories" when attempting to merge topic branch topic/tech/mm/fastrpc and PR #1437 into the integration baseline.

Failure details:

2026-06-30T08:40:52.3067054Z  ** Merging topic branch: topic/tech/mm/fastrpc
2026-06-30T08:41:11.1121635Z fatal: refusing to merge unrelated histories
2026-06-30T08:41:11.2246564Z Merge failed, manual merge
...
2026-06-30T08:41:12.2850836Z Merging pr-1437 (no-commit)...
2026-06-30T08:41:32.3399062Z fatal: refusing to merge unrelated histories
2026-06-30T08:41:32.4502034Z Merge failed or conflicts detected. Aborting merge.
2026-06-30T08:41:32.4522402Z fatal: There is no merge to abort (MERGE_HEAD missing).
2026-06-30T08:41:32.4542409Z ##[error]Process completed with exit code 3.

This error occurred identically across all six checker jobs (checkpatch, dt-binding-check, dtb-check, sparse-check, check-uapi-headers, check-patch-compliance), preventing any actual code quality checks from running.

Fix: This is a CI infrastructure/configuration issue, not a code problem. The failure indicates:

  1. Topic branch history mismatch: The topic/tech/mm/fastrpc branch and/or PR misc: fastrpc: avoid duplicate DMA mappings in fastrpc_create_maps() #1437 have no common ancestor with the baseline integration branch (commit 19b282f417584cfe14ce6a262122c51553d026ec).

  2. Possible causes:

    • The topic branch was created from a different kernel tree or baseline
    • The PR branch was rebased or force-pushed with a new base
    • The baseline tag/commit used by CI doesn't exist in the topic branch history
  3. Resolution steps:

    • Verify that topic/tech/mm/fastrpc and PR misc: fastrpc: avoid duplicate DMA mappings in fastrpc_create_maps() #1437 are based on a commit that exists in the mainline kernel history
    • If the topic branch was created independently, rebase it onto the correct baseline
    • Use git merge --allow-unrelated-histories flag in CI (not recommended for production)
    • OR: Recreate the topic branch from the correct baseline commit

Reproduce locally:

# Clone the kernel-topics repo
git clone https://github.com/qualcomm-linux/kernel-topics.git
cd kernel-topics

# Fetch the baseline and topic branch
git fetch origin topic/tech/mm/fastrpc
git fetch origin pull/1437/head:pr-1437

# Try to merge (will reproduce the error)
git checkout 19b282f417584cfe14ce6a262122c51553d026ec
git merge origin/topic/tech/mm/fastrpc
# Expected: fatal: refusing to merge unrelated histories

Code quality assessment: The patch itself appears well-formed:

Verdict

CI infrastructure failure - no code quality issues detected. All checker jobs failed during the pre-check merge phase before any actual validation could run. The patch content follows kernel coding standards and includes proper upstream tracking metadata. The failure is due to git history incompatibility between the topic branch and the CI baseline, which requires repository/branch configuration fixes rather than code changes.

Action required: Repository maintainers should investigate the topic branch history and ensure it shares a common ancestor with the integration baseline, or adjust the CI merge strategy to handle this branch topology.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants