Skip to content

[26.04_linux-nvidia-bos] cxl: Backport Type-2 memdev lifetime fixes#483

Draft
nirmoy wants to merge 10000 commits into
NVIDIA:26.04_linux-nvidia-bosfrom
nirmoy:codex/cxl-attach-action-deadlock-fix
Draft

[26.04_linux-nvidia-bos] cxl: Backport Type-2 memdev lifetime fixes#483
nirmoy wants to merge 10000 commits into
NVIDIA:26.04_linux-nvidia-bosfrom
nirmoy:codex/cxl-attach-action-deadlock-fix

Conversation

@nirmoy

@nirmoy nirmoy commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Backport the complete mainline CXL Type-2 memdev lifetime model to the 7.0 BOS kernel. This replaces the narrow endpoint-pointer guard proposed in #482 with the locking and ownership model used by mainline.

The BOS adaptation migrates both in-tree Type-2 users, SFC and VFIO, to devm_cxl_probe_mem(), removes the callback-based region helper surface, and ties endpoint, memdev, and region teardown to the consumer lifetime.

Patch stack

The first five commits bring in the prerequisite locking and region protection:

  • bb729bf1d6fd — conditional device_lock() guard support
  • dc372e5f429c — hold the memdev lock in event tracing
  • e8069c66d093 — validate the memdev driver in cxl_reset_done() (adapted to the existing BOS guard)
  • 574eda81d0a7 — hold the memdev lock during poison operations
  • d91feb88692e — block region deletion during region creation (adapted for downstream cxl_create_region())

The first SAUCE commit combines and adapts the remaining accepted mainline lifetime series:

  • 4dd86ca99ffc — resolve region deletion races
  • bd3a6ff4b84e — pin memdev parents for their full lifetime
  • 2ed519c21bb4 — distinguish class memory devices
  • d8dcb0b74b04 — introduce devm_cxl_probe_mem()
  • 383f69656359 — support !CONFIG_CXL_REGION

The final SAUCE commit fixes a self-deadlock if devres action allocation fails while the region read lock is held.

Behavior change

After a device is confirmed as CXL.mem, the VFIO path now fails binding when the required topology or firmware-committed region is unavailable instead of leaving a published memdev or silently falling back to partially initialized plain VFIO state. Jiandi should validate this policy on the target hardware.

This stack supersedes #482 after functional validation; the guard PR and this lifetime backport should not both be merged.

Upstream plan

The dependency stack is already accepted in mainline 7.2. The clean upstream version of the new deadlock fix is preserved on codex/cxl-attach-action-deadlock-fix-upstream.

After fault-injection and lockdep validation, post that clean patch to linux-cxl@vger.kernel.org and linux-kernel@vger.kernel.org, then track review on lore. The combined SFC/VFIO migration remains BOS SAUCE because it adapts downstream Type-2 users.

Current validation

  • git diff --check: pass
  • Complete code tree matches the independently reviewed prepared backport
  • CXL core, CXL PCI/mem, SFC CXL, VFIO PCI, and VFIO CXL objects: build pass
  • Relevant build configuration enabled: CONFIG_CXL_REGION=y, CONFIG_SFC_CXL=y, and CONFIG_VFIO_CXL_CORE=y
  • Final deadlock fix: strict checkpatch pass
  • Commit policy audit: no Change-Id, BugLink, or internal bug URL trailers

The target branch's older checkpatch reports inherited ACQUIRE_ERR() assignment-in-condition findings in two accepted upstream backports; no local rewrite was made to those upstream changes.

Pending validation

  • Fault-inject devres action allocation failure under lockdep
  • Type-2 VFIO attach, access, reset, repeated bind/unbind, and teardown
  • SFC CXL probe/remove
  • BOS package build
  • Strata/Vera boot with CXL memdev enumeration

Tracking

Loading
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.