Skip to content

Adding shutdown handler support for zocl - #10017

Merged
chvamshi-xilinx merged 3 commits into
Xilinx:masterfrom
saifuddin-xilinx:shutdown_support
Aug 30, 2026
Merged

Adding shutdown handler support for zocl#10017
chvamshi-xilinx merged 3 commits into
Xilinx:masterfrom
saifuddin-xilinx:shutdown_support

Conversation

@saifuddin-xilinx

@saifuddin-xilinx saifuddin-xilinx commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Problem solved by the commit

  • Adds a platform-device shutdown handler to the ZOCL DRM driver so the driver can quiesce device activity during system shutdown/reboot/kexec, reducing the chance of ongoing traffic during subsystem restart.

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

  • Introduces zocl_drm_platform_shutdown() to quiesce DMA, soft CUs (SCUs), and AIE workqueues during shutdown.
    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

  • VITIS-15710

Risks (if any) associated the changes in the commit

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

Documentation impact (if any)

Signed-off-by: Saifuddin Kaijar <saifuddin.kaijar@amd.com>
@github-actions

Copy link
Copy Markdown
Contributor

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

Comment thread src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c Outdated
Signed-off-by: Saifuddin Kaijar <saifuddin.kaijar@amd.com>
@github-actions

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Comment thread src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c
Comment thread src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c
Comment thread src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c
Signed-off-by: Saifuddin Kaijar <saifuddin.kaijar@amd.com>
@github-actions

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 */

Comment thread src/runtime_src/core/edge/drm/zocl/common/zocl_drv.c
@saifuddin-xilinx

Copy link
Copy Markdown
Collaborator Author

retest this please

1 similar comment
@saifuddin-xilinx

Copy link
Copy Markdown
Collaborator Author

retest this please

@chvamshi-xilinx
chvamshi-xilinx merged commit d9482d9 into Xilinx:master Aug 30, 2026
38 of 40 checks passed
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.

3 participants