[26.04_linux-nvidia-bos] cxl: Backport Type-2 memdev lifetime fixes#483
Draft
nirmoy wants to merge 10000 commits into
Draft
[26.04_linux-nvidia-bos] cxl: Backport Type-2 memdev lifetime fixes#483nirmoy wants to merge 10000 commits into
nirmoy wants to merge 10000 commits into
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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— conditionaldevice_lock()guard supportdc372e5f429c— hold the memdev lock in event tracinge8069c66d093— validate the memdev driver incxl_reset_done()(adapted to the existing BOS guard)574eda81d0a7— hold the memdev lock during poison operationsd91feb88692e— block region deletion during region creation (adapted for downstreamcxl_create_region())The first SAUCE commit combines and adapts the remaining accepted mainline lifetime series:
4dd86ca99ffc— resolve region deletion racesbd3a6ff4b84e— pin memdev parents for their full lifetime2ed519c21bb4— distinguish class memory devicesd8dcb0b74b04— introducedevm_cxl_probe_mem()383f69656359— support!CONFIG_CXL_REGIONThe 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.organdlinux-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: passCONFIG_CXL_REGION=y,CONFIG_SFC_CXL=y, andCONFIG_VFIO_CXL_CORE=yChange-Id,BugLink, or internal bug URL trailersThe 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
Tracking