Skip to contentSkip to conversation

Patch "drm/amdgpu: hold reference to fences in amdgpu_sa_bo_new (v2)" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Mar 1, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

drm/amdgpu: hold reference to fences in amdgpu_sa_bo_new (v2)

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
drm-amdgpu-hold-reference-to-fences-in-amdgpu_sa_bo_new-v2.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From a8d81b36267366603771431747438d18f32ae2d5 Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= <[email protected]>
Date: Fri, 5 Feb 2016 10:59:43 -0500
Subject: drm/amdgpu: hold reference to fences in amdgpu_sa_bo_new (v2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Nicolai Hähnle <[email protected]>

commit a8d81b36267366603771431747438d18f32ae2d5 upstream.

An arbitrary amount of time can pass between spin_unlock and fence_wait_any_timeout, so we need to ensure that nobody frees the fences from under us.

A stress test (rapidly starting and killing hundreds of glxgears instances) ran into a deadlock in fence_wait_any_timeout after about an hour, and this race condition appears to be a plausible cause.

v2: agd: rebase on upstream

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +4 -1
@@ -354,12 +354,15 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_ma
 
 		for (i = 0, count = 0; i < AMDGPU_MAX_RINGS; ++i)
 			if (fences[i])
-				fences[count++] = fences[i];
+				fences[count++] = fence_get(fences[i]);
 
 		if (count) {
 			spin_unlock(&sa_manager->wq.lock);
 			t = fence_wait_any_timeout(fences, count, false,
 						   MAX_SCHEDULE_TIMEOUT);
+			for (i = 0; i < count; ++i)
+				fence_put(fences[i]);
+
 			r = (t > 0) ? 0 : t;
 			spin_lock(&sa_manager->wq.lock);
 		} else {

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/drm-amdgpu-remove-unnecessary-forward-declaration.patch queue-4.4/drm-amdgpu-hold-reference-to-fences-in-amdgpu_sa_bo_new-v2.patch