Skip to content

zocl: release the AIE partition unless libdfx owns it - #10140

Closed
ManojTakasi wants to merge 2 commits into
Xilinx:masterfrom
ManojTakasi:zocl-release-aie-unless-libdfx
Closed

ManojTakasi wants to merge 2 commits into
Xilinx:masterfrom
ManojTakasi:zocl-release-aie-unless-libdfx

Conversation

@ManojTakasi

Copy link
Copy Markdown
Collaborator

Problem solved by the commit

Slot 0 is used for both libdfx and non-libdfx loads. zocl_detach_aie() skipped aie_partition_release() for every slot 0, so a non-libdfx load never released the AIE partition zocl had requested with aie_partition_request().

On a libdfx load the destroy-hw-context ioctl runs first, and libdfxRemoveOverlay() does the configfs rmdir only after that ioctl returns. That rmdir runs aie_part_remove(). Releasing the partition inside the ioctl removes it a second time and oopses. That skip has to follow the libdfx dtbo path, not the slot index.

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered

Follow-up to #10124 (CR-1285405). The slot-0 detach fixed the libdfx double remove, and it also skipped the release on a non-libdfx slot 0 load.

How problem was solved, alternative solutions (if any) and why they were rejected

zocl_destroy_aie() now skips aie_partition_release() only when slot->slot_xclbin->zx_dtbo_path is non-empty. That path is stored at load time from za_dtbo_path_len. An empty path is not libdfx, because the ioctl still passes a pointer. zocl_detach_aie() is removed, and both hardware-context destroy paths call zocl_destroy_aie().

Keeping a second function that is identical except for the release call was rejected. The two paths differ by one condition, and that condition is known on the slot at destroy time.

Risks (if any) associated the changes in the commit

A libdfx slot with a non-empty dtbo path no longer releases the partition from zocl. The overlay rmdir remains the single aie_part_remove(). A non-libdfx slot, including slot 0, releases the partition it requested. zocl_aie_slot_reset() still releases unconditionally; the hardware-context exit path does not call reset.

What has been tested and how, request additional testing if necessary

Not run on hardware in this change. Please retest:

  • libdfx VCK190: run host.exe twice back to back (CR-1285405). The second DTBO load should not oops.
  • non-libdfx slot 0 AIE xclbin: destroy the hardware context and load again. aie_partition_request() should succeed because the previous partition was released.

Documentation impact (if any)

None.

Slot 0 is used by both libdfx and non-libdfx loads. Skipping
aie_partition_release for every slot 0 leaked the partition zocl
requested on the non-libdfx path. Skip the release only when the slot
has a libdfx dtbo path, because that overlay rmdir is the partition's
aie_part_remove.

Co-authored-by: Cursor <cursoragent@cursor.com>
The helper was used once. Keep the dtbo-path test next to the release
it gates.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

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