Skip to contentSkip to conversation

Patch "drm/vc4: Fix overflow mem unreferencing when the binner runs dry." has been added to the 4.7-stable tree

PATCH [email protected] 1 participant 1 message Sep 9, 2016

Subsystems (4)
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/vc4: Fix overflow mem unreferencing when the binner runs dry.

to the 4.7-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-vc4-fix-overflow-mem-unreferencing-when-the-binner-runs-dry.patch
and it can be found in the queue-4.7 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 9326e6f25574bbb8bd48206d245654780e3fd665 Mon Sep 17 00:00:00 2001

From: Eric Anholt <[email protected]>
Date: Tue, 26 Jul 2016 13:47:14 -0700
Subject: drm/vc4: Fix overflow mem unreferencing when the binner runs dry.

From: Eric Anholt <[email protected]>

commit 9326e6f25574bbb8bd48206d245654780e3fd665 upstream.

Overflow memory handling is tricky: While it's still referenced by the BPO registers, we want to keep it from being freed. When we are putting a new set of overflow memory in the registers, we need to assign the old one to the last rendering job using it.

We were looking at "what's currently running in the binner", but since the bin/render submission split, we may end up with the binner completing and having no new job while the renderer is still processing. So, if we don't find a bin job at all, look at the highest-seqno (last) render job to attach our overflow to.

Fixes ca26d28bbaa3 ("drm/vc4: improve throughput by pipelining binning and rendering jobs")
---
 drivers/gpu/drm/vc4/vc4_drv.h |    9 +++++++++
 drivers/gpu/drm/vc4/vc4_irq.c |    4 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_drv.h +9 -0
@@ -321,6 +321,15 @@ vc4_first_render_job(struct vc4_dev *vc4
 				struct vc4_exec_info, head);
 }
 
+static inline struct vc4_exec_info *
+vc4_last_render_job(struct vc4_dev *vc4)
+{
+	if (list_empty(&vc4->render_job_list))
+		return NULL;
+	return list_last_entry(&vc4->render_job_list,
+			       struct vc4_exec_info, head);
+}
+
 /**
  * struct vc4_texture_sample_info - saves the offsets into the UBO for texture
  * setup parameters.
drivers/gpu/drm/vc4/vc4_irq.c +3 -1
@@ -83,8 +83,10 @@ vc4_overflow_mem_work(struct work_struct
 
 		spin_lock_irqsave(&vc4->job_lock, irqflags);
 		current_exec = vc4_first_bin_job(vc4);
+		if (!current_exec)
+			current_exec = vc4_last_render_job(vc4);
 		if (current_exec) {
-			vc4->overflow_mem->seqno = vc4->finished_seqno + 1;
+			vc4->overflow_mem->seqno = current_exec->seqno;
 			list_add_tail(&vc4->overflow_mem->unref_head,
 				      &current_exec->unref_list);
 			vc4->overflow_mem = NULL;

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

queue-4.7/drm-vc4-fix-oops-when-userspace-hands-in-a-bad-bo.patch queue-4.7/drm-vc4-use-drm_free_large-on-handles-to-match-its-allocation.patch queue-4.7/drm-vc4-fix-overflow-mem-unreferencing-when-the-binner-runs-dry.patch