Adding shutdown handler support for zocl - #10017
Merged
chvamshi-xilinx merged 3 commits intoAug 30, 2026
Merged
Conversation
Signed-off-by: Saifuddin Kaijar <saifuddin.kaijar@amd.com>
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
Signed-off-by: Saifuddin Kaijar <saifuddin.kaijar@amd.com>
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
Suppressed comments (1)
src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c:1655
- Same as the remove() path: clearing zdev->zdev_dma_chan without synchronizing with the lazy DMA channel acquisition path can allow other threads to request and store a new DMA channel while shutdown teardown is in progress. That can leak channels and undermine the goal of quiescing DMA during shutdown. Please coordinate this with the DMA acquisition/use sites via a shared lock and/or a teardown flag that prevents new channel requests once shutdown begins.
/* Prevent new users from reusing the channel during shutdown */
zdev->zdev_dma_chan = NULL;
/* Ensure any in-flight transactions are stopped before releasing */
dmaengine_terminate_sync(chan);
dma_release_channel(chan);
Signed-off-by: Saifuddin Kaijar <saifuddin.kaijar@amd.com>
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c:1563
- DMA channel teardown in .remove updates zdev->zdev_dma_chan without any synchronization. Since the DRM device is still registered until later in remove(), an ioctl path could race here (e.g., allocate/reuse the channel after it was set to NULL, leading to leaks or use-after-release). Consider serializing access with mm_lock and capturing the pointer under the lock before terminating/releasing the channel.
if (zdev->zdev_dma_chan) {
struct dma_chan *chan = zdev->zdev_dma_chan;
/* Prevent new users from reusing the channel during teardown */
zdev->zdev_dma_chan = NULL;
/* Ensure any in-flight transactions are stopped before releasing */
Collaborator
Author
|
retest this please |
1 similar comment
Collaborator
Author
|
retest this please |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Problem solved by the commit
How problem was solved, alternative solutions (if any) and why they were rejected
Registers the new shutdown callback via .shutdown = zocl_drm_platform_shutdown in the platform_driver.
Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered
Risks (if any) associated the changes in the commit
What has been tested and how, request additional testing if necessary
Documentation impact (if any)