Skip to content

drm/shmem: revoke CPU PFNs before releasing purge backing - #198

Merged
RyanTheTide merged 2 commits into
neo-gpufrom
fix/pr171-review
Oct 8, 2026
Merged

RyanTheTide merged 2 commits into
neo-gpufrom
fix/pr171-review

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Revocable CPU VMAs hold PFN mappings without ordinary rmap references.
Dropping either the device page array or sparse CPU page references can
make those pages reclaimable while a user PTE still names them. Mark
the object purged and unmap all DRM VMAs, including the TLB invalidation,
before releasing either array or clearing unevictable protection. This
matches the existing idle-release ordering and covers both SG-first
faults and sparse CPU backing.

Both GPU probe paths allocate a DRM device before creating the GPU
manager. A successful no-op PinInit incorrectly claimed that AsahiData
was initialized, so ordinary firmware, identity or allocation failures
could run its destructor over uninitialized GPU and platform references.

Add explicit two-phase allocation to the existing Rust DRM device. Keep
the pinned data slot in UnsafeCell<MaybeUninit<_>> and publish destructor
ownership only after the real initializer succeeds. Use a static
allocation vtable while release state itself is uninitialized. Preserve
the ordinary initialized constructor and inline workqueue offsets.

Convert both Asahi probes to the explicit API, avoiding references to
uninitialized data. Partial initializer failures unwind their own fields;
post-initialization failures retain normal data destruction.

Follow-up to #171; original contributor commits are preserved. These fixes are based on public Linux/PR source and Linux-side tests.

Validation: full arm64 Image, modules and DTB build passed; strict checkpatch passed for the final code changes with only the required Assisted-by trailer diagnostic excluded. Deterministic source-extracted regression tests passed, with the original implementation failing the relevant negative control.

Hardware qualification on aurora-edge is pending. No boot, suspend, fault-injection or firmware recovery pass is claimed. The publication gate is separate from runtime acceptance.

🤖 Generated with Claude Code

Revocable CPU VMAs hold PFN mappings without ordinary rmap references.
Dropping either the device page array or sparse CPU page references can
make those pages reclaimable while a user PTE still names them. Mark
the object purged and unmap all DRM VMAs, including the TLB invalidation,
before releasing either array or clearing unevictable protection. This
matches the existing idle-release ordering and covers both SG-first
faults and sparse CPU backing.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Both GPU probe paths allocate a DRM device before creating the GPU
manager. A successful no-op PinInit incorrectly claimed that AsahiData
was initialized, so ordinary firmware, identity or allocation failures
could run its destructor over uninitialized GPU and platform references.

Add explicit two-phase allocation to the existing Rust DRM device. Keep
the pinned data slot in UnsafeCell<MaybeUninit<_>> and publish destructor
ownership only after the real initializer succeeds. Use a static
allocation vtable while release state itself is uninitialized. Preserve
the ordinary initialized constructor and inline workqueue offsets.

Convert both Asahi probes to the explicit API, avoiding references to
uninitialized data. Partial initializer failures unwind their own fields;
post-initialization failures retain normal data destruction.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit 9dbd46b into neo-gpu Oct 8, 2026
@RyanTheTide
RyanTheTide deleted the fix/pr171-review branch October 8, 2026 09:06
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.

1 participant