stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] drm/nouveau: Fix WARN_ON in nouveau_fence_context_kill()
       [not found] <20250415121900.55719-2-phasta@kernel.org>
@ 2025-04-15 12:19 ` Philipp Stanner
  2025-04-23 15:54   ` Danilo Krummrich
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Stanner @ 2025-04-15 12:19 UTC (permalink / raw)
  To: Lyude Paul, Danilo Krummrich, David Airlie, Simona Vetter,
	Sabrina Dubroca, Sumit Semwal, Christian König
  Cc: dri-devel, nouveau, linux-kernel, netdev, linux-media,
	linaro-mm-sig, Philipp Stanner, stable

Nouveau is mostly designed in a way that it's expected that fences only
ever get signaled through nouveau_fence_signal(). However, in at least
one other place, nouveau_fence_done(), can signal fences, too. If that
happens (race) a signaled fence remains in the pending list for a while,
until it gets removed by nouveau_fence_update().

Should nouveau_fence_context_kill() run in the meantime, this would be
a bug because the function would attempt to set an error code on an
already signaled fence.

Have nouveau_fence_context_kill() check for a fence being signaled.

Cc: <stable@vger.kernel.org> # v5.10+
Fixes: ea13e5abf807 ("drm/nouveau: signal pending fences when channel has been killed")
Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Philipp Stanner <phasta@kernel.org>
---
 drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index 7622587f149e..6ded8c2b6d3b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -90,7 +90,7 @@ nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error)
 	while (!list_empty(&fctx->pending)) {
 		fence = list_entry(fctx->pending.next, typeof(*fence), head);
 
-		if (error)
+		if (error && !dma_fence_is_signaled_locked(&fence->base))
 			dma_fence_set_error(&fence->base, error);
 
 		if (nouveau_fence_signal(fence))
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 1/2] drm/nouveau: Fix WARN_ON in nouveau_fence_context_kill()
  2025-04-15 12:19 ` [PATCH v2 1/2] drm/nouveau: Fix WARN_ON in nouveau_fence_context_kill() Philipp Stanner
@ 2025-04-23 15:54   ` Danilo Krummrich
  0 siblings, 0 replies; 2+ messages in thread
From: Danilo Krummrich @ 2025-04-23 15:54 UTC (permalink / raw)
  To: Philipp Stanner
  Cc: Lyude Paul, David Airlie, Simona Vetter, Sabrina Dubroca,
	Sumit Semwal, Christian König, dri-devel, nouveau,
	linux-kernel, netdev, linux-media, linaro-mm-sig, stable

On Tue, Apr 15, 2025 at 02:19:00PM +0200, Philipp Stanner wrote:
> Nouveau is mostly designed in a way that it's expected that fences only
> ever get signaled through nouveau_fence_signal(). However, in at least
> one other place, nouveau_fence_done(), can signal fences, too. If that
> happens (race) a signaled fence remains in the pending list for a while,
> until it gets removed by nouveau_fence_update().
> 
> Should nouveau_fence_context_kill() run in the meantime, this would be
> a bug because the function would attempt to set an error code on an
> already signaled fence.
> 
> Have nouveau_fence_context_kill() check for a fence being signaled.
> 
> Cc: <stable@vger.kernel.org> # v5.10+
> Fixes: ea13e5abf807 ("drm/nouveau: signal pending fences when channel has been killed")
> Suggested-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Philipp Stanner <phasta@kernel.org>

Applied to drm-misc-fixes, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-23 15:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250415121900.55719-2-phasta@kernel.org>
2025-04-15 12:19 ` [PATCH v2 1/2] drm/nouveau: Fix WARN_ON in nouveau_fence_context_kill() Philipp Stanner
2025-04-23 15:54   ` Danilo Krummrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).