On Wed, Dec 02, 2026 at 11:58:54PM +0000, [email protected] wrote: > Thank you for your contribution! Sashiko AI review found 1 potential > issue to consider: > - [Medium] drm/xe/display: incomplete cleanup flush in > xe_display_unregister() > -- >
I don't know when about display, so I'm going to drop this one live with any preexiting related issues Sashiko flags. Matt > commit 6c15425fef0fac1bcda715813c673a4c85d77163 > Author: Matthew Brost <[email protected]> > > drm/xe/display: Flush cleanup work on unregister > > This commit flushes display atomic cleanup work in xe_display_unregister() > so that scanout framebuffers are unpinned before xe_bo_pci_dev_remove_all() > evicts all buffer objects on device removal. > > > diff --git a/drivers/gpu/drm/xe/display/xe_display.c > > b/drivers/gpu/drm/xe/display/xe_display.c > > index b1a6008bf15c6..68d29d78dc8b2 100644 > > --- a/drivers/gpu/drm/xe/display/xe_display.c > > +++ b/drivers/gpu/drm/xe/display/xe_display.c > > @@ -155,6 +155,14 @@ void xe_display_unregister(struct xe_device *xe) > > > > intel_display_driver_runtime_pm_disable(display); > > intel_display_driver_unregister(display); > > + > > + /* > > + * The shutdown commit unpins the framebuffers from the asynchronous > > + * cleanup work. Flush it so they are unpinned, and thus visible to > > + * the eviction in xe_bo_pci_dev_remove_all(), before the device > > + * is removed. > > + */ > > + intel_display_flush_cleanup_work(display); > > } > > [Severity: Medium] > Can intel_display_flush_cleanup_work() return while an earlier commit on > the same CRTC is still unpinning its old scanout framebuffer? > > intel_display_flush_cleanup_work() only waits on the first (newest) entry > of crtc->base.commit_list: > > drivers/gpu/drm/i915/display/intel_display.c:intel_display_flush_cleanup_work() > { > ... > spin_lock(&crtc->base.commit_lock); > commit = list_first_entry_or_null(&crtc->base.commit_list, > struct drm_crtc_commit, > commit_entry); > if (commit) > drm_crtc_commit_get(commit); > spin_unlock(&crtc->base.commit_lock); > > if (commit) { > wait_for_completion(&commit->cleanup_done); > drm_crtc_commit_put(commit); > } > ... > } > > When drm_atomic_helper_shutdown() submits the shutdown commit (commit 2), > stall_checks() only waits for cleanup_done of the second previous commit > (i == 1), and drm_atomic_helper_wait_for_dependencies() only waits for > hw_done and flip_done of the immediately preceding commit (commit 1, e.g. > from drm_client_dev_unregister() tearing down fbdev or a prior flip). > drm_atomic_helper_swap_state() prepends commit 2 to the head of > crtc->commit_list ahead of commit 1. > > Because display->wq.cleanup is allocated with WQ_HIGHPRI | WQ_PERCPU and > max_active = 0 (unordered), commit 1 and commit 2 can run > intel_atomic_cleanup_work() concurrently: > > kworker (commit 1) CPU0 (unregister / commit 2) > ------------------ ---------------------------- > intel_atomic_cleanup_work() > intel_atomic_cleanup_planes() > __xe_unpin_fb_vma() > ... > drm_atomic_helper_shutdown() > ... > queue_work(wq.cleanup, > &commit2->cleanup_work) > [commit 2 cleanup_work runs and > signals commit2->cleanup_done] > intel_display_flush_cleanup_work() > wait_for_completion( > &commit2->cleanup_done) > xe_bo_pci_dev_remove_all() > <-- commit 1's old fb BO is still > pinned and missed by eviction > > If commit 2 finishes cleanup_done first while commit 1 is still in > intel_atomic_cleanup_work(), intel_display_flush_cleanup_work() returns > before commit 1 unpins its old scanout BO. That BO stays pinned past > xe_bo_pci_dev_remove_all() and hits the NULL IOMMU group dereference on > final release after PCI device removal. > > Flushing display->wq.cleanup (or waiting for cleanup_done across all > commits on crtc->base.commit_list) would ensure all in-flight plane > cleanups have finished. > > -- > Sashiko AI review ยท > https://sashiko.dev/#/patchset/[email protected]?part=27
