Skip to content

rust: fix DRM-off builds and xarray KUnit sleeping allocations - #356

Merged
RyanTheTide merged 3 commits into
aurora-wipfrom
fix/rust-dmabuf-xarray-20261018
Oct 17, 2026
Merged

RyanTheTide merged 3 commits into
aurora-wipfrom
fix/rust-dmabuf-xarray-20261018

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Rust builds with CONFIG_DRM disabled fail under CONFIG_WERROR because the DMA-BUF stub's private conversion helpers have no users. Gate the stub on CONFIG_DRM=y, matching its only consumer, the Rust DRM GEM abstraction.

The xarray KUnit tests also allocate KBox values with GFP_KERNEL while holding xa_lock. Prepare the values before taking the lock and pass ownership into the insertion checks. The XArray operations retain GFP_KERNEL because their C helpers release and reacquire the lock around blocking allocations.

The DRM-off lane then exposed an older reservation-helper link failure. Backport upstream be809b6 by Mukesh Kumar Chaurasiya (IBM), retaining its author and credits. The 7.2.10 topics already contain that helper guard; their separate port contains only the two Rust fixes.

Validation:

  • The original AOP lane fails the strict gate on the unfixed xarray BUG. Both final 7.1 AOP lanes and the 7.2 DRM-off lane pass, including xarray 3/3, with zero splats and compiler diagnostics.
  • The exact same DRM-off WERROR config fails on the base's DMA-BUF dead code and builds/boots on the fixed tree.
  • The published Neo config matches apart from LOCALVERSION. Image, stripped modules and DTBs build with zero compiler warnings/errors; Rust W=1 is clean.
  • Checkpatch: zero errors. Source/message private-data scan: zero hits. Added agent files: zero.

A separate pre-existing configuration issue remains: enabling DMA_SHARED_BUFFER while disabling DRM makes FenceChain::into_raw unused under WERROR. That broader profile is recorded as a draft follow-up.

🤖 Generated with Claude Code

RyanTheTide and others added 3 commits October 17, 2026 23:35
The DMA-BUF stub was introduced for GEM export callbacks. Its crate-private
conversion helpers are used only by the DRM abstraction, which is built
only with CONFIG_DRM=y. Building Rust without that abstraction leaves the
helpers unused and fails with CONFIG_WERROR=y.

Give the stub the same configuration guard as its consumer. Gating on
CONFIG_DMA_SHARED_BUFFER alone would still leave the helpers unused when
another subsystem selects DMA-BUF support without built-in DRM.

Fixes: 177c185 ("rust: Add dma_buf stub bindings")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The xarray tests create KBox values with GFP_KERNEL after acquiring the
XArray spinlock. DEBUG_ATOMIC_SLEEP reports a sleeping allocation in
rust_xarray_kunit, although the test assertions themselves pass.

Allocate every test value before acquiring the guard and pass the values
into the insertion checks. Keep GFP_KERNEL for the XArray operations:
the C __xa_* helpers release and reacquire xa_lock when they need a
blocking allocation. KBox::new cannot release that lock.

Fixes: 977de23 ("rust: xarray: add `insert` and `reserve`")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
When building with LLVM=1 for architectures like powerpc where
CONFIG_DMA_SHARED_BUFFER is not enabled, the build fails with:

  ld.lld: error: undefined symbol: dma_resv_reset_max_fences
  >>> referenced by helpers.c
  >>>               rust/helpers/helpers.o:(rust_helper_dma_resv_unlock)

The issue occurs because:
1. CONFIG_DEBUG_MUTEXES=y is enabled
2. CONFIG_DMA_SHARED_BUFFER is not enabled
3. dma_resv_reset_max_fences() is declared in the header when
   CONFIG_DEBUG_MUTEXES is set
4. But the function is only compiled in drivers/dma-buf/dma-resv.c,
   which is only built when CONFIG_DMA_SHARED_BUFFER is enabled
5. Rust helpers call dma_resv_unlock() which calls
   dma_resv_reset_max_fences(), causing an undefined symbol

Fix this by compiling `dma-resv.c` file only when CONFIG_DMA_SHARED_BUFFER
is enabled.

(cherry picked from commit be809b6
 ("dma-resv: Fix undefined symbol when CONFIG_DMA_SHARED_BUFFER is disabled"))

Fixes: 9b83664 ("rust: helpers: Add bindings/wrappers for dma_resv_lock")
Reviewed-by: Christian König <[email protected]>
Reviewed-by: Gary Guo <[email protected]>
Signed-off-by: Mukesh Kumar Chaurasiya (IBM) <[email protected]>
Signed-off-by: Madhavan Srinivasan <[email protected]>
Link: https://patch.msgid.link/[email protected]

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit 3db04ae into aurora-wip Oct 17, 2026
@RyanTheTide
RyanTheTide deleted the fix/rust-dmabuf-xarray-20261018 branch October 17, 2026 14:48
RyanTheTide added a commit that referenced this pull request Oct 17, 2026
Bring the 7.2.10 assembly to the tree of the canonical top-up #7
assembly, stacked on top-up #6a 40a2ec8 so that it is a
fast-forward of that publish head. The second parent is that canonical
assembly; the tree is identical to it.

Ported from aurora-wip, each commit with cherry-pick -x and its
original author:
- #306: aurora_j700_defconfig, regenerated for 7.2.10 with savedefconfig
  from the published 7.2.10 J700 configuration (900-config-tooling);
- #354 (j700/clamshell-mic-v4), 3 commits: the LPAI pointer published
  after its frames, the spin_lock_irqsave() Rust helpers, and the mics
  reported unplugged with the lid closed (070-audio);
- #355 (j700/tipd-hpd-pulse-v2), 9 commits: the CD321x DisplayPort
  hotplug decisions, their trace events and KUnit tests (170-usb), and
  the apple-dcp selftests that compile them (200-dcp);
- #356 (fix/rust-dmabuf-xarray-20261018): the dma_buf stub gated on
  built-in DRM and the xarray KUnit values allocated before xa_lock
  (210-gpu, with the Fixes: tags of the 7.2.10 base); its dma-resv
  backport is already in asahi-wip;
- #357 (fix/sep-followups-20261018), 7 commits: dma_wmb()/dma_rmb() for
  Rust, the SEP shared buffers ordered against the mailbox, the hwrng
  and sleep glue and its tests, and the trusted-keys built-in source
  fixes (100-sep).

Our own 7.2-native commits, not on aurora-wip (100-sep): the Rust
system_dfl_wq wrapper, and the SEP, Asahi DRM and binder work moved
off the deprecated system_wq. Their AOP change is not carried: the
070-audio AOP driver already registers its services on its own
ordered queue.

Adaptations, each with a [ryan: ...] note in its commit:
- the AOP lid tests go after the parser tests, where 7.2.10 has the
  name tests (context only);
- trusted_key_core_done goes next to 7.2.10's
  trusted_key_source_migratable (context only);
- the defconfig is regenerated, not picked; its note lists the 62
  lines that differ from the 7.1 file, none of them a J700 setting.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
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