Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 904CB606A32C for ; Wed, 2 Dec 2026 23:59:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iLFmOrLR Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 553F71126A1; Wed, 2 Dec 2026 23:59:02 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1CFF01126A1; Wed, 2 Dec 2026 23:58:56 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 483C06228E; Wed, 2 Dec 2026 23:58:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE56C1F00896; Wed, 2 Dec 2026 23:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796255935; bh=gabieYkzGzvDooSFyxQMEw8K9UkO/ufM4wwmyVHIpWI=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=iLFmOrLR8imM+aI9idPAoPwTxmzC+zQW7PraQ/WTzhGcZuk689mcp2s05xu+tlDYf J3+IFpFs7o4SVuIC/h+XJ+umyYs/sE17T/Ex5DGg9FD1UZ3lSbY7npCU3HW53zOK6k bHSPWN+nXetrLDbj3g3JTchM58HoKUz6/EgWSwZJPWYEbf8SL5eoQYD1iFJSHOlgUX zAuatpi1+P7hQiQGtk2GJ5FMtjJwMNoMgHj1GR1MOjJSaSGo4KUewpuVQIOYe2YdWn +VTfF2hDakWyQFT+F+tkjwnHCNBArWh3BWVeEyl2A7Xv/suBTwiD3MLUfqF3xnJMUe D3jdqnjSALfRg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v5 27/36] drm/xe/display: Flush cleanup work on unregister To: "Matthew Brost" , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org In-Reply-To: <20261202233323.3743190-28-matthew.brost@intel.com> References: <20261202233323.3743190-1-matthew.brost@intel.com> <20261202233323.3743190-28-matthew.brost@intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 23:58:54 +0000 X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Intel-xe" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: 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() -- commit 6c15425fef0fac1bcda715813c673a4c85d77163 Author: Matthew Brost 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) > =20 > 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_wo= rk() { ... spin_lock(&crtc->base.commit_lock); commit =3D 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 =3D=3D 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 =3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202233323.3743= 190-1-matthew.brost@intel.com?part=3D27